Unit 4 of 13 · about 4 hours · explain, measure

Inference-time search, self-consistency and train-time versus test-time compute

More samples or deeper search raise scores without changing weights. A learning claim must survive a matched inference budget.

You'll be able to

  • Run greedy, self-consistency and a small search on fixed prompts and report accuracy per token budget.
  • Explain why a reasoning gain can come from sampling, search or longer outputs rather than a better policy.
  • Design a compute-matched comparison that separates learned behavior from inference-time selection.

Covers

Inference-time search, self-consistency and answer aggregationTrain-time learning versus test-time compute
1

Read

In this order, only the parts listed

0 of 3 done

  1. Inference-time scaling and parallel computeRLHF Book - Reasoning, Synthetic Data, Tools and Evaluation

    RL Training vs Inference-Time Scaling: repeated sampling with answer extraction, value-guided sampling, and the token-growth correlation warning; Common Practices: parallel test-time compute scaling with majority vote over parallel rollouts (page read 2026-10-14)

  2. Self-consistency over sampled reasoning pathsBuild a Reasoning Model (From Scratch) - Chapters 3, 6 and 8

    Chapter 4, Section 4.6, printed pp.127-135: sampling diverse completions with temperature and top-p, then majority vote over extracted answers

  3. Beam search, tree search and answer aggregationHands-on Modern RL - Reasoning, Agentic RL and Safety

    Sections 2 and 3: fixed-width beam expansion with parallel paths, tree-of-thought backtracking, MCTS selection with UCB(n) worked example at parent 100 giving 1.23, 1.25 and 1.96; cost rows from best-of-N with N generations through beam K times depth to tree B^D (page read 2026-10-14)

    Treat the 24-Game GPT-4 percentages as an author-reported illustration, not as your target. Recompute the UCB numbers by hand.

2

Focus on

  • Self-consistency votes over answers, not over traces. Shared wrong prefixes can win the vote.
  • Search reuses prefixes and prunes bad paths early. Best-of-N pays full cost per sample with no reuse.
  • Report tokens, verifier calls and latency beside accuracy. A higher score at 10 times the tokens is a budget effect until proven otherwise.
  • RLVR training often lengthens outputs by default. Separate length growth from policy improvement.
Common mistakes · 3
  • Comparing a searched score against a greedy baseline and calling the gap learned. Match samples and tokens first.
  • Letting the vote see the test labels through prompt tuning. Fix prompts before sampling.
  • Reading parallel breadth as free speedup. It shortens waiting time with more hardware but not total compute.
3

Try it yourself

Closed-book, before checking anything

