Fine-tuning, RLHF & Alignment·Question 40 of 61Advanced

Why are math and code so RL-friendly? Explain verifiable rewards and the R1-style training recipe.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Because they have verifiable rewards: a program - not a learned model - decides success. Math answers can be checked against ground truth (boxed-answer matching, symbolic equivalence); code can be run against unit tests. This changes the RL problem in three fundamental ways:

  1. No reward model → (almost) no reward hacking: the classic RLHF failure mode is the policy exploiting a learned RM's blind spots. A checker is exact - the residual hacking surface is small and concrete (special-casing visible tests, exploiting weak test coverage, sandbox escape in agentic settings) and can be engineered against with hidden tests and hardened verifiers, rather than being a statistical inevitability.
  2. Infinite cheap labels: every fresh sample gets graded for ~free, so online RL can run for enormous numbers of rollouts without annotation cost - which is exactly the regime where RL beats offline methods.
  3. Sharp, unambiguous signal: binary correctness on hard problems is sparse but clean; there's no annotator noise ceiling.
Full worked answer with diagram

Because they have verifiable rewards: a program - not a learned model - decides success. Math answers can be checked against ground truth (boxed-answer matching, symbolic equivalence); code can be run against unit tests. This changes the RL problem in three fundamental ways:

  1. No reward model → (almost) no reward hacking: the classic RLHF failure mode is the policy exploiting a learned RM's blind spots. A checker is exact - the residual hacking surface is small and concrete (special-casing visible tests, exploiting weak test coverage, sandbox escape in agentic settings) and can be engineered against with hidden tests and hardened verifiers, rather than being a statistical inevitability.
  2. Infinite cheap labels: every fresh sample gets graded for ~free, so online RL can run for enormous numbers of rollouts without annotation cost - which is exactly the regime where RL beats offline methods.
  3. Sharp, unambiguous signal: binary correctness on hard problems is sparse but clean; there's no annotator noise ceiling.

The R1-style recipe (per the DeepSeek-R1 report): R1-Zero applied GRPO with rule-based rewards (answer correctness + output-format compliance) directly to a base model - no SFT - and long chain-of-thought reasoning emerged: response lengths grew as the model learned to spend more test-time compute, with self-checking and backtracking ("aha moment") behaviours appearing without being demonstrated. Because R1-Zero's outputs had readability/language-mixing issues, the full R1 pipeline interleaves stages: a small cold-start SFT on curated long-CoT data → reasoning RL → rejection-sampling the RL model to build a large SFT set (plus general data) → final RL for both reasoning and general preferences. They then showed distillation: SFT-ing small open models on ~800k R1-generated traces transfers much of the reasoning gain without running RL on the small models.

The broader significance: this is the test-time-compute paradigm - RL teaches the model how to use more thinking tokens productively, and verifiable domains are where that optimisation has traction. Extending it beyond math/code means building verifiers for softer domains. The usual answer today is rubric-based rewards scored by an LLM judge, which works but reintroduces a learned grader that the policy can hack.

Worth sketching. the two entry paths side by side show precisely what the cold-start SFT is buying.

flowchart LR
    A["Base model"] -->|"R1-Zero path,<br/>no SFT"| C["Reasoning RL,<br/>rule-based rewards"]
    A --> B["Cold-start SFT on<br/>curated long CoT"]
    B --> C
    C --> Z["Long CoT emerges either way;<br/>readability only via B"]
    C --> D["Rejection sample the RL model<br/>into a large new SFT set"]
    D --> E["Final RL: reasoning plus<br/>general preferences"]
    E --> F["Distil traces into<br/>small open models"]

What a good answer covers

  • Because they have verifiable rewards: a program - not a learned model - decides success
  • Math answers can be checked against ground truth (boxed-answer matching, symbolic equivalence); code can…
  • No reward model → (almost) no reward hacking
  • Infinite cheap labels: every fresh sample gets graded for ~free, so online RL can run for enormous…
  • Sharp, unambiguous signal

Key terms: verifiable rewards · Infinite cheap labels · Sharp, unambiguous signal · The R1-style recipe · distillation

Interviewer follow-ups to expect

  1. How do you stop a code-RL model from gaming the unit tests?

  2. Why did pure-RL R1-Zero produce messy outputs, and what does the cold-start SFT fix?

  3. What's the equivalent of a verifiable reward for, say, legal drafting?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep