RL Post-training and Reasoning

Reasoning post-training combines policy learning, sampling and verification, so an apparent gain has several competing explanations. This stage separates learned capability from search, reward and evaluator effects.

Section 8 of 11 · 11 units · about 45 hours

0/11

By the end you can Run a tiny verifiable-reward study with SFT or direct-preference and no-RL baselines; show external improvement under matched inference compute; attack the reward and verifier; and explain one negative or unstable run from trajectory and policy-version evidence.

Units

Build it

Mini project · about 16 to 22 hours

Versioned reversal RL against sampling and filtered-SFT controls

Extend lmlab in rl/ with a bounded synchronous reversal study from the existing small-decoder SFT initialization. Check objectives before live updates, preserve a weak-verifier ablation, and compare learned policies with frozen sampling and filtered SFT on your machine without paid APIs or a learned process reward model.

  1. 1Freeze reversal splits, character-tokenizer lineage, output grammar, action masks, terminal events and reward placement in rl/, linked to the SFT checkpoint. Check correct, wrong, malformed and truncated fixtures against an independent exact-answer evaluator; retain the task contract, parameter/FLOP budget and stop rules.
  2. 2Before live training, check frozen-rollout REINFORCE, RLOO, GAE boundaries and signed clipping against exact enumeration, autodiff and CS336 Assignment 5 loss cases. Retain detached-baseline, ratio-direction and padding regressions, categorical KL/entropy checks and the full-vocabulary distillation gradient fixture; no critic training is required.
  3. 3Implement explicit group centering, standard-deviation and loss-denominator choices, passing CS336 GRPO and Dr. GRPO component cases. Check unequal lengths, accumulation, all-correct/all-wrong groups and singleton rejection against independent reductions and gradients; retain the objective contract and isolate the planned live normalization change.
  4. 4Build bounded synchronous collection, verification, update and held-out evaluation, passing CS336's on-policy train-step case first. Bind immutable rollouts to prompt, sampler, RNG, actor, old-policy, reference and verifier identities; inject old-score overwrite and lag failures, retain rejection evidence, and regenerate after each update.
  5. 5Run matched normalization and strict-versus-substring reward ablations across seeds from the same initialization. Check planted exploits with independent verdicts; preserve the weak-reward run, parsing/format/correctness components, role-bound KL, entropy, diversity, length and signal-coverage traces, plus every invalid, filtered, timed-out and retried attempt.
  6. 6Refit strict-correct outputs from a versioned starting-policy pool with response-only SFT and a matched random-per-prompt control where feasible. Check retained counts and empty groups against the pool; audit first-error positions against reversal targets and retain a segmentation-sensitive process-score fixture beside outcome verdicts.
  7. 7Compare frozen SFT, RL and filtered-SFT checkpoints through the same eval/ sampling curves: random, answer-vote, verifier selection and oracle coverage. Validate pass-at-k by subset enumeration; retain sample/token-matched views, paired and seed uncertainty, complete training/inference/verifier costs, failed runs and clean reproduction with bounded claims.
What you hand in
  • The rl/ task, immutable rollout collector and update path with frozen-rollout, role, freshness and verifier regressions.
  • Normalization and weak-reward ablations, filtered/random refit controls, first-error audit and teacher-signal fixture linked through registry/.
  • Reproducible sampling curves and resource ledger separating selected accuracy, oracle coverage, policy updates and verifier exploitation.
How to check it
How it's graded

Objective and identity correctness

Pass: Independent enumeration and gradient tests validate masks, baselines, clipping, GAE, normalization, KL and teacher signal before updates; immutable role manifests reject overwritten old scores and stale-policy inputs.

Great: Tests distinguish scalar agreement from gradient agreement, inclusive centering from RLOO, old-policy drift from reference drift, and fixed-prefix distillation from full trajectory differentiation.

Failure and signal diagnosis

Pass: Matched normalization and weak-reward runs retain component verdicts, exploits, role-bound traces and every failed attempt; independent reversal checks validate first-error positions and segmentation-sensitive scoring.

Great: The report distinguishes verifier loopholes, zero outcome signal, mastery, collapse and infrastructure errors without claiming a planted exploit was discovered by training.

Learned versus selected behavior

Pass: Frozen SFT, RL and filtered-SFT curves share an evaluator and matched budgets across seeds; enumeration validates coverage, and clean reproduction rebuilds uncertainty, retention counts, random-refit controls and complete costs.

Great: Negative and empty-pool regimes remain visible; claims separate changed sampling efficiency from new support, faithful reasoning or universal capacity, with residual prompt/token imbalances disclosed.

Resources

  • CS336 Assignment 5 - Alignment and Reasoning RLStanford University

    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

    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

    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

    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

    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

    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

    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.

  • Self-Consistency Improves Chain of Thought Reasoning in Language Models (Wang et al., 2023)Google Research

    Read Sections 2 and 3: sample several reasoning paths and take the majority answer. It is the no-training baseline any RL result must beat at matched samples and tokens.

  • Scaling 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)UC Berkeley and Google DeepMind; Stanford

    Read Snell Sections 2 and 3 (proposer, verifier and compute-optimal allocation), Section 5 (best-of-N and search against a verifier) and Section 6 (revisions), and Large Language Monkeys Sections 2 to 4 (coverage grows with repeated sampling; precision depends on the verifier, https://arxiv.org/abs/2407.21787). Report tokens and verifier calls, not only sample counts.

  • Does Reinforcement Learning Really Incentivize Reasoning Capacity in LLMs Beyond the Base Model? (Yue et al., 2025)Tsinghua University

    Read Sections 2 to 4: compare base and RL models at matched sampling with pass@k. The finding is debated; use its control matrix, not its verdict.

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

    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

    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

    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

    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.

  • RLHF Book Code - Policy Gradients and Rejection SamplingNathan Lambert

    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

    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

    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.

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

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

  • TRL GRPO TrainerHugging Face

    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.

  • Berkeley CS285 - LLM Reinforcement LearningUC Berkeley

    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.