Unit 9 of 11 · about 4 hours · measure

Best-of-N, self-consistency, search and test-time compute curves

More attempts can improve reported accuracy with no weight update. Selection quality and compute accounting decide whether that improvement is usable.

You'll be able to

  • Separate oracle coverage, verifier-selected accuracy and answer-vote accuracy.
  • Compare parallel sampling, revision and process-guided search under declared generation and scoring budgets.
  • Produce a no-update sampling curve with explicit extraction, tie and invalid-output rules.

Covers

Best-of-N and self-consistency as selection methodsSearch, verifier-guided inference and test-time compute curves
1

Read

In this order, only the parts listed

0 of 3 done

  1. Self-Consistency: aggregate answers, not tracesSelf-Consistency Improves Chain of Thought Reasoning in Language Models (Wang et al., 2023)

    Section 2, Self-Consistency over Diverse Reasoning Paths; Figure 1 and Table 1

    Use the unweighted answer vote for the study. Do not add probability-weighted voting or reproduce the benchmark suite.

  2. Test-time compute: proposer, verifier and allocationScaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameters (Snell et al., 2024) with Large Language Monkeys (Brown et al., 2024)

    Sections 2, 3.1 and 3.2; Section 5.2, Search Methods Against a PRM; Figure 2

    Read search and revision conceptually. The live study only needs short independent samples. Section 3.2 omits difficulty-estimation cost from its reported accounting; disclose and count any such cost in your own curves.

  3. Reasoning coverage: pass-at-k estimatorDoes Reinforcement Learning Really Incentivize Reasoning Capacity in LLMs Beyond the Base Model? (Yue et al., 2025)

    Section 2.2, Metrics for LLM Reasoning Capacity Boundary; Appendix A.2, Low-Variance pass@k Estimation

2

Focus on

  • Best-of-N ranks candidates with an available scorer. Self-consistency votes over extracted answers. Oracle pass-at-k asks whether any candidate is correct; it does not supply a deployable way to choose that candidate.
  • For independent identically distributed samples, estimate pass-at-k from the total sample count and correct count using the combinatorial estimator in Appendix A.2. Do not apply it to correlated tree nodes or sequential revisions as if they were independent completions.
  • Reuse each frozen candidate pool for random choice, answer voting and verifier selection. Declare tie breaking and whether invalid outputs abstain or fail. Record candidate coverage beside selected correctness.
  • Plot budgets of 1, 2 and 4 short samples on the same held-out prompts. Count all generated tokens, scoring calls, revision context and any difficulty estimation; matching sample counts alone does not match compute.
Common mistakes · 3
  • Voting over full text instead of normalized answers. Different valid traces may support the same answer.
  • Using the held-out correct answer to choose a candidate and calling it best-of-N deployment accuracy. That is oracle coverage.
  • Tuning compute allocation on the evaluation answers. Select the strategy on validation data and freeze it before the final comparison.
3

Try it yourself

Closed-book, before checking anything

On CPU with Python 3.13, enumerate all pairs of indices from 8 candidate outputs, exactly 2 of which are correct. Thirteen of the 28 pairs contain a correct output, giving pass-at-2 of approximately 0.46428571. Check this against 1 - math.comb(6, 2) / math.comb(8, 2). Then give a scorer that ranks both correct outputs below an incorrect output: oracle coverage stays unchanged while top-ranked accuracy can be zero.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.Can adding candidates hurt best-of-N selected accuracy?Answer

    Yes. A flawed scorer can prefer a new incorrect candidate even though oracle coverage cannot decrease for a nested candidate set.

  2. 2.Is the most common answer necessarily correct?Answer

    No. Samples can share the same systematic error. Voting measures agreement, not independent verification.

  3. 3.Why can two four-sample runs have different costs?Answer

    Lengths, scoring models, search expansions and reused context can differ. Report token and scoring budgets as well as sample counts.

You're done when

The enumeration matches the estimator, and your no-update curve reports selected accuracy separately from oracle coverage at each declared budget.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 17 more in the section

