Back to blog

Reasoning Model Architecture: How o3, DeepSeek-R1, and Thinking Models Work (2026)

How reasoning models generate answers through extended thinking — chain-of-thought, process reward models, test-time compute scaling, and when to use them. With architecture diagram prompts for each pattern.

R
Ryan·Senior AI Engineer
·

Reasoning models — OpenAI o3, DeepSeek-R1, Google Gemini Flash Thinking, and Anthropic's extended-thinking Claude variants — represent a structural shift in how LLMs generate answers. Instead of producing a response in a single forward pass, they generate an internal chain of thought first, then produce the final answer. The result is dramatically better performance on math, code, and multi-step reasoning tasks — at the cost of higher latency and token spend.

Understanding reasoning model architecture helps you decide when to use them, how to route requests between reasoning and standard models, and how to diagram the systems you build with them.

The core architectural shift: thinking tokens

Standard LLMs (GPT-4o, Claude 3.5 Sonnet, Gemini Pro) produce output tokens directly. Given a prompt, the model runs a single autoregressive pass to generate the response. Reasoning models insert a thinking phase before the response:

  1. Thinking phase: The model generates a scratchpad of internal reasoning — hypotheses, intermediate calculations, sub-problem decomposition, self-correction. These tokens are typically hidden from the end user but consume API quota and add latency. In some APIs (Anthropic extended thinking), they are returned as a separate thinking block.
  2. Response phase: After the thinking budget is exhausted or the model decides it has reasoned enough, it generates the final answer conditioned on the thinking tokens. The response is typically shorter and more accurate than a standard model would produce without thinking.

The thinking tokens act as working memory — a scratch space where the model can be wrong, backtrack, and try again before committing to an answer. This is architecturally analogous to letting a human write rough notes before writing a final document.

Training architecture: how reasoning is learned

Reasoning capability is trained differently from standard instruction tuning. The two dominant approaches are reinforcement learning with process supervision and large-scale synthetic chain-of-thought generation.

Process reward models (PRMs)

A process reward model assigns a correctness score to each step of a reasoning chain, not just the final answer. This is in contrast to an outcome reward model (ORM), which only scores the final result.

  • PRM advantage: The model learns which reasoning steps are valid, even when the final answer happens to be correct for the wrong reasons. This produces more robust reasoning.
  • PRM challenge: Step-level labels require human annotators to evaluate intermediate reasoning steps, which is expensive. OpenAI used large-scale human annotation; DeepSeek used synthetic data generation to scale labeling.
  • Training pipeline: A base LLM generates candidate reasoning chains → the PRM scores each step → the scores are used as rewards in RL fine-tuning (typically PPO or GRPO) → the fine-tuned model generates better chains → repeat.

Monte Carlo Tree Search (MCTS) at inference time

Some reasoning models (notably OpenAI o-series) use a search procedure at inference time rather than greedy decoding:

  • The model generates multiple candidate next reasoning steps (branches).
  • A verifier or value model scores each branch.
  • The highest-scoring branch is expanded further (tree search).
  • This continues until a terminal state (complete answer) is reached.

MCTS dramatically increases the compute used at inference time in exchange for better answers — this is the "test-time compute scaling" phenomenon. More compute at inference = better results, independently of model size.

Diagram prompt: reasoning model training pipeline

"Reasoning model training pipeline. Show two phases: (1) Supervised warm-up: a base LLM is fine-tuned on synthetic chain-of-thought examples from a teacher model (e.g., GPT-4o generates reasoning traces for math problems, which train the student model to produce step-by-step thinking). (2) RL fine-tuning loop: the warm-started model generates candidate reasoning chains for a problem → a process reward model (PRM) scores each reasoning step → a value model aggregates step scores into a chain-level reward → PPO or GRPO updates the policy model to produce higher-reward chains → the updated model generates new chains for the next iteration. Show the PRM as a separate neural network trained on step-level human annotations. Show the RL loop cycling: policy model → candidate chains → PRM → rewards → policy update → repeat. Label the final output as a reasoning-capable model with thinking tokens."

Inference architecture: test-time compute scaling

Standard LLMs have a fixed inference cost per output token. Reasoning models scale inference compute dynamically based on problem difficulty — harder problems consume more thinking tokens. This creates a new architectural consideration: compute budgeting.

Thinking budget control

Most reasoning APIs expose a parameter to control thinking depth:

  • Anthropic extended thinking: budget_tokens sets the maximum thinking token allocation. Higher budgets = better accuracy on hard problems, higher cost and latency.
  • OpenAI o-series: reasoning_effort (low / medium / high) controls how many internal reasoning tokens are used. High effort is best for complex coding and math; low effort suffices for most writing tasks.
  • Dynamic routing: Well-architected LLM applications route easy requests to fast/cheap standard models and complex requests to reasoning models. A classifier or heuristic (query length, task type, confidence score from a cheap model) decides the routing.

Diagram prompt: reasoning model inference with dynamic routing

"LLM inference architecture with reasoning model routing. A user request arrives at an AI gateway. A task classifier (lightweight model or rule-based system) categorizes the request by complexity: simple (summarization, translation, short Q&A) → routes to a standard model (e.g., Claude Haiku, GPT-4o-mini) with low latency and cost; complex (multi-step math, code generation with tests, research synthesis) → routes to a reasoning model (Claude Sonnet thinking, o3, DeepSeek-R1) with a configured thinking budget. For the reasoning path, show the model producing thinking tokens (scratchpad, hidden from user) then the final response. Show a cost tracker that accumulates thinking token spend separately from output token spend. Include a timeout/fallback path: if the reasoning model exceeds a latency budget, fall back to the standard model with a chain-of-thought prompt. Label thinking tokens, output tokens, and their respective costs."

Reasoning model vs. standard model: when to use each

Task typeUse reasoning model?Reason
Multi-step math or proofsYesIntermediate steps compound errors; thinking prevents this
Complex code generation with testsYesReasoning models plan before writing, catching logic errors
Security vulnerability analysisYesRequires multi-step threat modeling and attack chain reasoning
Long document summarizationNoTask is sequential, not multi-step; standard model is faster
Customer support classificationNoSimple classification; reasoning overhead is wasted
Architecture diagram generationSometimesStandard models handle typical diagrams; reasoning helps for complex multi-service architectures with many constraints
Agent planning with many toolsYesMulti-step tool selection benefits from thinking through dependencies before acting
Real-time chat responsesNoLatency (5–60s thinking) is incompatible with conversational UX

Architectural patterns for building with reasoning models

Pattern 1: Thinking-gated verification

Use a standard model for initial generation, then a reasoning model to verify the output before returning it to the user. This is especially effective for high-stakes outputs like financial calculations, legal analysis, or security reviews where a wrong answer is worse than a slow one.

"Thinking-gated verification pipeline for a financial analysis AI. A user submits a financial modeling question. A fast standard model (Claude Haiku) generates an initial answer and shows it in a streaming preview. In parallel, a reasoning model (Claude Sonnet extended thinking, budget_tokens: 8000) independently generates its own answer and verifies the fast model's reasoning chain step by step. If the reasoning model agrees, the fast answer is confirmed and returned. If it disagrees, the reasoning model's answer replaces the fast model's output, with a flag indicating 'verified' or 'corrected'. Show the parallel paths, the comparison step, and the conditional output. Include latency estimates: fast path 1–2s, reasoning verification 8–20s."

Pattern 2: Decompose-then-reason

Use a standard model to decompose a complex task into sub-problems, then use a reasoning model on each sub-problem. The reasoning model handles the hard parts; the standard model handles orchestration. This reduces total thinking token spend compared to feeding the whole problem to a reasoning model.

Pattern 3: Streaming thinking for transparency

Anthropic's extended thinking API returns thinking tokens in a streaming response. Applications can surface these to users as a "showing work" feature — displaying the model's reasoning process while the final answer is being generated. This builds trust in high-stakes domains like medicine, law, and engineering.

Frequently asked questions

What is a reasoning model in LLMs?

A reasoning model is an LLM that generates an extended internal chain of thought before producing its final answer. The internal reasoning (sometimes called thinking tokens or scratchpad) allows the model to break down complex problems, check intermediate steps, and backtrack when it detects errors — producing more accurate answers on hard tasks at the cost of higher latency and token usage.

How is a reasoning model different from chain-of-thought prompting?

Chain-of-thought (CoT) prompting is a technique where you ask a standard model to "think step by step" in its output. The model generates visible reasoning as part of its answer. Reasoning models have CoT built into their architecture at a deeper level — the thinking is generated before the answer, with dedicated training (RL with process rewards) to make the thinking genuinely useful rather than just plausible-looking. A reasoning model trained with RL is more reliable than a standard model prompted to think step by step.

When should I use a reasoning model in my architecture?

Use reasoning models when: (1) the task has multiple interdependent steps where errors compound (math, multi-hop code, constraint satisfaction); (2) correctness matters more than speed; (3) you need the model to self-verify before committing. Avoid reasoning models for high-throughput, low-latency tasks like classification, simple Q&A, or real-time chat. Build a routing layer that selects the right model based on task complexity rather than always using the most expensive model.

How do I diagram a reasoning model system?

Describe the thinking phase and response phase as separate steps, show the thinking token budget as a configurable parameter, and illustrate how results flow through verification before reaching the user. Use ArchitectureDiagram.ai and paste one of the prompts above to generate a diagram instantly.

Related guides: LLM architecture diagrams, LLM evaluation architecture, AI guardrails architecture, and multi-agent orchestration patterns.

Ready to try it yourself?

Start Creating - Free