Chapter 4 · Reasoning and Test-Time Compute¶
4.1 Why does chain-of-thought (CoT) work? ★★¶
One-sentence answer
Chain-of-thought (CoT) has the model write out intermediate reasoning steps before giving the answer. The core reason it works is that a Transformer spends a fixed amount of computation per generated token, and each intermediate token stores the result of one full forward pass in the context, where later tokens can read it, turning fixed-depth computation into serial computation of variable length; in addition, it breaks a hard problem into simple steps that are closer to the training data. The gains from CoT are concentrated on math, logic and algorithmic problems.
I will address three aspects: the two ways of using CoT, why it works, and where it applies and where it falls short.
(1) CoT comes in few-shot and zero-shot forms; both have the model reason first and answer second.
- Few-shot CoT: the examples in the prompt do not give the answer directly but first write out the step-by-step reasoning and then the answer; imitating the format of the examples, the model also reasons before answering (Wei et al. 2022). Its advantage is that the format and style of the reasoning can be controlled through the examples; the cost is writing the examples by hand and using up context.
- Zero-shot CoT: no examples are needed; simply appending "Let's think step by step" to the question makes the model write out its reasoning (Kojima et al. 2022). It is general and effortless but gives weaker control over format, and usually a second prompt is needed to extract the final answer from the reasoning.
Today, instruction-tuned models usually write out their reasoning by default when they meet a reasoning problem, and reasoning models have gone further, making long CoT a trained default behavior (see 4.4).
(2) The core reason CoT works is that it increases the amount of serial computation available for each answer.
When a Transformer generates a token, the computation passes through a fixed number \(L\) of layers in sequence, so the amount of computation is fixed. If the model must output the answer to a multi-step problem directly, all the intermediate steps have to be completed within the single forward pass that produces that one token, and since the number of layers is limited, the model cannot finish once there are too many steps. Conversely, every reasoning token the model writes adds another full forward pass, and the result is written into the context as a token, where later tokens can read it through attention. The context therefore acts as a scratchpad, turning "computation of fixed depth" into "serial computation of variable length": the model can write as many steps as the problem needs. Theoretical work supports this explanation: without CoT, a constant-depth Transformer can only solve a class of highly parallelizable problems, whereas once it is allowed to generate sufficiently long intermediate steps, the class of problems it can solve expands substantially (Feng et al. 2023; Merrill & Sabharwal 2023). In addition, CoT decomposes a complex problem into a chain of simple conditional predictions, each resembling the many "step-by-step solution" texts in the training data, and therefore easier to predict correctly.
(3) The gains from CoT are concentrated on problems that require symbolic computation, and the written reasoning is not necessarily faithful.
- The gains are concentrated on math, logic and algorithmic problems: Sprague et al. (2024) ran a meta-analysis of more than 100 papers and found that the improvements from CoT come mainly from math and symbolic reasoning; on MMLU, direct answering and CoT achieve nearly the same accuracy, except on questions where the question or the response contains an equals sign. For tasks such as knowledge question answering, CoT therefore mainly adds latency and cost.
- Early on it required a large enough model: Wei et al. (2022) found that only models at the scale of about 100B parameters at the time benefited clearly; smaller models wrote reasoning that read fluently but was often wrong (for the debate over whether "emergence" is real, see Chapter 2 of the "LLM Training Pipeline" direction).
- CoT does not necessarily reflect the internal computation faithfully: Turpin et al. (2023) added a biasing hint to the prompt (for example, "I think the answer is A"); the model changed its answer because of the hint, yet gave a different, plausible-sounding rationale in the CoT without ever mentioning the hint. CoT can therefore help us understand a model, but it cannot be taken directly as a record of the model's actual reasoning process.
In summary: the essence of CoT is using the context as a scratchpad, trading more tokens for more serial computation, and this is also the starting point of test-time scaling.
Going deeper: theoretical results and classic numbers
(1) In theory, CoT expands the class of problems a Transformer can solve.
Without CoT, a constant-depth, finite-precision Transformer can only compute a class of problems that constant-depth circuits can complete in parallel (\(\mathsf{TC}^0\) in circuit complexity). Many problems, however, are inherently serial, such as the multi-step expression \(((3+5)\times 2-4)\div 3\): the result of each step is needed by the next, so it cannot be computed in a single parallel step. Feng et al. (2023) proved that a bounded-depth Transformer cannot directly output the answers to basic arithmetic and equation problems unless its size grows super-polynomially with the input length, whereas a constant-size Transformer with CoT can solve them; Li et al. (2024) proved that with \(T\) steps of CoT, a constant-depth Transformer can simulate a Boolean circuit of size \(T\); and Merrill & Sabharwal (2023) showed that, under certain assumptions, a linear number of CoT steps suffices to recognize all regular languages, and a polynomial number corresponds exactly to the complexity class \(\mathsf{P}\). These results show that the length of the CoT is itself a computational resource.
(2) Key numbers from classic experiments.
| Work | Setup | Result |
|---|---|---|
| Few-shot CoT (Wei et al. 2022) | PaLM 540B, 8 exemplars, GSM8K | State of the art at the time, surpassing a fine-tuned GPT-3 with a verifier |
| Zero-shot CoT (Kojima et al. 2022) | text-davinci-002, MultiArith and GSM8K | MultiArith from 17.7% to 78.7%, GSM8K from 10.4% to 40.7% |
| Where CoT helps (Sprague et al. 2024) | 14 models, 20 datasets | About 95% of CoT's gain on MMLU comes from questions whose question or response contains an equals sign |
Follow-up questions
Follow-up 1: If we just make the model output more tokens, say a string of meaningless filler symbols, would we get the same improvement?
In general, no. Pfau et al. (2024) replaced CoT with filler tokens such as "......" and found that the model could use filler tokens for extra computation only on specific tasks that can be decomposed in parallel, and only after dedicated training; in general, filler tokens do not deliver the gains of CoT. This shows that the value of CoT lies not only in a few extra forward passes but, more importantly, in writing down intermediate results for later steps to read and use.
Follow-up 2: Does the CoT a model writes represent its actual reasoning process?
Not necessarily. Beyond Turpin et al. (2023)'s findings on ordinary models, Chen et al. (2025) ran a similar experiment on reasoning models: after an answer hint was placed in the prompt, the models did use the hint, but in most settings the rate at which they acknowledged using it in their chain of thought was often below 20%. Monitoring the chain of thought is therefore a useful tool for understanding and overseeing models, but one cannot assume that it fully and faithfully reflects the model's internal computation.
Follow-up 3: When should CoT not be used?
On tasks that do not need multi-step computation, and with reasoning models, there is no need for an extra CoT prompt. For knowledge retrieval, simple classification or latency-sensitive settings, CoT mainly adds cost and barely improves accuracy (Sprague et al. 2024). For reasoning models, long thinking is already a trained default behavior, and adding few-shot CoT examples can even hurt: the DeepSeek-R1 paper found that few-shot prompting consistently degraded its performance, and therefore recommended describing the problem and output format directly in a zero-shot setting (DeepSeek-AI 2025).
Common mistakes
- Do not say that a CoT prompt makes the model "learn to reason": Prompted CoT changes no parameters; it only changes how the computation is organized, allowing abilities the model already has to come through.
- Do not say that CoT helps on all tasks: Its gains are concentrated on math, logic and algorithmic problems.
- Do not treat CoT as a faithful record of the model's internal reasoning: A model may be influenced by some factor yet give a different rationale in its CoT.
- Do not say that CoT works only because "the output got longer": Filler tokens generally do not help; what matters is that intermediate results are written down and used by later steps.
4.2 What are self-consistency and best-of-N? ★★¶
One-sentence answer
Both are forms of parallel test-time compute: sample \(N\) independent responses to the same question, then select one of them. Self-consistency takes a majority vote over the final answers, needing no extra model but requiring answers that can be compared exactly; best-of-N uses a verifier or reward model to score each response and selects the highest-scoring one, which applies more broadly but is limited by the quality of the verifier, and when \(N\) is large it also picks responses that exploit the verifier's flaws.
I will address three aspects: how self-consistency works and why, how best-of-N works and its risks, and how to choose between them.
(1) Self-consistency takes a majority vote over the final answers of several reasoning paths.
Self-consistency (Wang et al. 2022) builds on CoT: sample \(N\) reasoning paths for the same question at a fairly high temperature, each yielding a final answer \(a_i\), then select the most frequent answer:
Here \(\mathbb{1}[\cdot]\) is the indicator function, equal to 1 when the condition holds and 0 otherwise. It works because the correct answer can usually be reached by many different reasoning paths, which eventually converge on the same answer, whereas wrong paths go wrong in all sorts of ways, so their answers scatter across many different values; the correct answer is therefore more likely to win the vote. In probabilistic terms, what we really care about is "which answer is most likely", not "which reasoning path is most likely"; greedy decoding gives only the single most probable path, while voting approximately sums over all paths, that is, it marginalizes over reasoning paths.
(2) Best-of-N uses a verifier to score each response and selects the highest-scoring one.
Best-of-N also samples \(N\) responses, but instead of voting, it uses a verifier to score each response and selects the one with the highest score:
Here \(x\) is the question, \(y_i\) is the \(i\)-th response, and \(r\) is the score given by the verifier. Verifiers come in three common forms:
- Rule-based verifiers: for example, unit tests for code, exact matching for math answers and formal proof checking. They almost never misjudge, so more samples are always better.
- Learned reward models: an ORM gives the whole response one score, whereas a PRM scores each reasoning step (for how the two differ, see 8.7 in the "LLM Training Pipeline" direction).
- An LLM as the verifier: the model first writes a verification analysis and then gives a verdict, i.e. a generative verifier.
Voting and scoring can also be combined, which is called weighted voting: add up the scores of all responses that reach the same answer and select the answer with the highest total. However, the risk of best-of-N is that the verifier is imperfect: the larger \(N\) is, the more chances there are for a candidate that "scores high with the verifier but is actually wrong" to appear, and best-of-N picks exactly those out; this is reward over-optimization (Gao et al. 2022; see 6.7 in the "LLM Training Pipeline" direction).
(3) The choice between them depends on whether answers can be compared and whether a reliable verifier exists.
Voting needs only repeated sampling, but it requires answers in a form that can be compared exactly, such as numbers, options or short answers; open-ended long text cannot be voted on directly (in that case an LLM can pick, from several responses, the one most consistent with the others, which is universal self-consistency, Chen et al. 2023); moreover, if the model is systematically biased toward a wrong answer, voting only reinforces that error. Best-of-N can be used on open-ended tasks and can pick out a correct answer that is in the minority, but it adds the cost of verifier scoring, and its ceiling is set by the verifier. For both methods, the gains saturate as \(N\) grows: Brown et al. (2024) found that the fraction of problems where "at least one of \(N\) samples is correct" (coverage) keeps rising with \(N\), but without an exact verifier, the selection accuracy of voting and reward models plateaus after a few hundred samples, far below coverage. (If, instead of waiting for every path to finish before choosing, one evaluates, prunes and backtracks at intermediate steps, one obtains tree-search methods such as Tree-of-Thoughts, Yao et al. 2023; step-level search is covered in 4.3.)
In summary: self-consistency and best-of-N both trade repeated sampling for accuracy; the difference is whether the selection relies on "the majority" or on "a verifier": the former depends on the comparability of answers, the latter on the reliability of the verifier.
Comparing the three selection methods:
| Majority voting (self-consistency) | Best-of-N | Weighted voting | |
|---|---|---|---|
| Basis for selection | How often a final answer appears | The verifier's score | Sum of scores for the same answer |
| Extra requirement | None | A verifier or reward model | A verifier or reward model |
| Applicable answer form | Short answers that can be compared exactly | Any form | Short answers that can be compared exactly |
| Main risk | Systematic errors get reinforced | The larger \(N\), the easier to exploit the verifier | Depends on both comparability and the verifier, but the effect of any single scoring error is averaged out |
Going deeper: classic numbers and how far best-of-N moves from the original model
(1) Classic results.
| Work | Setup | Result |
|---|---|---|
| Self-consistency (Wang et al. 2022) | Several models and reasoning benchmarks | An absolute gain of 17.9 points over a single CoT on GSM8K |
| PRM selection (Lightman et al. 2023) | A PRM selects among many candidate solutions | Solves 78% of problems on a representative subset of MATH, better than an ORM and majority voting |
| o1 (OpenAI 2024) | AIME 2024 | 74% with a single sample, 83% with majority voting over 64 samples, 93% when re-ranking 1000 samples with a learned scoring function |
o1's three numbers correspond exactly to three usages: a single sample, self-consistency and best-of-N, showing that parallel scaling remains effective even for reasoning models.
(2) How far best-of-N moves from the original model grows only logarithmically in \(N\).
Here \(\pi\) is the output distribution of the original model, \(\pi_{\text{BoN}}\) is the output distribution corresponding to "sample \(N\) and select the highest-scoring one", and the KL measures how far apart the two are (Stiennon et al. 2020; Beirami et al. 2024 pointed out that this commonly used formula is actually an upper bound). For example, with \(N=16\) the KL is about \(2.77-0.94 \approx 1.8\) nats. It shows that best-of-N is a "gentle" optimization: doubling \(N\) increases the divergence by only about 0.69 nats. This is why it is often used as a strong baseline for RLHF, and also used to compare how much different methods over-optimize at the same KL.
Follow-up questions
Follow-up 1: Why does self-consistency sample at a fairly high temperature?
Because voting needs diverse reasoning paths. With greedy decoding, the \(N\) samples would be the identical path, and voting would be meaningless; if the temperature is too high, the quality of each individual path drops noticeably (for how temperature works, see 2.2). A moderate temperature is therefore usually used; the original paper used temperatures of roughly 0.5 to 0.7.
Follow-up 2: Is a larger \(N\) always better?
No. The cost grows linearly with \(N\) while the gains saturate: without an exact verifier, selection accuracy plateaus after a few hundred samples (Brown et al. 2024); with a learned reward model, an overly large \(N\) also picks out responses that exploit the reward model's flaws, so true quality actually declines. Only with exact verifiers such as unit tests and formal proof checkers does increasing \(N\) keep paying off.
Follow-up 3: What is the vote agreement rate good for?
It is a cheap and effective confidence signal. The higher the share of the top answer, the more reliable the answer usually is, so it can be used to decide whether to abstain or hand off to a human (see 5.7). It can also save compute: Adaptive-Consistency (Aggarwal et al. 2023) stops sampling once the agreement rate is high enough and keeps sampling only on questions where the samples disagree.
Common mistakes
- Do not say that self-consistency needs a reward model: It only takes a majority vote and needs no extra model.
- Do not say that a larger \(N\) is always better for best-of-N: With an imperfect verifier, an overly large \(N\) leads to over-optimization.
- Do not treat pass@N as the accuracy of best-of-N: pass@N assumes a perfect verifier, and the actual selection accuracy is usually far below it (see 5.2).
- Do not say that voting can correct systematic errors: If the model's most frequent answer is itself wrong, voting only reinforces the error.
4.3 What is test-time scaling, and how do parallel and sequential scaling differ? ★★★¶
One-sentence answer
Test-time scaling means keeping the model's parameters fixed and spending more compute at inference to raise accuracy. Parallel scaling samples several independent responses and selects among them by voting or with a verifier, keeping latency roughly flat but being limited by the verifier; sequential scaling lets the model think longer along one chain, checking and revising itself, so later computation builds on earlier results, but latency grows with length. Snell et al. (2024) found that a compute-optimal strategy, which allocates compute according to problem difficulty, is more than 4 times as efficient as uniform best-of-N and can substitute for a larger model on easy and medium problems, but on the hardest problems it cannot substitute for the basic capability that pretraining provides.
I will address four aspects: why spending more inference compute helps, how the two kinds of scaling differ, how to allocate test-time compute optimally, and the trade-off between test-time compute and training compute.
(1) Spending more inference compute helps because a model's probability of "getting it right in one try" is far below its probability of "being able to get it right".
On many problems, one of several dozen samples will be correct, but the initial sample does not necessarily take that path; the extra inference compute is spent closing this gap. When releasing o1, OpenAI reported that performance improves steadily with two kinds of compute: the compute spent on RL training, and the compute spent thinking at test time (OpenAI 2024). Test-time compute thus became a new scaling dimension alongside pretraining scale: the model stays the same, and only the amount of compute spent per question changes.
(2) Parallel and sequential scaling differ in whether the computations depend on each other.
- Parallel scaling: sample several independent responses to the same question and then aggregate them, including majority voting and best-of-N (see 4.2) as well as PRM-guided search. PRM-guided search does not wait for whole responses before choosing; instead it runs beam search at the step level: at each step it generates several candidate next steps for each partial solution and keeps only the few with the highest PRM scores for further expansion (for how PRMs and ORMs differ, see 8.7 in the "LLM Training Pipeline" direction). Its advantages are diverse samples and, given enough hardware, latency that barely grows with the number of samples; its disadvantages are that samples share no information and the results are limited by the verifier.
- Sequential scaling: spend compute along a single chain, where later computation builds on earlier results, including the long chains of thought of reasoning models (see 4.4), multi-round revision, and budget forcing. Budget forcing (Muennighoff et al. 2025) controls thinking length directly at decoding time: to make the model think less, force in the end-of-thinking delimiter when the budget is reached so it answers right away; to make it think more, suppress the end-of-thinking delimiter when the model tries to stop and append "Wait", which often makes the model re-check its earlier reasoning and correct mistakes. Its advantage is that it can reuse and correct existing reasoning; its disadvantages are that latency grows with length and that the model may go further and further down a wrong path.
Note that without external feedback, a model's "self-correction" of its own reasoning often does not work and can even turn correct answers into wrong ones (Huang et al. 2023); multi-round revision therefore works best when reliable feedback is available (such as compiler errors, test results or tool outputs).
(3) The optimal allocation of test-time compute depends on problem difficulty.
Snell et al. (2024) found that no single strategy is best for every problem. On easy problems, the initial answer is often already close to correct, and sequential revision that polishes it locally is enough; on hard problems, the initial approach may be wrong altogether, so parallel sampling is needed to explore entirely different directions, combined with sequential revision in a suitable ratio. Similarly, PRM-guided beam search beats best-of-N when the budget is small and the problems are hard, but as the budget grows, the search over-exploits the PRM's biases and actually falls behind best-of-N on easy problems. They therefore first estimate a problem's difficulty and then choose a different strategy and budget for each difficulty level, which is compute-optimal test-time scaling, and it is more than 4 times as efficient as uniformly using best-of-N. In practice, difficulty can be approximated with signals from the model itself, such as the agreement rate of a few samples or the verifier's score.
(4) Test-time compute can only partly substitute for training compute, and the trade-off depends on deployment scale.
Snell et al. (2024) compared "a small model plus test-time compute" with "a model 14 times larger" at matched total FLOPs: on easy and medium problems, the small model can win; but on the hardest problems, scaling up pretraining is still more effective. The reason is that test-time compute can only make abilities the model already has, but uses unreliably, come through more reliably; if the model simply cannot do a certain kind of problem, no amount of sampling will find the correct answer. Moreover, the two have different cost structures: training compute is paid once and amortized over all requests, whereas test-time compute is paid again for every request. Therefore, when the total volume of inference requests far exceeds the training volume, training a stronger model is the better deal; when the request volume is small, or only a few hard problems are worth extra compute, test-time compute is the better deal.
In summary: the core of test-time scaling is shifting part of the compute from training to inference and allocating it on demand according to problem difficulty; parallel scaling relies on diversity and a verifier, sequential scaling relies on the model's ability to check and revise itself, and in practice the two are usually combined.
Comparing parallel and sequential scaling:
| Parallel scaling | Sequential scaling | |
|---|---|---|
| Typical methods | Majority voting, best-of-N, PRM-guided search | Long chains of thought, multi-round revision, budget forcing |
| How compute is spent | Many independent samples | One chain, where later computation depends on earlier results |
| Latency | Roughly flat given enough hardware | Grows with length |
| Depends on | An aggregation method: voting or a verifier | The model's ability to check and revise itself |
| Strength | High diversity; coverage keeps rising with the number of samples | Reuses and corrects earlier reasoning |
| Weakness | Samples share no information; limited by the verifier | May get stuck on a wrong path; may overthink |
| Better suited to | Hard problems: different approaches need to be explored | Easy and medium problems: local correction is enough |
Going deeper: key experiments and numbers
(1) The setup and conclusions of Snell et al. (2024).
On MATH, they studied two mechanisms for using test-time compute: searching with a PRM as the verifier, and training a revision model that improves the answer step by step based on its previous attempts. There are three main conclusions: the compute-optimal strategy is more than 4 times as efficient as best-of-N; at matched total FLOPs, on problems where the small model already has a non-trivial success rate, test-time compute can beat a model 14 times larger; and this substitution depends on the ratio of inference volume to pretraining volume: when inference tokens are far fewer than pretraining tokens, test-time compute is the better deal, but as inference volume grows, this remains true only for easy problems, while hard problems favor scaling up pretraining.
(2) The coverage of repeated sampling and the selection bottleneck (Brown et al. 2024).
On SWE-bench Lite, DeepSeek-Coder-V2-Instruct solves 15.9% of issues with a single sample; with 250 samples, the fraction with at least one success reaches 56%, exceeding the single-attempt state of the art of 43% at the time. Coverage often grows log-linearly with the number of samples. However, on tasks without an automatic verifier, the selection accuracy of majority voting and reward models plateaus after a few hundred samples, and selection becomes the bottleneck.
(3) The effect of budget forcing (Muennighoff et al. 2025).
s1 fine-tunes Qwen2.5-32B-Instruct on only 1,000 curated reasoning problems with their reasoning traces (s1K) and, combined with budget forcing, obtains a curve in which accuracy rises with thinking length: on AIME 2024, extending the thinking by appending "Wait" raises accuracy from 50% to 57%, and on competition math it exceeds o1-preview by up to 27%.
(4) The ceiling of a small model plus search (Liu et al. 2025).
With a strong PRM and the best search strategy chosen for each setting, a 1B model can surpass a 405B model on MATH-500; the optimal strategy depends jointly on the policy model, the PRM and the problem difficulty. Such results, however, rely on a strong verifier and are concentrated on math problems with verifiable answers.
(5) The exchange between training compute and test-time compute is not unique to LLMs.
Jones (2021) found, using AlphaZero on the game of Hex, that training compute and test-time search compute can substitute for each other while keeping playing strength unchanged, with increases and decreases in the two trading off roughly order of magnitude for order of magnitude. Test-time scaling in LLMs can be seen as this regularity showing up in language models.
Follow-up questions
Follow-up 1: Why can PRM-guided search fall behind best-of-N when the budget is large?
Because the search optimizes against the PRM at every step, so the PRM's errors get amplified. The larger the budget, the more precisely beam search finds paths that "the PRM scores highly", which are not necessarily the truly correct ones, and the diversity among candidates also drops; best-of-N selects only once at the end and exploits the PRM less, so it is actually more robust when the budget is large and the problems are easy (Snell et al. 2024). This is the same problem as best-of-N's over-optimization when \(N\) is too large, only it sets in earlier.
Follow-up 2: How can test-time scaling be done on tasks without a reliable verifier, such as open-ended writing?
Only weaker selection signals are available, so the gains are limited. Common approaches are to have an LLM judge compare candidates in pairs or eliminate them tournament-style, or to generate several responses and pick the one most consistent with the others (universal self-consistency). Sequential revision without external feedback also struggles to improve reliably (Huang et al. 2023). The gains from test-time scaling are therefore most pronounced on verifiable tasks such as math and code.
Follow-up 3: Now that reasoning models exist, does parallel scaling still matter?
Yes; the two are complementary. A long chain of thought is sequential scaling, and running several long chains of thought on the same question in parallel and then aggregating them still raises accuracy further: o1 scores 74% on AIME 2024 with a single sample and 83% with majority voting over 64 samples (OpenAI 2024). Some products' high-compute modes also run several reasoning chains in parallel and aggregate them, trading more compute for higher accuracy.
Follow-up 4: Can the gains from test-time compute be turned into the model's own capability?
Yes, by using the good answers found through test-time search as training data. For example, repeated sampling plus a verifier filters out correct reasoning traces, which are then used for rejection-sampling fine-tuning or distillation; DeepSeek-R1's training pipeline uses this kind of rejection sampling (see Chapter 8 and Chapter 9 of the "LLM Training Pipeline" direction). In this way, a one-time training cost "amortizes" expensive test-time compute over every subsequent inference.
Common mistakes
- Do not say that test-time compute can fully replace pretraining scale: On the hardest problems, scaling up pretraining is still more effective; test-time compute can only bring out abilities the model already has.
- Do not say that longer thinking is always better: Thinking length and accuracy are not monotonically related; overthinking exists, and there are even tasks where more thinking makes things worse (see 4.5).
- Do not say that the accuracy of parallel scaling rises without limit as the number of samples grows: Coverage keeps rising, but without an exact verifier, selection accuracy saturates quickly.
- Do not say that a model's self-correction always works: Without external feedback, self-revision often fails and can even turn right answers into wrong ones.
- Do not take compute-optimal to mean giving every problem the same budget: Its core is precisely allocating different strategies and budgets according to difficulty.
4.4 How do reasoning models (such as o1 and DeepSeek-R1) differ from ordinary models at inference time? ★★¶
One-sentence answer
Before giving the final answer, a reasoning model first generates a very long chain of thought (usually thousands to tens of thousands of tokens) containing behaviors such as trying several methods, verifying itself and backtracking after finding a mistake, effectively carrying out a search within a single sequence; this behavior is trained through large-scale RL rather than elicited by a prompt, so accuracy rises with thinking length. The cost is a large increase in latency and token usage, so by 2025–2026 the mainstream approach was to offer thinking and non-thinking modes within one model or product, with the user setting an "effort level" or the model deciding adaptively how long to think.
I will address three aspects: the differences in reasoning behavior, how thinking is controlled and how that control has evolved, and the effect of long thinking on inference serving.
(1) Reasoning models first generate a long chain of thought and reflect and backtrack within it.
- Length: the CoT of an ordinary model is usually only a few hundred tokens, whereas a reasoning model's thinking is usually thousands to tens of thousands of tokens.
- Behavior: the chain of thought shows behaviors such as trying different methods, checking intermediate results, and discovering a mistake (for example, "wait, this is wrong") and starting over. An ordinary CoT is essentially a single linear pass of reasoning, whereas a reasoning model effectively carries out an "explore, verify, backtrack" search within one sequence.
- Origin: these behaviors are not a procedure written by people; they were reinforced during large-scale RL on verifiable rewards. During training, DeepSeek-R1-Zero's response length grew spontaneously and reflective behavior emerged (for the training method, see Chapter 8 of the "LLM Training Pipeline" direction).
As a result, reasoning models have a test-time scaling property that ordinary models lack: the longer they think, the more they get right (OpenAI 2024). In other words, they internalize into a single chain of thought part of the "search" that 4.3 carries out through external sampling and selection.
(2) How much the model thinks can be controlled, and the control has evolved from fixed budgets toward adaptive thinking.
Because long thinking is expensive and not always necessary, every lab provides ways to control thinking, and the control has gone through roughly three stages of evolution.
- Fixed thinking budgets: the early approach let the user specify a cap on thinking tokens, as in Claude 3.7 Sonnet's extended thinking and Qwen3's thinking budget; when the cap is reached, the system forcibly ends the thinking and has the model answer based on the thinking so far.
- Hybrid thinking and non-thinking modes: a single model switches between the two modes through markers in the template, for example Qwen3's /think and /no_think, while DeepSeek-V3.1 switches through its chat template; GPT-5 uses a router at the product level to send requests to either a fast model or a thinking model. Putting both behaviors into one model is not free, however: in July 2025 the Qwen team switched to releasing separate Instruct and Thinking models, on the grounds that training them separately was the way to get the best quality for both.
- Adaptive thinking by difficulty: by 2026, mainstream APIs had gradually moved from fixed token budgets to "effort" levels, with the model itself deciding whether to think and for how long, for example OpenAI's reasoning effort, Gemini 3's thinking level, and Anthropic's adaptive thinking combined with an effort parameter (which replaced the fixed budget_tokens in the Claude 4.6 series). These levels are behavioral guidance rather than strict token caps.
(3) Long thinking changes the cost structure of inference serving.
A reasoning model's output is far longer than its input, so the center of gravity of inference cost shifts from prefill to decode: in the decode phase, every generated token requires reading all the weights and the existing KV cache, so speed is limited by memory bandwidth, and the KV cache in turn grows linearly with thinking length (see 0.2 and 1.2). As a result, for the same question, a reasoning model's latency and memory footprint can be several to dozens of times those of an ordinary model. Thinking tokens are usually billed as output tokens, even when the API returns only a summary of the thinking. In addition, many models discard the thinking content of earlier turns in a multi-turn conversation and keep only the final answers, to save context; in agent settings, however, the model needs to keep thinking between tool calls (interleaved thinking), and then the thinking content within the current turn must be preserved and passed back to the model.
In summary: the fundamental difference between reasoning models and ordinary models is that part of the search is internalized from external sampling and selection into a single long chain of thought; this brings accuracy that rises with thinking length, as well as latency and cost that need to be controlled on demand.
Comparing ordinary models and reasoning models:
| Ordinary model + prompted CoT | Reasoning model (o1, DeepSeek-R1, etc.) | |
|---|---|---|
| Where the reasoning comes from | The prompt: examples or "think step by step" | RL on verifiable rewards, usually after SFT on long CoT |
| Typical length | A few hundred tokens | Thousands to tens of thousands of tokens |
| Behavior | Essentially linear, one pass | Explores, verifies itself, backtracks |
| Test-time scaling | Weak: longer chains help little | Accuracy rises with the thinking budget |
| Cost | Low | High latency, many tokens, may overthink |
Going deeper: key numbers, the visibility of thinking content, and how hybrid modes are implemented
(1) Key numbers.
| Model | AIME 2024 result |
|---|---|
| GPT-4o (OpenAI 2024) | About 12% |
| o1 (OpenAI 2024) | 74% with a single sample |
| DeepSeek-R1-Zero (DeepSeek-AI 2025) | pass@1 rose from 15.6% to 71.0% during RL; majority voting reaches 86.7% |
| DeepSeek-R1 (DeepSeek-AI 2025) | pass@1 of 79.8%, on par with the full release of o1 |
(2) The visibility of thinking content varies by model.
The o1 series does not return the raw chain of thought, only a summary; the Claude 4 series returns a summary of the thinking by default; open models such as DeepSeek-R1 return the full thinking content. Keeping the raw chain of thought private is partly a competitive consideration (to prevent it from being used directly for distillation) and partly a way to preserve room for monitoring the chain of thought.
(3) How hybrid modes are implemented in training.
Taking Qwen3 as an example, thinking data and non-thinking data are mixed during training, with non-thinking samples keeping an empty thinking block so that the two modes share the same format, and the two are distinguished by markers; at inference, inserting an empty thinking block into the template skips the thinking. The thinking budget is implemented by inserting an instruction that tells the model to stop thinking and answer directly once the cap is reached (see Chapter 0 of the "LLM Training Pipeline" direction).
Follow-up questions
Follow-up 1: Is the reflective behavior of reasoning models created from scratch by RL?
It is more accurate to say that RL amplifies behavior already present in the base model. Later analysis found that base models occasionally write reflective sentences even before RL, and RL mainly reinforces such behaviors, which help get the answer right, into default behavior; for the debate over whether RL teaches new abilities or improves sampling efficiency, see 8.8 in the "LLM Training Pipeline" direction.
Follow-up 2: How do prompts and decoding settings differ when using a reasoning model?
Describe the goal and constraints directly rather than prescribing the reasoning steps, and do not use greedy decoding. The DeepSeek-R1 paper found that few-shot prompting degraded its performance and recommended describing the problem and output format directly in a zero-shot setting; reasoning models already break problems into steps on their own, so prescribing "do this first, then that" in the prompt often works worse than stating the goal clearly. For decoding, DeepSeek recommends a temperature of about 0.6, because greedy decoding easily falls into endless repetition during long thinking.
Follow-up 3: Why does a hybrid mode sometimes work worse than training two separate models?
Because the two behaviors constrain each other within the same set of parameters. Reasoning RL makes responses longer and more "verbose", a tendency that can leak into the non-thinking mode; and keeping the non-thinking mode concise may in turn limit how far the thinking mode can be optimized. After discussions with the community, the Qwen team decided to stop using the hybrid thinking mode and to train Instruct and Thinking models separately for better quality. The advantage of a hybrid mode is simpler deployment: only one model has to be maintained.
Common mistakes
- Do not say that a reasoning model is just a prompt with "think step by step" added: Its long chain of thought is trained through RL or reasoning distillation, and its length, behavior and effect differ fundamentally from prompted CoT.
- Do not say that reasoning models are better on all tasks: On simple factual questions or casual chat, extra thinking only adds latency and cost; reasoning models do not necessarily hallucinate less either (see 5.6).
- Do not say that the thinking content an API returns is the model's complete reasoning process: Many APIs return only a summary, and the chain of thought itself is not necessarily faithful (see 4.1).
- Do not say that an effort level is a strict token cap: It is behavioral guidance on how much to think; the real hard cap is the maximum output length.
4.5 What is overthinking, and how can reasoning length be controlled? ★¶
One-sentence answer
Overthinking means a reasoning model generates a large number of tokens even on simple problems: after reaching the correct answer, it keeps verifying it again and again, which barely improves accuracy but adds latency and cost, and sometimes even turns a correct answer into a wrong one; the opposite is underthinking, where on hard problems the model switches approaches frequently and never pursues any one deeply. Methods for controlling reasoning length fall into training-time methods (length penalties, training toward a target length, training on concise correct responses) and inference-time methods (thinking budgets, early stopping, deciding adaptively by difficulty whether to think).
I will address three aspects: what overthinking looks like, why it arises, and how to control reasoning length.
(1) Overthinking shows up as repeated verification after the answer is already correct, and thinking length and accuracy are not monotonically related.
Chen et al. (2024) found that for a question such as "what is 2+3", o1-like models consume 1,953% more tokens than conventional models, and QwQ-32B-Preview even produced 13 solutions; in the vast majority of cases, the first-round solution is already correct, and the later rounds mostly repeat the verification. In contrast, Wang et al. (2025) described underthinking: on hard problems, the model switches frequently between different approaches, only scratching the surface of each; in incorrect responses, the model consumes 225% more tokens than in correct ones, with thought switching 418% more frequent. Gema et al. (2025) went further and constructed tasks in which "thinking longer makes things worse", such as counting problems with distracting information, where the model becomes more easily distracted as its thinking grows longer. Thinking length and accuracy are therefore not monotonically related; the key is to match thinking length to problem difficulty.
(2) Overthinking stems from the lack of length constraints during training.
RLVR rewards only whether the final answer is correct and does not penalize length; and on hard problems, thinking more really does make a correct answer more likely, so the model learns a general strategy of "think more and check more regardless of difficulty", because writing a few extra rounds of verification costs almost nothing on easy problems. In addition, SFT data distilled from reasoning models passes on surface patterns such as frequently writing "wait" and repeated verification to the student model (see 9.6 in the "LLM Training Pipeline" direction); GRPO's original per-length normalization was also found to make incorrect responses grow longer and longer (see Dr. GRPO in 8.4).
(3) Methods for controlling reasoning length fall into training-time and inference-time methods.
- At training time, build length into the reward or the data: add a length penalty in RL, for example rewarding shorter responses among the correct ones (Kimi Team 2025); give a target length in the prompt and reward the model for both answering correctly and respecting that length, so that it learns to think within a budget (L1, Aggarwal & Welleck 2025); or use the most concise correct responses for SFT or preference optimization (Chen et al. 2024).
- At inference time, directly limit or cut off the thinking: set a thinking budget and forcibly end the thinking when the cap is reached (budget forcing from 4.3); stop early once the answer has stabilized during thinking; or first judge the difficulty of the problem, answering easy problems directly and thinking deeply only on hard ones, which is the adaptive thinking and effort levels of 4.4.
Note that an overly strong length penalty makes the model think too little on hard problems, and accuracy drops abruptly; length penalties are therefore usually added only later in training, or applied only to the part of correct responses that exceeds the necessary length.
In summary: the goal of controlling reasoning length is not "the shorter the better" but matching thinking length to problem difficulty: think less on easy problems, and think longer and deeper on hard ones.
Common length-control methods:
| Method | Stage | Approach | Main cost |
|---|---|---|---|
| Length penalty | Training (RL) | Penalize overly long correct responses in the reward | Too strong a penalty makes accuracy on hard problems drop abruptly |
| Training toward a target length (L1) | Training (RL) | Give a target length in the prompt; reward correct answers that respect it | Requires additional RL training |
| Fine-tuning on concise samples | Training (SFT or preference optimization) | Use the shortest correct responses as training targets | May weaken exploration on hard problems |
| Thinking budget or budget forcing | Inference | Forcibly end the thinking at the cap | An abrupt cutoff may interrupt reasoning in progress |
| Early stopping | Inference | Stop thinking once the answer stabilizes | Needs a signal for "stabilized" |
| Adaptive thinking | Training and inference | Decide by difficulty whether and how long to think | Thinks too little when the difficulty estimate is wrong |
Going deeper: L1's reward design and decoding-time mitigation of underthinking
(1) L1's reward combines correctness with the length requirement.
L1 (Aggarwal & Welleck 2025) states a target length \(n_{\text{gold}}\) in the prompt (for example, "Think for 512 tokens") and runs RL with the following reward:
Here \(n_y\) is the number of tokens actually used by response \(y\), and \(\alpha\) controls the strength of the penalty for deviating from the target length. A model trained this way can plan its thinking within a given budget instead of being cut off bluntly; the paper reports that at the same token budget it outperforms s1's budget forcing.
(2) Underthinking can be mitigated at decoding time.
Wang et al. (2025) proposed the thought switching penalty (TIP): within a certain number of positions after a line of thought begins, it lowers the probability of thought-switching words such as "alternatively", forcing the model to pursue the current line of thought more deeply. It requires no fine-tuning and only modifies the logits at decoding time.
(3) Several failure modes of "thinking more, doing worse".
The tasks constructed by Gema et al. (2025) include counting with distracting information, regression with spurious features, and deductive reasoning that requires tracking constraints. As thinking grows longer, different model families fail in different ways: some are more easily distracted by irrelevant information, while others overfit to the surface framing of the problem. This reminds us that when evaluating reasoning models, one should report how accuracy changes with thinking length, not just the score under a single setting.
Follow-up questions
Follow-up 1: Why does forcibly cutting off the thinking lose accuracy, while length control learned in training, as in L1, works better?
Because when the thinking is cut off forcibly, the model never planned its thinking for that budget. Budget forcing inserts the end delimiter directly when the cap is reached, which may interrupt a line of reasoning that is not yet finished, leaving the model to answer hastily based on incomplete thinking; a model trained with length conditioning knows its budget and arranges "how much to explore and how much to verify" within it, so it achieves higher accuracy with the same number of tokens.
Follow-up 2: How do we decide how long to think about a problem?
By estimating the problem's difficulty. Common signals include the model's confidence in a preliminary answer, the agreement rate of a few short samples, and a dedicated difficulty classifier or router. A further step is to train the model in RL to decide for itself whether and how long to think, i.e. adaptive thinking; at the product level, effort levels hand this decision to the user or the model.
Follow-up 3: Is overthinking only a cost problem?
No. Repeated checking sometimes turns an originally correct answer into a wrong one (Chen et al. 2024), and on some tasks longer thinking lowers accuracy (Gema et al. 2025); in agent settings, thinking for a long time at every step also slows down the whole task and degrades the interactive experience. Controlling reasoning length is therefore a matter of cost, latency and accuracy at the same time.
Common mistakes
- Do not say that longer thinking always gives higher accuracy: Thinking length and accuracy are not monotonically related; there is overthinking, and there are tasks where more thinking makes things worse.
- Do not say that a stronger length penalty is always better: Too strong a penalty makes the model think too little on hard problems, and accuracy drops abruptly.
- Do not conflate overthinking with underthinking: The former is thinking too much on easy problems; the latter is switching approaches too often and not thinking deeply enough on hard problems.
- Do not say that reasoning length can only be controlled at inference time: Length rewards during training and training for adaptive thinking are often more effective than hard cutoffs at inference time.