Unit 7 of 11 · about 5 hours · implement, measure

Verifiable rewards, false acceptance and reward hacking

A deterministic verifier can be consistently wrong. Optimizing it makes a small parsing loophole into a competing explanation for the entire RL result.

You'll be able to

  • Implement a versioned verifier contract with malformed-output and false-acceptance tests.
  • Construct a deliberate reward exploit and measure proxy reward against an independent evaluator.
  • Preserve the hacked or unstable run and a regression that distinguishes the failure from a genuine task gain.

Covers

Rule-based verifiers, false acceptance and reward loopholesReward hacking, format gaming, length bias and evaluator exploitation
1

Read

In this order, only the parts listed

0 of 3 done

  1. CS336 Spring 2026 Assignment 5: grading contractCS336 Assignment 5 - Alignment and Reasoning RL

    Section 3.3, Grading function; Section 4.2.3, compute_rollout_rewards

  2. RLHF Book Chapter 14: Over-OptimizationRLHF Book - Policy Gradients, Reasoning and Rejection Sampling

    Opening reward-overoptimization distinction and Qualitative Over-Optimization, Managing Proxy Objectives

  3. DeepSeek-R1: rule-based feedbackDeepSeek-R1 Technical Report

    arXiv:2501.12948v2, Section 2.2, Reward Design

    Read the accuracy and format reward split. Rule-based feedback avoids a learned scorer but does not prove immunity to parser errors or test exploitation.

2

Focus on

  • The Language Model Evaluation unit on verifiers and false-acceptance tests supplies the test design. Separate parsing, format compliance and semantic correctness; freeze the training verifier and independent evaluator before optimization.
  • Test empty output, duplicated answer delimiters, extra trailing content, embedded target strings, invalid syntax and overlong responses. State whether ambiguity fails closed rather than silently choosing a favorable answer.
  • For the reversal study, contrast strict whole-answer equality with a deliberately weak substring reward. Keep both verdicts on the same outputs, including correct-answer lists embedded in wrong text.
  • Run the weak-reward ablation under the same starting checkpoint and generation budget. Preserve outputs and policy identities even if exploitation does not emerge naturally; a planted accepted exploit is still a verifier regression, not evidence that training discovered it.
Common mistakes · 3
  • Using the same parser implementation for training reward and independent evaluation. Shared bugs can make the two metrics agree falsely.
  • Treating a verifier timeout as a wrong answer without recording the error. Missing evidence, invalid syntax and semantic failure need distinct outcomes.
  • Repairing the verifier and deleting the old run. Preserve its version and outputs; rescoring is a separate analysis, not the original reward trace.
3

Try it yourself

Closed-book, before checking anything

On CPU, define the toy arithmetic target as the string "4". The deliberately flawed check "4" in response accepts "14", while strict whole-string equality rejects it. Reproduce that disagreement and its string-reversal analogue. Add a correct output, an empty output and an output containing several candidate answers. Keep the flawed verdicts as evidence, then require the strict evaluator to reject the planted false acceptance.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.Can held-out prompts expose a parser bug shared by training and evaluation?Answer

    Not reliably. The same bug may accept the same exploit on unseen prompts. Use an independent evaluator and adversarial outputs.

  2. 2.What would support a claim that RL learned to exploit the verifier?Answer

    Fresh policy outputs increasingly receive flawed reward while failing independent checks, with fixed scoring versions, budgets and a matched starting-policy control. A hand-written exploit alone does not show learned exploitation.

  3. 3.Does passing public code tests prove program correctness?Answer

    No. It establishes behavior only on those cases. Hidden tests and specification-based checks can reveal hardcoded or incomplete solutions.

5

Practice

  • CS336 Assignment 5: compute_rollout_rewards

    test_compute_rollout_rewards compares the returned raw-reward tensor against a snapshot

    This is not a verifier-soundness test and does not validate your metadata. The mini-project adds the strict-versus-substring exploit campaign, component verdicts and preserved weak-reward run. Do not publish assignment solutions.

You're done when

A planted false acceptance is reproduced and rejected by an independent evaluator, and the preserved ablation records whether the policy exploited it, failed to learn or became unstable.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 17 more in the 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.

Also in this section