Closed-book, recompute the three UCB values for parent visits 100 with c = 1.414: child A with Q = 0.8 and N = 50 gives 1.23, child B with 0.7 and 30 gives 1.25, child C with 0.6 and 5 gives 1.96. Then state the cost order: greedy 1 call, best-of-N N calls, beam K times depth for one continuation per beam per step (2K times depth with the chapter's expansions=2), tree B^D.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why does best-of-N waste compute relative to beam search on shared prefixes?Answer

    Best-of-N regenerates each sample from scratch. Beam search expands shared prefixes once and scores continuations.

  2. 2.Child C has the lowest Q but the highest UCB in Reproduce. Why?Answer

    Its visit count 5 is small, so the exploration bonus dominates. UCB picks it to reduce uncertainty.

  3. 3.A distilled model matches the searched teacher. Is that proof the student reasons?Answer

    No. It proves the student imitates selected outputs. Test the student greedy on held-out tasks at a fixed token budget.

  4. 4.What must a train-versus-test compute comparison fix?Answer

    Prompts, samples per prompt, tokens per sample, verifier calls and decoding. Then attribute the remaining gap.

5

Practice

  • Build a Reasoning Model: self-consistency on fixed MATH prompts

    Chapter 4, Sections 4.4 to 4.6, printed pp.103-135: temperature and top-p sampling plus self-consistency vote; compare greedy against majority vote over 5 samples on 10 fixed prompts with tokens counted

    Run on CPU with Qwen3 0.6B and short completions. Report accuracy and total tokens for each method.

You're done when

Your UCB recomputation matches 1.23, 1.25 and 1.96, and your greedy-versus-vote table reports accuracy with tokens on the same 10 prompts.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 10 more in the section
  • RLHF Book - Reasoning, Synthetic Data, Tools and EvaluationNathan Lambert · primary

    Study Chapter 7 (reasoning and inference-time scaling), Chapter 12 (synthetic data and on-policy distillation), Chapter 13 (tool use), Chapter 14 (over-optimization) and Chapter 16 (evaluation). Build a claim map separating RLVR learning, inference-time search, on-policy distillation, tool trajectories, reward overoptimization and independent evaluation.

  • Build a Reasoning Model (From Scratch) - Chapters 3, 6 and 8Sebastian Raschka (Manning) · support

    Use Chapter 3 (a math verifier: boxed-answer extraction, normalization and equivalence checks), Chapter 6 (RLVR with GRPO on a MATH subset) and Chapter 8 (distillation from filtered rollouts) as the smallest verifier-to-distillation path on Qwen3 0.6B.

  • Hands-on Modern RL - Reasoning, Agentic RL and SafetyWalking Labs · support

    Use the build-an-agentic-training-system page (a from-scratch trainer exercise), one reasoning or search control and the reward-hacking evaluation chapter selectively. Skip the pages that need API keys or several GPUs and the frontier surveys. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its code/chapterNN folders do not follow the site chapter numbers.

Also in this section

  • RLHF Book Course - Lectures 5, 7, 11 and 12Nathan Lambert · required

    Use Lecture 5 (the rise of reasoning models), Lecture 7 (synthetic data and modern post-training), Lecture 11 (tool use and the road to agents) and Lecture 12 (frontier model evaluation). Tie every mechanism to a distinct data and compute budget.

  • DeepSeek-R1 Technical ReportDeepSeek AI · required

    Read version 2 of the report (January 2026; the Nature 2025 paper is the peer-reviewed version): the R1-Zero and R1 training pipeline, reward design, observed behaviors and limitations. Reproduce only a reduced verifier-driven question and test whether longer sampling or selection explains the observed gain.

  • Tulu 3: Pushing Frontiers in Open Language Model Post-TrainingLambert et al. (Ai2, 2024) · support

    Read the RLVR section: verifiable rewards for math, instruction following and constraints, and how the RLVR stage sits after SFT and DPO. Compare its recipe with R1-Zero on what is rewarded and what is held out.

  • STaR: Bootstrapping Reasoning With ReasoningZelikman et al. (NeurIPS 2022) · support

    Read the generate, filter by correctness and fine-tune loop and the rationalization step. Use it as the rejection fine-tuning control that an RL method must beat at matched samples.

  • RAGEN: Understanding Self-Evolution in LLM Agents via Multi-Turn Reinforcement LearningWang et al. (2025) · support

    Read the multi-turn trajectory formulation and the training instabilities it reports for agent RL (collapse into repetitive reasoning). Use it to design the diagnostics for a small multi-turn environment.

  • Stanford CS224R 2026 LLM RL Default Project - ExtensionStanford University · required

    Use the specification sections on SFT, IPO, RLOO, evaluation and one extension such as off-policy sampling, test-time inference, exploration, self-play or tool reasoning. Build independent code on a distinct task and respect all course restrictions.

  • Berkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - LLM RL Default Final ProjectUC Berkeley · support

    Read the default project for open-ended instruction following: offline DPO, IPO and AOT, online GRPO, Dr. GRPO and GSPO, and judge-based win rates against a frozen base. Use it as a second extension menu; its compute assumes cloud GPUs and a paid judge model.

  • veRLByteDance · support

    Inspect the hybrid-controller architecture, worker roles, supported algorithms and examples at commit 8718ca3 after single-device losses pass. Trace one rollout from generation through reward and update, record policy lag and run only hardware-compatible examples.

  • LLM Post-Training Laboratory - Final IntegrationRoadmap-Final · required

    Finish the bounded rollout and verification queue, reasoning or tool extension, independent clean and adversarial evaluation, reward-hacking postmortem, policy-lag and throughput records, clean reproduction and one prespecified negative or positive result.

  • Reinforcement Learning CheckpointRoadmap-Final · support

    Take the checkpoint closed-note after the integrated project. Pass the estimator and state reconstruction, unseen failure diagnosis, matched-budget comparison, external evaluation and research-readiness clauses.