Also in this section

  • CS336 Assignment 5 - Alignment and Reasoning RLStanford University · primary

    Do Sections 3 to 5: prompting and grading baselines, baseline_calcs, then the Section 4.2 functions (tokenization, response log probabilities, rollout rewards, group-normalized rewards, loss aggregation, the on-policy GRPO step) until the GRPO and metrics tests pass on CPU. The handout runs OLMo-2 1B with a two-GPU vLLM loop; run a small GRPO on a model and task that fit your GPU instead, with one normalization ablation and one preserved failure.

  • RLHF Book - Policy Gradients, Reasoning and Rejection SamplingNathan Lambert · required

    Read Chapter 6 (policy gradients: REINFORCE, RLOO, PPO, GRPO and loss aggregation), Chapter 7 (reasoning), Chapter 9 (rejection sampling), Chapter 12 (distillation) and Chapter 15 (regularization). Do the Suggested Experiments in Chapters 6 and 9. Derive only the estimator used in your experiment, then use Chapters 14 and 15 to design the reward-hacking tests.

  • DeepSeek-R1 Technical ReportDeepSeek AI · required

    Read v2 Sections 2 and 3 (R1-Zero with rule-based rewards and GRPO, then cold-start SFT, RL and distillation) and the limitations (language mixing, the length jump). Separate evidence in the report from your tiny experiment and list the scale, data and infrastructure differences that block reproduction; read Dr. GRPO alongside it.

  • DeepSeekMath, Section 4 (Group Relative Policy Optimization) (Shao et al., 2024)DeepSeek-AI · required

    Read Section 4: GRPO drops the critic and uses the group mean and standard deviation as the baseline, averages within each sequence, then over the group, and adds a KL term. Section 5 relates RFT, DPO, PPO and GRPO. TRL 1.15.0 defaults differ (loss_type="dapo", beta=0.0).

  • Understanding R1-Zero-Like Training: A Critical Perspective (Liu et al., 2025)Sea AI Lab · support

    Read Sections 1 and 3 and Figure 1: dividing by response length favors long wrong answers, and dividing by the group standard deviation reweights questions by difficulty. Dr. GRPO removes both.

  • DAPO: An Open-Source LLM Reinforcement Learning System at Scale (Yu et al., 2025)ByteDance Seed and Tsinghua · support

    Read Sections 2 and 3: asymmetric clipping, no KL term, token-level loss averaging, dynamic sampling of mixed-outcome groups and overlong reward shaping. It keeps the standard deviation that Dr. GRPO drops; treat the disagreement as open.

  • Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs (Ahmadian et al., 2024)Cohere · support

    Read Sections 2 to 4: REINFORCE with a leave-one-out baseline over k samples, and why PPO's extra machinery may not pay off in their on-policy LLM setting.

  • Let's Verify Step by Step (Lightman et al., 2023)OpenAI · support

    Read Sections 2 and 3: outcome versus process supervision on MATH and the PRM800K labels. Define step boundaries before you train any step-level verifier.

  • STaR: Bootstrapping Reasoning With Reasoning (Zelikman et al., 2022) with Rejection Sampling Fine-Tuning (Yuan et al., 2023)Stanford; Alibaba · support

    Read STaR Section 3 (rationalization with the answer as a hint, then fine-tuning) and Yuan et al. Sections 3.3 and 4.1 (keep only correct sampled paths and refit, https://arxiv.org/abs/2308.01825). Neither is RL; both are the self-training controls an RL claim needs.

  • Build a Reasoning Model (From Scratch), Chapters 4 to 7Sebastian Raschka / Manning · support

    Use Chapter 4 (temperature, top-p and self-consistency, pp. 94-135), Chapter 6 (GRPO on Qwen3-0.6B, pp. 179-224) and Chapter 7 (clipping, KL and metrics, pp. 225-266). Listing 6.13 is the unclipped policy gradient; clipping and KL arrive in Sections 7.4 and 7.5. Its advantage uses torch.std, which is the unbiased estimator.

  • Tulu 3, Section 6 (Reinforcement Learning with Verifiable Rewards)Allen Institute for AI · support

    Read Sections 6.1 to 6.4: RLVR data, recipe findings, infrastructure and results, plus the appendix on IFEval over-optimization. It ships data and configs you can inspect.

  • TRL GRPO TrainerHugging Face · reference

    Read after your scratch loss passes. In TRL 1.15.0 the defaults are loss_type="dapo" (token mean), beta=0.0 (no reference model loaded) and scale_rewards="group"; set loss_type="grpo" and beta above zero to approach the DeepSeekMath objective, and state the choice beside any comparison.

  • RLHF Book Code - Policy Gradients and Rejection SamplingNathan Lambert · support

    Run policy_gradients/train.py with the REINFORCE, RLOO or GRPO config and the rejection-sampling selection controls (top_per_prompt against random_per_prompt). Defaults use Qwen3-1.7B and a 7B scorer, so shrink the model, rollouts and tokens to fit your GPU. Sweep one variable and keep an unstable or hacked run.

  • TensorTonic - RLVR SetTensorTonic · support

    Solve Normalize GRPO Group Advantages (cs336-l16-grpo-group-advantages), Compute a Clipped GRPO Surrogate (cs336-l16-clipped-grpo-surrogate) and Compare Sequence and Token Length Normalization (cs336-l16-grpo-length-normalization-audit). Add rollouts with unequal active lengths, and cross-check against the CS336 tests. Public test cases check the listed edge cases, not gradients or the hidden grader, so keep your own tests beside each solution.

  • Modern LLM Notebook - Reasoning and On-Policy DistillationWalking Labs · support

    Use notebooks-en/part4-frontiers/28-cot-thinking.ipynb and 31-opd.ipynb to compare CoT, inference-time search and on-policy distillation; notebook 28 needs API keys for some cells. Count tokens and verifier calls so selection is not confused with learning.

  • Berkeley CS285 - LLM Reinforcement LearningUC Berkeley · reference

    Read Lecture 14 "LLM RL", PDF pages 13 to 39: Part 2 (language models as policies), Part 3 (baselines, regularization and GRPO, pages 25 to 30) and Part 4 (Bradley-Terry, RLHF and verifier rewards, pages 31 to 39). Use it to repair RL prerequisites; HW4 needs Modal H100 credit and is not required.

  • LLM Post-Training Laboratory - RL and ReasoningRoadmap-Final · support

    Use the rollout, objective, policy-version, reward-hacking and compute-normalized evaluation requirements as the persistent artifact for this and later stages.