Chapter 7 · Reasoning and Evaluation¶
7.1 Chain-of-Thought Prompting ★★¶
Chain-of-thought ★★¶
Chain-of-thought (CoT, Wei et al. 2022) is simple: in the few-shot examples, instead of giving the answer directly, write out the step-by-step reasoning first and then the answer. Following the examples' format, the model also writes reasoning steps before reaching a conclusion. This brought large gains on math word problems, symbolic reasoning and commonsense reasoning. The original paper also found the ability to be "emergent": only large enough models (around the 100B-parameter scale at the time) clearly benefited; small models wrote reasoning that read fluently but was often wrong, sometimes even lowering accuracy. (For the debate over whether "emergence" is real, see Chapter 3, Section 3.7.)
Why does writing out the reasoning improve accuracy? There are several complementary explanations:
- More computation. A Transformer spends a fixed amount of computation per generated token (\(L\) layers, one pass each). If the model must output the answer to a multi-step problem directly, all the intermediate steps have to fit into the single forward pass that produces that one token, and if there aren't enough layers it can't be done. Each extra reasoning token adds another full forward pass, and its result is written into the context where later tokens can read it. The context becomes a scratchpad, turning fixed-depth computation into serial computation of variable length. Theoretical work also shows that CoT significantly expands the class of problems a fixed-depth Transformer can solve (Feng et al. 2023; Merrill & Sabharwal 2023).
- Decomposition. A complex problem is broken into a series of simple steps, each a relatively easy conditional prediction, and much closer to the many "step-by-step solution" texts in the training data.
- Interpretability and debuggability. You can see how the model reached its conclusion, and when it's wrong it's easier to find the faulty step. But note that the written CoT doesn't necessarily reflect the model's actual internal computation: Turpin et al. (2023) found that when a biasing hint was added to the prompt, models changed their answers because of the hint, yet gave a different, plausible-sounding rationale in the CoT without ever mentioning it.
Interview questions
- ★★ Why does CoT improve reasoning?
- ★ Does the written CoT always reflect the model's actual reasoning?
Zero-shot CoT ★¶
Kojima et al. (2022) found that no examples are needed at all: simply appending "Let's think step by step" to the question makes the model write out its reasoning, with large accuracy gains. It works in two steps: first the model generates the reasoning, then a second prompt (such as "Therefore, the answer is") extracts the final answer from it. This shows that the reasoning ability was already latent in the model; the prompt merely draws it out.
Few-shot CoT lets you control the format and style of reasoning through examples, at the cost of writing examples by hand and using up context; zero-shot CoT is general and effortless but gives weaker control over format. Today's instruction-tuned models usually write out their reasoning by default on reasoning problems, and reasoning models have internalized it as a trained behavior (see 7.2).
Interview questions
- ★ How do zero-shot and few-shot CoT differ?
Self-consistency ★★¶
Self-consistency (Wang et al. 2022) goes one step beyond CoT: sample \(N\) different reasoning paths for the same question at a fairly high temperature, each yielding a final answer \(a_i\), then take a majority vote and output the most frequent answer \(\hat a\) (\(\mathbb{1}[\cdot]\) is the indicator function, equal to 1 when the condition holds).
Why does it work? The correct answer can usually be reached by many different reasoning paths, which converge on the same answer; wrong paths go wrong in all sorts of ways, so their answers scatter across many different wrong values. The correct answer therefore tends to win the vote. In probabilistic terms, this marginalizes over reasoning paths: what we really care about is "which answer is most likely", not "which reasoning path is most likely". Greedy decoding gives a single path, while voting approximately sums over all paths.
It has four limitations:
- The final answers must be exactly comparable (numbers, options, short answers); open-ended long text can't be voted on directly (an LLM can instead pick the most consistent response, known as universal self-consistency).
- It costs \(N\) times as much.
- If the model is systematically wrong (its most likely answer is itself wrong), voting only reinforces the error.
- The gains saturate as \(N\) grows.
Also, the vote agreement rate (the share of the top answer) is itself a decent confidence estimate: answers with high agreement are usually more reliable (see 7.5).
Interview questions
- ★★ What is self-consistency, why does it work, and what are its limits?
Tree-of-Thoughts ★¶
Tree-of-Thoughts (Yao et al. 2023) treats reasoning as a tree search over intermediate "thoughts": at each step it generates several candidate thoughts, has the model evaluate which look more promising, and expands them with BFS or DFS, backtracking when needed. It suits problems that require exploration and backtracking (such as the Game of 24), but it makes many model calls and is expensive. Unlike self-consistency, it doesn't wait for every path to finish and then vote; it evaluates, prunes and backtracks at intermediate steps. See Agent Chapter 2, Section 2.2.
Interview questions
- ★ How does Tree-of-Thoughts differ from self-consistency?
7.2 Reasoning Models ★★¶
o1-style long CoT ★★¶
| Prompted CoT | Reasoning model (o1, R1) | |
|---|---|---|
| How reasoning is obtained | Prompt: few-shot examples or "think step by step" | RL on verifiable rewards, often after SFT on long CoT |
| Typical length | Hundreds of tokens | Thousands to tens of thousands of tokens |
| Behaviors | Mostly linear, one pass | Explores, self-verifies, backtracks |
| Test-time scaling | Weak: longer chains help little | Accuracy rises with the thinking budget |
| Cost | Low | High latency and token cost; may overthink |
OpenAI's o1 (OpenAI 2024) created the category of "reasoning models". It generates a very long chain of thought before giving its final answer. Compared with the prompted CoT of 7.1, there are several essential differences:
- Length: from a few hundred tokens to thousands or even tens of thousands.
- Behaviors: the chain of thought tries multiple approaches, verifies itself, notices mistakes ("wait, this is wrong") and backtracks, effectively carrying out a search within a single sequence. These behaviors aren't a script written by people; the model learned them.
- Trained, not prompted: it is trained with large-scale reinforcement learning. On tasks with automatically verifiable answers, such as math and code, RL teaches the model which reasoning patterns tend to lead to correct answers.
- A new scaling axis: 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 (the longer it thinks, the more it gets right). This made "test-time compute" a new scaling dimension alongside pretraining scale (see 7.3).
The cost is much higher latency and token usage. Since then, many labs have released reasoning models (o3, Gemini thinking, Claude extended thinking, DeepSeek-R1, Qwen3 and others), and many put thinking and non-thinking modes in one model and let users control the thinking budget.
Interview questions
- ★★ How do o1-style reasoning models differ from ordinary CoT?
DeepSeek-R1: an open recipe ★★¶
o1's training method was never published; DeepSeek-R1 (DeepSeek-AI 2025) published a reproducible recipe. Its training pipeline and algorithmic details such as GRPO are in Post-Training Chapter 4, Section 4.2; here we only look at what it tells us about where reasoning models come from.
R1-Zero applies RL with GRPO directly to the base model (DeepSeek-V3-Base) with no SFT at all. The reward is just two rule-based checks: is the final answer correct (for code, does it pass the test cases), and is the thinking placed inside <think> tags. There are no human-written reasoning demonstrations, no neural reward model and no process supervision. AIME 2024 pass@1 rose from 15.6% to 71.0%. More important are the behaviors that emerged during training: response length grew steadily, as the model learned by itself to think longer on hard problems, and the chain of thought began to show reflection, checking itself and starting over when it found a problem, which the paper calls an "aha moment". In other words, the behaviors in o1-style long CoT don't require anyone to design "how to reason": as long as the base model is strong enough and answers can be verified automatically, RL can amplify them. This is the RLVR (RL with verifiable rewards) paradigm. (Later analysis found that base models already write reflective sentences occasionally before RL, so it's more accurate to say RL amplifies and reinforces existing behaviors rather than creating them from scratch; see Post-Training Chapter 4, Sections 4.2 and 4.10.)
R1-Zero's weakness was poor readability, with Chinese and English often mixed in the chain of thought. R1 therefore added steps before and after: first a cold-start SFT on a few thousand readable long-CoT examples; then reasoning-oriented RL with an extra language-consistency reward; then rejection sampling from the RL model and a fresh SFT together with general data; and finally another round of RL covering general tasks. The idea is that SFT takes care of format and stability, while RL pushes reasoning ability up.
Two more points from the paper are valuable for reasoning research. First, the unsuccessful attempts: with a PRM it is hard to define what counts as "a step", labeling is difficult, and the PRM is easily hacked during RL; with MCTS, the token-level search space is too large to scale the way it does in Go. So, at least for training, simple outcome rewards plus lots of sampling proved more practical than explicit process supervision and tree search (test-time use of PRMs is in 7.3). Second, distillation: fine-tuning small models directly on about 800K examples generated by R1 works better than running large-scale RL on the same small models (for why, see Post-Training Chapter 5, Section 5.6).
Interview questions
- ★★ How was DeepSeek-R1-Zero trained, and what did it show?
- ★ Why did R1 add a cold start and other stages beyond R1-Zero?
- ★ Why didn't DeepSeek-R1's attempts with PRM and MCTS succeed?
7.3 Test-Time Compute Scaling ★★¶
Core idea ★★¶
Traditionally, the main way to make a model more capable was to scale up pretraining (parameters and data). Test-time compute scaling goes in a different direction: keep the model fixed and spend more compute at inference, letting the model "think longer".
Why does more inference compute help? Because a model's chance of getting an answer right in a single sample is often far below its chance of being able to get it right: on many problems, one of several dozen samples will be correct, but the first sample doesn't necessarily take that path. The extra compute is spent closing this gap, in two main ways: in parallel, by sampling several answers and finding a way to pick the right one; or sequentially, by letting the model think longer along one chain, checking and correcting itself.
Snell et al. (2024) studied this systematically, with three main findings. First, at matched total FLOPs, for easy and medium problems, spending compute on inference lets a small model beat a model 14 times larger; for the hardest problems, scaling up pretraining is still more effective. So test-time compute can partly substitute for pretraining scale, but not for basic capability. Second, the best inference strategy depends on problem difficulty, and allocating compute adaptively by difficulty (compute-optimal) is more than 4 times as efficient as uniformly using best-of-N. Third, as discussed below, each of the two ways of spending compute suits different problems.
Interview questions
- ★★ What is test-time compute scaling, and why does spending more inference compute raise accuracy?
- ★ Can test-time compute replace scaling up pretraining?
Parallel scaling ★★¶
Parallel scaling samples \(N\) independent answers to the same question and then aggregates them:
- Majority voting (self-consistency, see 7.1): needs no extra model, but the answers must be comparable.
- Best-of-N: a verifier (usually a reward model) scores each answer \(r(x, y_i)\), and the highest-scoring one is chosen (\(x\) is the question, \(y_i\) the \(i\)-th answer). You can also do weighted voting: add up the scores of all answers that reach the same final answer, and pick the answer with the highest total.
- An ORM or PRM as the verifier: an ORM (outcome reward model) looks only at the final result and gives the whole answer one score; a PRM (process reward model) scores each reasoning step, and a solution's score is the product or minimum of the steps' probabilities of being correct (one wrong step ruins the solution). When scoring candidates for best-of-N, a PRM can pinpoint the step that went wrong and usually picks better than an ORM (Lightman et al. 2023). How PRMs are trained and how step labels are obtained is in Post-Training Chapter 4, Section 4.9; the different forms of verifiers (including generative verifiers that write a verification rationale before scoring) are in Self-Improving Chapter 2, Sections 2.3 and 2.6.
- PRM-guided search: instead of waiting for whole answers and then choosing, do beam search at the step level, keeping only the few partial solutions with the highest PRM scores at each step. Snell et al. (2024) found this beats best-of-N when the budget is small and the problems are hard.
A key phenomenon is the gap between coverage and selection. As \(N\) grows, the fraction of problems where at least one answer is correct (pass@N, i.e. coverage) keeps rising (Brown et al. 2024). With an exact verifier (unit tests for code, formal checking for proofs), repeated sampling is extremely powerful, because the correct answer can always be picked out. Without one, the selection accuracy of majority voting and reward models saturates quickly, far below coverage, and the verifier itself becomes the bottleneck. And the larger \(N\) is, the more likely best-of-N picks answers that exploit the reward model's flaws, i.e. reward over-optimization (Gao et al. 2022; see Post-Training Chapter 2, Section 2.7).
Interview questions
- ★★ How do majority voting, best-of-N and weighted voting differ, and what does each need?
- ★ How does PRM-guided search differ from best-of-N, and when is it better?
- ★ Is a larger \(N\) always better for best-of-N?
Sequential scaling ★★¶
| Parallel (voting, best-of-N, PRM search) | Sequential (longer thinking, revision, budget forcing) | |
|---|---|---|
| How compute is spent | Many independent samples | One chain that builds on itself |
| Latency | Roughly flat, given enough hardware | Grows with length |
| Needs | An aggregator: voting or a verifier | The model's ability to check and revise itself |
| Strength | Diversity; coverage keeps growing with \(N\) | Reuses and corrects earlier reasoning |
| Weakness | Samples don't share insights; verifier bottleneck | Can get stuck on one wrong path; overthinking |
Sequential scaling spends compute along a single chain, where later computation builds on earlier results:
- Longer thinking: reasoning models (7.2) work this way; the longer the chain of thought, the more chances to verify and correct.
- Revision: have the model check its previous answer and improve it, over several rounds. Note, however, that without external feedback, a model's "self-correction" of its own reasoning often doesn't work and can even turn right answers into wrong ones (Huang et al. 2023); it works well when there is reliable external feedback (compiler errors, test results, tool outputs) (details in Self-Improving Chapter 2, Sections 2.2 and 2.6).
- Budget forcing (Muennighoff et al. 2025, s1): control 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 it tries to stop and append "Wait", which often makes the model re-check its earlier reasoning and fix mistakes. With only 1,000 curated reasoning examples (s1K) used to fine-tune Qwen2.5-32B-Instruct, plus budget forcing, the paper obtained a test-time scaling curve in which accuracy rises with thinking length.
Each approach has strengths and weaknesses (see the table). Snell et al. (2024) found that easy problems benefit more from sequential revision, because the first answer is often nearly right and revision polishes it locally; hard problems need a mix of sequential and parallel compute in the right ratio, because the first approach may be wrong altogether and parallel samples are needed to explore entirely different directions. In practice the two are often combined: run several long chains of thought in parallel, then vote.
Interview questions
- ★★ What are the pros and cons of parallel versus sequential test-time scaling, and which problems suit each?
- ★ What is budget forcing?
Overthinking ★¶
Reasoning models brought a new problem: overthinking. Chen et al. (2024) found that o1-like models generate hundreds or thousands of tokens even for trivial questions such as "what is 2+3": they reach the correct answer on the first pass, then verify it again and again with different methods. These extra rounds barely improve accuracy but add latency and cost, and sometimes the repeated checking even turns a correct answer into a wrong one. The opposite is underthinking: on hard problems the model switches approaches too often and never pursues any one deeply (Wang et al. 2025). Thinking length and accuracy are therefore not monotonically related; what matters is spending compute where it's actually needed.
Mitigations include: adding length penalties or efficiency rewards in RL; teaching the model to think adaptively, deciding whether and how long to think based on difficulty (many models expose a thinking-budget control); training on the shortest correct responses; and stopping early once the answer has stabilized.
Interview questions
- ★ What is overthinking, and how can it be mitigated?
7.4 Hallucination ★★¶
Definition and types ★★¶
| Type | Definition | Example |
|---|---|---|
| Factual error | Contradicts world knowledge | Says the Eiffel Tower is in Rome |
| Fabrication | Invents entities that don't exist | Cites a non-existent paper with plausible authors |
| Intrinsic (context-inconsistent) | Contradicts the provided input | A summary gives a different date than the article |
| Extrinsic (unverifiable addition) | Adds content the input can't support | A summary adds a quote nobody said |
| Instruction-inconsistent | Ignores or alters the request | Asked for one sentence, writes a paragraph on another question |
| Logical inconsistency | Reasoning contradicts itself | Derives 12 in the steps, then states 15 as the answer |
Hallucination means the model generates fluent, confident content that is unsupported or wrong. What makes it most dangerous is that wrong content sounds exactly as confident as correct content, so users find it hard to tell apart. There are two common ways to classify it.
The first is intrinsic vs extrinsic (Ji et al. 2022), mainly for tasks with a reference input (summarization, translation, RAG): an intrinsic hallucination directly contradicts the given input, such as a summary stating a different date from the article; an extrinsic hallucination adds content that isn't in the input and can't be verified from it.
The second is factuality vs faithfulness (Huang et al. 2023), better suited to general-purpose LLMs: a factuality hallucination conflicts with real-world facts, such as naming the wrong capital or fabricating a non-existent paper; a faithfulness hallucination departs from the user's instructions or the provided context, such as not answering as asked, ignoring a given document, or reasoning that contradicts its own conclusion.
Interview questions
- ★★ What is hallucination, and what types are there?
Causes ★★¶
- Data. Pretraining data itself contains errors, outdated information and contradictions; long-tail knowledge (facts seen only a few times) is poorly memorized; and the model has a knowledge cutoff, so it doesn't know about anything after it.
- The training objective. Next-token prediction rewards plausible continuations, not true ones. The model learns to produce text with the "shape" of an answer (such as a well-formatted paper citation) even when it lacks the underlying knowledge. Kalai et al. (2025) argue from a statistical angle that for arbitrary facts with no learnable pattern (say, a person's birthday that appears only once in the data), a generative model will inevitably make errors even if the training data is entirely correct.
- Fine-tuning. If SFT data contains knowledge the model doesn't have, it effectively teaches the model to "answer confidently even when you don't know". Gekhman et al. (2024) found that examples introducing new knowledge are learned slowly, and once learned they make the model more prone to hallucination. RLHF may also favor confident, detailed, helpful-sounding answers over "I don't know".
- Evaluation incentives. Most benchmarks score only right or wrong, so answering "I don't know" scores 0, the same as a wrong answer. Guessing is therefore always the optimal strategy, and models get optimized into habitual guessers (Kalai et al. 2025).
- Decoding. Sampling randomness can pick a low-probability wrong token; once wrong content is generated, the model keeps writing in that direction to stay consistent with what came before, and the error snowballs (Zhang et al. 2023).
- Context. In long contexts, relevant information placed in the middle is easily ignored (lost in the middle, Liu et al. 2023; see Chapter 2, Section 2.8); when the context conflicts with the model's parametric knowledge, the model may stubbornly trust its own memory (see RAG Chapter 5, Section 5.3).
Interview questions
- ★★ Why do LLMs hallucinate?
- ★ Why can SFT make hallucination worse?
Detection and mitigation ★★¶
Detection follows two lines. With a reference, the output can be compared against the source or a knowledge base, for example using an NLI model to check whether each sentence is entailed by the source. Without a reference, the usual approach is consistency and uncertainty: facts the model really knows come out essentially the same across samples, while fabricated details change every time. SelfCheckGPT (Manakul et al. 2023) samples several times and checks whether the responses support each other. Semantic entropy (Kuhn et al. 2023; Farquhar et al. 2024) goes further: after sampling several answers, cluster those with the same meaning into classes \(c\) (different wording, same meaning counts as one class), then compute the entropy over these semantic classes with the formula, where \(p(c \mid x)\) is the probability that an answer to question \(x\) falls in class \(c\). High entropy means the model isn't even sure what to say, so it is likely making things up.
Mitigation can be organized by stage:
- Retrieval augmentation: have the model answer from retrieved documents and cite them (see RAG Chapter 1; faithfulness is covered in RAG Chapter 5). It greatly reduces factual hallucination but can't eliminate it, since the model may still ignore or misread what was retrieved.
- Training the model to abstain honestly: build "I don't know" training data from questions the model gets wrong (e.g. R-Tuning), or make confident errors cost more than abstentions in preference optimization and RL.
- Better evaluation: penalize wrong answers more than abstentions, or state an explicit confidence threshold, so guessing is no longer rewarded (Kalai et al. 2025).
- Self-verification at inference: Chain-of-Verification (Dhuliawala et al. 2023) drafts an answer, lists questions that need checking, answers them independently (without seeing the draft, to avoid being biased by it), and revises the answer based on the results.
- Tool use: call search, calculators or code execution to fetch or check facts.
- Decoding settings: use a lower temperature for factual tasks, reducing the chance of randomly picking a low-probability wrong token.
Interview questions
- ★★ How can hallucination be detected and mitigated?
- ★ Can RAG eliminate hallucination completely?
- ★ What is semantic entropy, and why cluster by meaning before computing entropy?
7.5 Calibration ★¶
A model is well-calibrated if its stated confidence matches its actual accuracy: among all answers where it says "80% sure", about 80% are actually correct. The most common measure is ECE (expected calibration error): split the \(n\) predictions into \(M\) bins by confidence, where \(B_m\) is the set of predictions in bin \(m\) and \(\mathrm{acc}(B_m)\) and \(\mathrm{conf}(B_m)\) are that bin's actual accuracy and average confidence; ECE is the sample-weighted average of their differences. Calibration matters because many downstream decisions rely on confidence: detecting hallucination, deciding when to abstain, when to retrieve or hand off to a human, and whether best-of-N and verifier scores can be trusted.
A classic finding is that pretrained models are actually quite well calibrated. Kadavath et al. (2022) found that on multiple-choice questions, large models' token-probability confidence closely tracks their accuracy, and models can judge to some extent whether their own answers are correct (P(True)). But calibration degrades noticeably after RLHF: the GPT-4 technical report showed the post-trained model is much worse calibrated than the pretrained one (OpenAI 2023). The reason is that preference optimization concentrates probability mass on the preferred responses, so output probabilities stop representing real frequencies and become overconfident.
There are several ways to get an LLM's confidence:
- Token probability: use the probability of the answer tokens directly; needs access to logits and only suits short answers.
- Verbalized confidence: have the model say "I'm 70% sure"; simple and general, but often overconfident, with stated numbers bunched between 80% and 100% (Xiong et al. 2023); for RLHF models whose token probabilities are already distorted, though, it is sometimes better calibrated than token probabilities (Tian et al. 2023).
- Sampling consistency: the agreement rate across samples or semantic entropy (see 7.4); needs no internal access but costs more.
- Self-evaluation or trained probes: have the model judge whether its own answer is correct, or train a small classifier on its hidden states.
The classic correction method is temperature scaling (Guo et al. 2017): fit a single temperature \(T\) on held-out data and divide the logits by \(T\) before softmax. It changes only the size of the confidence, not which answer is most probable, so accuracy is unaffected. Calibration-encouraging rewards can also be added during training.
Interview questions
- ★ What is calibration, and how is it measured?
- ★ Why does calibration get worse after RLHF?
- ★ What are the ways to get an LLM's confidence?
7.6 Benchmarks ★★¶
Major benchmark categories ★★¶
| Category | Benchmarks | What they test | Notes |
|---|---|---|---|
| Knowledge | MMLU, MMLU-Pro, GPQA Diamond, SimpleQA | Broad academic knowledge; graduate-level "Google-proof" science; short factual questions | MMLU saturated; SimpleQA reports correct, incorrect and not-attempted separately |
| Math | GSM8K, MATH, AIME, FrontierMath | Grade-school word problems up to competition and research-level math | GSM8K and MATH largely saturated; AIME has new problems every year |
| Code | HumanEval, MBPP, LiveCodeBench, SWE-bench Verified | Writing functions; contest problems; fixing real GitHub issues | Scored by unit tests (pass@k); LiveCodeBench keeps adding recently released problems |
| Reasoning | BBH, ARC-AGI, Humanity's Last Exam | Multi-step and abstract reasoning; frontier expert-level questions | ARC-AGI uses novel visual grid puzzles |
| Instruction following | IFEval | Verifiable constraints (length, format, keywords) | Checked by rules, no judge needed |
| Long context | Needle-in-a-haystack, RULER | Retrieval and reasoning over long inputs | Needle-in-a-haystack alone is too easy |
| Agents | SWE-bench Verified, τ-bench, WebArena, GAIA | Multi-step tool use in environments | See Agent Chapter 7 |
| Open-ended chat | Chatbot Arena, MT-Bench, AlpacaEval 2 | Human or LLM-judge preference | See 7.7 |
Evaluating an LLM means covering several dimensions: knowledge, math, code, reasoning, instruction following, long context, agentic ability, and the quality of open-ended conversation. The table lists the most common benchmarks in each category. A rough pattern: early benchmarks (MMLU, GSM8K, HumanEval) are close to saturated, so comparisons between frontier models rely more and more on harder problems (GPQA, AIME, HLE, FrontierMath), continuously refreshed problems (LiveCodeBench) and real tasks (SWE-bench).
Results are very sensitive to the evaluation setup, which interviews often ask about. For the same model on the same benchmark, the number of few-shot examples, whether CoT is used, which chat template is applied, and how the answer is extracted from the output (how strict the regex is) can each shift the score by several points. Multiple-choice questions can also be scored two ways: base models are often scored by comparing the log-likelihood of each option, while chat models are asked to generate the option letter, and the two give different results. So models must be compared under exactly the same setup, and scores from different papers and technical reports often can't be compared directly.
Interview questions
- ★ Which benchmarks would you use to evaluate a new base model? And a chat model?
- ★ Why can the same model's score differ a lot under different evaluation setups?
Code evaluation and pass@k ★★¶
Code answers are hard to judge by string matching, since the same program can be written in countless ways. HumanEval (Chen et al. 2021) judges correctness with unit tests: generated code that passes all tests counts as correct. pass@k is defined as the probability that at least one of \(k\) programs sampled for a problem passes the tests, averaged over all problems.
The most direct estimate is to sample exactly \(k\) programs per problem and check whether any passes, but this has high variance. Chen et al. (2021) gave an unbiased estimator: sample \(n \ge k\) programs per problem (e.g. \(n = 200\)) and count the number \(c\) that pass. If you pick \(k\) of these \(n\) at random, the probability that none passes is \(\binom{n-c}{k} / \binom{n}{k}\) (the number of ways to choose \(k\) from the \(n-c\) failures, divided by the number of ways to choose \(k\) from all \(n\)); one minus that is the probability that at least one passes. For example, with \(n = 10\), \(c = 2\), \(k = 5\): \(\binom{8}{5} / \binom{10}{5} = 56/252 \approx 0.22\), so pass@5 is about 0.78.
Why not just use \(1 - (1 - c/n)^k\)? Because it plugs the estimated pass rate \(\hat p = c/n\) into a nonlinear function as if it were the true value, which is biased (it systematically underestimates pass@k). For \(k = 1\), the unbiased estimator equals \(c/n\) exactly, i.e. the expected accuracy of a single sample.
pass@k measures coverage: the ceiling the model could reach if a perfect verifier picked the correct sample out of \(k\). It measures something different from majority-vote accuracy (maj@k or cons@k, such as the cons@64 often reported for reasoning models on AIME), which requires the model's most common answer to be correct. The distinction matters in RL discussions: one study found that RLVR training clearly raises pass@1, yet at large \(k\) the trained model's pass@k can fall below the base model's (Yue et al. 2025), suggesting that RL mostly makes existing abilities easier to sample rather than necessarily extending their boundary (see Post-Training Chapter 4, Section 4.10). Agent evaluation also often uses pass^k (the probability that all \(k\) runs succeed) to measure reliability, the mirror image of pass@k (see Agent Chapter 7, Section 7.3).
Interview questions
- ★★ Write the unbiased estimator of pass@k. Why not just use \(1-(1-c/n)^k\)?
- ★ How does pass@k differ from majority-vote accuracy?
7.7 LLM-as-a-Judge and Chatbot Arena ★★¶
LLM-as-a-judge ★★¶
Open-ended responses (writing, dialogue, explanations) can't be scored by exact match or unit tests, and human evaluation is slow and expensive, so strong LLMs came to be used as judges (Zheng et al. 2023). There are three common modes: pointwise scoring (rate a single response 1–10 against a rubric), pairwise comparison (given two responses, decide which is better) and reference-guided judging (provide a reference answer, suitable for math, code and other questions with standard answers). Zheng et al. (2023) found that GPT-4 as a judge agreed with human preferences over 80% of the time, on par with the agreement between human judges.
But LLM judges have several systematic biases (Zheng et al. 2023):
- Position bias: in pairwise comparison, the judge tends to prefer whichever response sits in a particular position (often the first). The fix is to judge both orders and count a verdict only if the two agree, recording a tie otherwise.
- Verbosity (length) bias: the judge prefers longer, more detailed responses even when the content isn't better. Fixes include telling the judge explicitly in the rubric to ignore length, or removing the effect of length statistically, as AlpacaEval 2's length-controlled win rate does with a regression (Dubois et al. 2024).
- Self-preference (self-enhancement) bias: the judge rates responses from itself or its own model family higher, perhaps because their style feels more "familiar" and has lower perplexity to it. Fixes are to use a judge from a different model family, or a panel of several judges.
LLM judges are also swayed by formatting and tone (markdown layout, a confident voice), judge math and code beyond their own ability poorly, and can be misled by prompt injections embedded in the responses. General improvements: give a clear rubric, have the judge write its reasoning before the verdict, provide reference answers, and check the judge against human labels on a small subset to confirm it is reliable.
Interview questions
- ★★ What biases do LLM judges have, and how can they be mitigated?
-
★ What are the pros and cons of pointwise scoring versus pairwise comparison?
Pairwise comparison is closer to how humans judge (comparing two things is easier than giving one an absolute score), discriminates better and gives more stable results; its downsides are position bias and a number of comparisons that grows quadratically with the number of models. Pointwise scoring is cheap and scalable and gives absolute scores, so a new model can be compared just by scoring it; its downsides are an unstable scale (the judge's sense of "a 7" drifts) and low resolution, with many responses bunched on the same score.
Chatbot Arena ★★¶
Chatbot Arena (Chiang et al. 2024, now called LMArena) is a crowdsourced human evaluation platform: a user enters any question, two anonymous models each answer, the user votes for the better one, and only then are the models' identities revealed. Rankings are computed with the Bradley–Terry model: each model has a strength parameter \(\beta\), and the probability that model \(A\) beats \(B\) is given by the formula, depending only on their difference in strength. Each model's \(\beta\) is fit by maximum likelihood (equivalent to logistic regression) over all votes, then converted to an Elo-like score with confidence intervals.
Its strengths: questions come from real users and cover a wide range; new questions keep arriving, so it's hard to contaminate; it reflects genuine human preference; and it scales to many models. But it also has clear limitations:
- Skewed question distribution: user questions lean toward casual chat and short queries, with limited difficulty and expertise.
- Voters favor style: longer answers, more formatting and a more pleasing tone win more often, so the platform later added style control, using regression to remove the effect of length and markdown.
- Correctness is hard to verify: ordinary users can't judge expert answers and may vote for whatever "looks right".
- It can be gamed: Singh et al. (2025) pointed out that some providers privately test many model variants and publish only the best, which creates selection bias; providers also differ in how often they are sampled and how much battle data they get access to, so large labs can tune specifically for Arena preferences.
- Limited resolution at the top: score gaps between top models are small and their confidence intervals overlap.
Interview questions
- ★★ How does Chatbot Arena rank models, and what are its limitations?
7.8 Data Contamination and Benchmark Saturation ★★¶
Data contamination ★★¶
Data contamination means test questions (or questions plus answers) appear in a model's pretraining or fine-tuning data. The resulting score then reflects "memorized the answer" rather than real ability. In web-scale corpora, copies of benchmarks are almost everywhere: GitHub repositories, forum threads and paper appendices can all contain the original problems. Contamination also comes in indirect forms: paraphrased or translated versions of the questions, or synthetic data generated by a model that has seen the test set.
Detection methods fall roughly into three groups:
- Overlap detection on training data: search the training corpus for documents sharing long n-grams with test questions (GPT-3 used 13-grams). This requires access to the training data and can't catch paraphrased versions.
- Detection from model behavior (no training data needed): Min-K% Prob (Shi et al. 2023) takes the average log-probability of the \(K\%\) lowest-probability tokens in a text (\(S_K\) is the set of these tokens). Unseen text always contains some surprising, very-low-probability tokens, while seen text rarely does, so a high score suggests the text was seen. There are also completion tests (give the first half of a question and see whether the model reproduces the second half verbatim) and option-shuffling tests (if accuracy on multiple-choice questions drops clearly when the options are reordered, the model may have memorized the original option positions).
- Comparison on equivalent new data: write brand-new questions of similar difficulty; if the model does clearly worse on them than on the original benchmark, that signals overfitting or contamination. GSM1k (Zhang et al. 2024) wrote new problems in GSM8K's style and found clear accuracy drops for some model families. Time can also be used: evaluate only on problems released after the model's knowledge cutoff; LiveCodeBench (Jain et al. 2024) observed some models doing clearly worse on problems released after their cutoff.
Mitigations include: filtering known benchmarks out of training data before training; placing a canary string in benchmark files (a special random string, as BIG-bench does) so trainers can filter it and contamination can be detected later; keeping private test sets; using continuously refreshed dynamic benchmarks (LiveBench, LiveCodeBench, each year's new AIME); and publishing contamination analyses in technical reports and evaluating on perturbed versions.
Interview questions
- ★★ What is data contamination, and how can it be detected, including without access to the training data?
- ★ How would you design an evaluation that is hard to contaminate?
Why benchmarks saturate ★¶
Benchmark saturation means top models all score near the ceiling and their differences fall within noise, so the benchmark no longer discriminates between them. MMLU, GSM8K and HumanEval all saturated within a few years of release, and the time from release to saturation keeps getting shorter. There are several reasons:
- Capabilities really are improving fast: with larger models and the arrival of reasoning models, many problems genuinely aren't hard anymore.
- Goodhart's law: once a measure becomes a target, it stops being a good measure. Labs optimize for popular benchmarks by training on data of similar style, tuning prompts and selecting checkpoints by benchmark score, so scores rise faster than real general ability.
- Data contamination: the longer a benchmark has been out, the more widely it spreads online and the more likely it leaks into training data.
- Label noise sets the real ceiling: datasets contain wrong or ambiguous questions; for example, Gema et al. (2024) estimated that about 6.5% (6.49%) of MMLU questions contain errors, with more than half of the Virology subset affected. The true ceiling is below 100%, and the last few points mostly measure noise.
- Narrow formats: multiple-choice and short-answer formats are much easier to master than open-ended real tasks.
Responses include: releasing harder benchmarks (MMLU-Pro, GPQA, HLE, FrontierMath); using dynamically refreshed benchmarks; shifting to agentic and real-world tasks (such as SWE-bench); keeping private evaluations; and relying on human evaluation again for high-stakes decisions.
Interview questions
- ★ Why do benchmarks saturate, and what can be done afterwards?