AI Post-Training
Domain: the rung after supervised fine-tuning — turning a pretrained or SFT'd base
model into an aligned, preference-tuned, or reasoning-capable model with a reward signal.
This skill owns the post-training decision and pipeline: when to post-train at all, which
reward signal you can produce, which algorithm family fits, and how to keep it from
over-optimizing. Per-algorithm operational depth lives in
ai-llm/references/post-training.md (PPO, DPO, SimPO,
KTO, GRPO, GSPO, DAPO, RLVR, RULER, ORPO — catalogue + decision tree); this skill routes there.
It does not cover: pretraining (ai-pretraining),
the prompt→RAG→SFT promotion ladder (ai-architecture-advisor),
or serving the result (ai-llm-inference).
Quick Reference
| You have / want |
Method |
Deep ref |
| Labeled demonstrations of the target behavior |
SFT (baseline — exhaust it first; not RL) |
ai-llm |
| Pairwise preferences, want the least machinery |
DPO (or DAAs: KTO / ORPO / SimPO) |
methods |
| A stronger teacher model, a small student |
On-policy distillation — try before GRPO |
methods |
| Preferences + reward model + online RL |
GRPO / RLOO (critic-free, 2026 default); PPO is the reference algorithm, now trl.experimental |
methods |
| Many samples scorable per prompt, drop the critic |
GRPO (group-relative advantage) |
methods |
| A real task with no mechanical checker |
Rubrics as rewards (the fourth reward source) |
methods |
| A multi-turn agent acting in an environment |
Agentic RL (trajectory reward, rollout infra) |
methods |
| A verifiable checker (math/code/tests) as the reward |
RLVR (via GRPO or a GRPO-family variant — GSPO/DAPO/RLOO) — the dominant 2026 reasoning recipe |
methods |
| Scale preference labels cheaply |
RLAIF / Constitutional AI (model-as-judge) |
data |
| A quick lift with no RL loop |
Rejection sampling (best-of-N → SFT) |
methods |
| Train/choose the reward model itself |
Bradley-Terry RM, ORM vs PRM, generative RM |
reward |
| Stop reward hacking / over-refusal |
KL regularization, eval harness, over-optimization controls |
over-optimization |
| Interpret a live GRPO run's metrics |
Advantage mean/std, entropy, reward exhaustion, degenerate groups |
diagnostics |
| Build a robust RLVR checker (not just "use a verifier") |
Extract → normalize → SymPy equivalence → element-wise grading |
reward |
| Compose fine-tuned checkpoints / strip an unwanted attribute |
Model merging (averaging, weighted, interpolation, adapter merging) |
reward |
When to Use This Skill
Activate when the user asks (in any language) some form of:
- "How do I run RLHF / align a model / train with human feedback?"
- "DPO vs PPO vs GRPO — which preference/RL method?"
- "How do I train a reasoning model / RLVR / GRPO like DeepSeek-R1?"
- "How do I build/choose a reward model? ORM or PRM?"
- "Should I use Constitutional AI / RLAIF instead of human labels?"
- "My fine-tune still has a preference/safety/refusal gap after SFT — now what?"
- "How do I collect preference data / what about synthetic preference data?"
- "My RL model is reward-hacking / over-refusing — how do I fix over-optimization?"
If the gap is missing knowledge (→ RAG), missing format/behavior demonstrable with labels
(→ SFT), or reasoning closeable by more thinking on a hosted model (→ raise the thinking
budget), you usually do not need this skill. Confirm with
ai-architecture-advisor first if unsure.
Scope Boundaries (Use These Skills for Depth)
- Per-algorithm catalogue + decision tree (PPO/DPO/GRPO/RLVR/RULER/...) ->
ai-llm/references/post-training.md
- TRL / SFT / DPO / GRPO implementation in code ->
huggingface-skills: plugin (TRL)
- Distributed RL training scale (FSDP, vLLM rollout, async RL) ->
ai-distributed-training
- Eval methodology, judge calibration, thresholds -> ai-evals
- The prompt→RAG→SFT→post-train promotion decision ->
ai-architecture-advisor
- Reasoning-model build walkthrough -> Raschka, Build a Reasoning Model (see sources)
Workflow
- Confirm post-training is the right rung. Is the gap knowledge (→ RAG), format/behavior
demonstrable with labels (→ SFT), or reasoning closeable on a hosted model (→ raise the
thinking budget)? If yes to any, stop — you don't need post-training. → verify: name the gap type.
- Exhaust SFT. Establish the SFT baseline; only proceed if a measurable preference/safety/
reasoning gap remains. → verify: SFT eval shows the residual gap.
- Identify the reward signal you can actually produce — human pairs, AI feedback, a written
rubric, or a verifiable checker. This, not a benchmark, picks the algorithm. → verify: signal is real and labelable.
- Pick the method (see Choosing the Method): on-policy distillation if a stronger teacher
exists; otherwise offline DPO/DAAs first, promote to GRPO/RLOO online on evidence, RLVR when
the reward is verifiable. → verify: simplest method that fits the signal.
- Build/choose the reward model or checker (see Reward Modeling). → verify: RM accuracy or checker coverage.
- Train with an eval harness from step 1, and KL scoped to the reward source (KL when the
reward is learned; β=0 with a verifiable checker). → verify: held-out true-objective metric, not reward curve.
- Hand off per-algorithm depth to ai-llm/references/post-training.md
and scale to ai-distributed-training.
The Post-Training Pipeline
Post-training is a sequence, not a single algorithm. Each stage is reached only when the
previous one is exhausted and a measurable gap remains.
pretrained base
|
v
1. SFT (instruction tuning) teach the format/behavior from demonstrations
| gap remains: preferences, safety, style the labels can't express
v
2. preference optimization DPO / DAAs (offline) OR reward model + GRPO/RLOO (online)
| gap remains: multi-step reasoning, verifiable correctness
v
3. reasoning RL (RLVR) verifiable rewards (math/code/tests), usually via GRPO
|
v
aligned / reasoning model + continuous eval against over-optimization
Two orthogonal choices run through stages 2–3:
- Online vs offline. Offline (DPO/DAAs) trains on a fixed preference dataset — simple,
stable, no sampling loop or reward model. Online (GRPO/RLOO, or historically PPO) samples from the current policy
and scores it live — higher ceiling, more compute and moving parts. Start offline; go online
when offline plateaus or you need a reward model's generalization.
- Reward source. Human preferences → reward model; AI preferences → RLAIF/Constitutional
AI; a written multi-criteria rubric → rubrics-as-rewards; verifiable checker (compiler, unit
tests, math solver) → RLVR. The reward source you can actually produce determines the
algorithm more than any benchmark does — and it also determines whether KL is your trust
region (learned reward) or clipping is (verifiable checker).
- Reference-based vs reference-free. Within the DAA family, DPO/KTO keep a frozen reference
model (memory cost, implicit drift bound); ORPO/SimPO drop it (cheaper, no drift bound — pair
with a capability regression suite).
Choosing the Method
Pick by the reward signal you can produce, then by compute budget. Full per-algorithm
detail and a decision tree are in
ai-llm/references/post-training.md; the front-door
logic:
- Can you write demonstrations? → SFT first. Do not reach for RL to teach something a
few hundred labeled examples would teach.
- Do you have pairwise preferences and want simplicity? → DPO (then KTO/ORPO/SimPO
if its numerics misbehave or you only have binary good/bad signals).
- Does a stronger teacher model already exist, with a small student? → on-policy
distillation before any RL loop: the teacher scores the student's own rollouts
token-by-token (on-policy, dense). Reported to outperform SFT and GRPO in that setting and to
restore generalization SFT loses.
- Can you afford a reward model + online RL for a higher ceiling? → a critic-free
group-baseline method (GRPO/RLOO) is the 2026 default; it drops the value model and its
optimizer state. PPO remains the reference algorithm (InstructGPT lineage) but ships under
trl.experimental — a learned reward model does not imply PPO.
- Is the reward verifiable (math/code/tests)? → RLVR, usually via GRPO or a GRPO-family
variant (DAPO/GSPO/RLOO) — the dominant 2026 reasoning recipe, now a portfolio rather than one
fixed algorithm; no human labels needed.
- Is the task real work with no mechanical checker? → rubrics as rewards: a structured
multi-criteria rubric grades the response. Legible and auditable, but a model-mediated proxy —
so the KL and over-optimization controls apply as they do for a reward model.
- Are human labels the bottleneck? → RLAIF / Constitutional AI to generate the
preference/critique signal from a model + a written constitution.
- Want a quick gain without an RL loop? → Rejection sampling: best-of-N generate →
score → SFT on the winners.
Reward Modeling (the load-bearing component)
In reward-model-based RLHF, model quality is capped by reward-model quality. Key choices:
- Bradley-Terry RM — the standard: an LM with a scalar value head trained on preference
pairs to predict which response a human prefers. Quality depends on preference-data balance
and avoiding spurious length/format correlations.
- ORM vs PRM — Outcome Reward Models score the final answer; Process Reward Models
score each reasoning step. PRMs help on multi-step reasoning but need step-level labels and
are costlier to build. PRMs themselves split into discriminative (a scalar per step — the
2023 form, brittle on step segmentation and documented as hackable) and generative (the
verifier reasons, then judges — the 2026 default where PRMs are used at all).
- Generative reward modeling / LLM-as-a-judge — use a model to emit a critique or score
instead of a scalar head; flexible, but inherits the judge's biases (calibrate via
ai-evals).
- For RLVR you skip the reward model — a deterministic checker is the reward. That is why
RLVR is cheaper and harder to over-optimize than reward-model RL where the checker exists.
The checker is a much tighter proxy, not the true objective: incomplete tests are still
hackable.
- Rubrics as rewards — when the task is real work with no mechanical checker, a structured
multi-criteria rubric can be the reward instead of forcing a fake verifier or falling back to
opaque pairwise preferences. Still a model-mediated proxy; treat it like a reward model for
over-optimization purposes.
Depth: references/reward-and-data.md.
Over-Optimization Is the Default Failure Mode
Preference RL optimizes a proxy for what you want, so it Goodharts silently — the model
games the reward while the true objective degrades. Controls:
- KL regularization — scoped by reward source. With a learned reward (RM+PPO, rubric
grader, DPO's implicit β) KL to the reference policy is the primary trust region and the main
knob against reward hacking: tune it, don't omit it. Under a verifiable checker (RLVR),
beta=0 is the 2026 standard — TRL's GRPOConfig ships beta=0.0, DAPO drops the KL term,
GSPO sets it to zero — and the trust region is carried by PPO-style clipping instead. Reach
for a nonzero β there only on evidence of drift or capability regression.
- Eval harness, always — "completed" is wrong if anything was skipped; measure the true
objective (held-out human eval / verifiable tests), not just rising reward. Watch for
over-refusal (the model refuses safe requests) and length/sycophancy inflation.
- On-policy data + pretraining-gradient mixing — mitigate forgetting and distribution
collapse.
Depth: references/over-optimization-and-eval.md.
Known Traps
- reaching for PPO/GRPO when DPO would do — paying for a reward model + RL loop you don't need
- post-training at all when the gap is missing knowledge (RAG) or format (SFT), not preference/reasoning
- treating RLHF as one algorithm — it's a pipeline (SFT → preference → reasoning RL) with online/offline and reward-source choices inside it
- training a reward model on imbalanced/length-correlated preferences, then optimizing its spurious signal
- running preference RL without an eval harness — reward goes up, true quality goes down, silently (Goodhart)
- omitting the KL penalty in reward-model RL and watching the policy drift off its trusted SFT behavior (reward hacking, over-refusal) — but carrying a nonzero KL into RLVR by reflex, where β=0 is standard and KL mostly caps the reasoning gain
- carrying a
beta value across method families — DPO's β (~0.1, an implicit-reward temperature) and a GRPO KL coefficient (0.0–0.001) are different objects two orders of magnitude apart
- reaching for GRPO when a stronger teacher already exists — on-policy distillation is the cheaper and often better move for a small student
- picking among DPO/KTO/ORPO/SimPO from a list of adjectives instead of the reference-based vs reference-free tradeoff (a frozen model in memory and an implicit drift bound, or neither)
- assuming a single-turn RLVR recipe transfers to a multi-turn agent — trajectory-level reward, cross-turn credit assignment, and rollout infrastructure are all new problems
- using RLVR where the reward is not actually verifiable (no deterministic checker) — then it's just reward-model RL with a brittle checker
- confusing ORM and PRM — process rewards need step-level labels you may not have
- running vanilla GRPO on a large MoE and fighting non-convergence — token-level ratios break under expert-routing volatility; use GSPO (sequence-level)
- ignoring GRPO's length/std biases that inflate response length and miscalibrate difficulty — use Dr. GRPO / DAPO fixes (see methods reference)
- assuming a reasoning gap needs RLVR when, on a hosted model, raising the thinking budget would close it without any training
Common Anti-Patterns
- jumping to RL before SFT is exhausted
- choosing the algorithm from a benchmark instead of from the reward signal you can produce
- treating reward-model quality as an afterthought when it caps the whole result
- measuring success by reward curve instead of the true held-out objective
- this skill re-teaching the per-algorithm math instead of routing to the ai-llm catalogue
Core Principles
- SFT first, RL last. Exhaust demonstrations before any reward-based method.
- The reward signal picks the algorithm. Four sources: human pairs → DPO/RM+GRPO; AI
preferences → RLAIF; a rubric → rubrics-as-rewards; a verifiable checker → RLVR.
- Offline before online. Start with DPO's simplicity; promote to GRPO/RLOO on evidence.
- Reward quality caps model quality. Invest in the reward model, rubric, or checker accordingly.
- Assume over-optimization. Always eval the true objective, or it Goodharts. Add KL to the
reference when the reward is learned; under a verifiable checker the trust region is
clipping and β=0 is standard.
Navigation: Core References
- methods-and-pipeline.md — the SFT→preference→RL
pipeline, online vs offline, reference-based vs reference-free, and how each method
(DPO/PPO/GRPO/RLVR/rejection sampling/on-policy distillation) maps to a reward signal; also
agentic/multi-turn RL, rubrics-as-rewards, and the per-method
beta anchor table; routes to
the ai-llm algorithm catalogue for per-algorithm depth
- reward-and-data.md — reward modeling (Bradley-Terry,
ORM/PRM, generative RM), preference-data collection, synthetic data, RLAIF/Constitutional AI
- over-optimization-and-eval.md — reward
hacking/Goodhart, KL regularization, over-refusal, and evaluating the true objective
- grpo-run-diagnostics.md — reading a live GRPO/RLVR
run: advantage mean (sanity check) vs std (learning signal), degenerate zero-gradient groups,
reward exhaustion at 1.00, entropy trajectories, and a triage table
External Sources
See data/sources.json for primary references: Lambert's RLHF book
(the anchor), InstructGPT, DPO, DeepSeek-R1 (GRPO/RLVR), Tülu 3, GKD and Thinking Machines'
on-policy distillation, Rubrics as Rewards, the multi-turn agentic RL practitioner's guide,
the PRM survey, Raschka's Build a Reasoning Model (verifier engineering + GRPO run telemetry),
and Pai's Designing Large Language Model Applications (model merging/fusion taxonomy).
Fact-Checking
- Algorithm names, framework support, and which labs use which recipe are volatile; verify
against current primary sources before recommending a specific one. TRL specifically turns
over fast — its
loss_type roster, trainer namespaces (first-class vs trl.experimental),
and defaults all changed between 2026-07 and 2026-08.
- The framework landscape is wider than TRL: verl (the common backbone for large-scale and
agentic RL, async rollout), OpenRLHF (multi-turn/VLM RL), and others (NeMo RL, AReaL,
ROLL, slime). Choose beyond TRL when scale, asynchronous rollout, or multi-turn environments
are the constraint; delegate depth to
ai-distributed-training. Health and feature claims for
any of these must be re-checked — they were not verified past 2026-08.
- Model-specific recipe claims (e.g. "DeepSeek-R1 used X") must be checked against the model's
own technical report, not secondary summaries.
- If you cannot verify, present guidance as a dated assumption, not a fact.
Learnings Loop
Before applying this skill on a non-trivial task, read learnings.consolidated.md in this directory (and learnings.md if present).
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.
1---
2name: ai-post-training
3description: "Post-training and alignment: reward modeling, RLHF/PPO, DPO/DAAs, GRPO, RLVR, RLAIF, over-optimization. Use when adapting an SFT model with preference or verifiable-reward signals."
4compatibility: Portable core. Works on Claude Code and Codex.
5version: "1.3"
6last_validated: 2026-08-31
7---
8
9# AI Post-Training
10
11**Domain**: the rung *after* supervised fine-tuning — turning a pretrained or SFT'd base
12model into an aligned, preference-tuned, or reasoning-capable model with a **reward signal**.
13This skill owns the post-training *decision and pipeline*: when to post-train at all, which
14reward signal you can produce, which algorithm family fits, and how to keep it from
15over-optimizing. Per-algorithm operational depth lives in
16[ai-llm/references/post-training.md](../ai-llm/references/post-training.md) (PPO, DPO, SimPO,
17KTO, GRPO, GSPO, DAPO, RLVR, RULER, ORPO — catalogue + decision tree); this skill routes there.
18
19It does **not** cover: pretraining ([ai-pretraining](../ai-pretraining/SKILL.md)),
20the prompt→RAG→SFT promotion ladder ([ai-architecture-advisor](../ai-architecture-advisor/SKILL.md)),
21or serving the result ([ai-llm-inference](../ai-llm-inference/SKILL.md)).
22
23## Quick Reference
24
25| You have / want | Method | Deep ref |
26|---|---|---|
27| Labeled demonstrations of the target behavior | **SFT** (baseline — exhaust it first; not RL) | [ai-llm](../ai-llm/SKILL.md) |
28| Pairwise preferences, want the least machinery | **DPO** (or DAAs: KTO / ORPO / SimPO) | [methods](references/methods-and-pipeline.md) |
29| A stronger teacher model, a small student | **On-policy distillation** — try before GRPO | [methods](references/methods-and-pipeline.md) |
30| Preferences + reward model + online RL | **GRPO / RLOO** (critic-free, 2026 default); **PPO** is the reference algorithm, now `trl.experimental` | [methods](references/methods-and-pipeline.md) |
31| Many samples scorable per prompt, drop the critic | **GRPO** (group-relative advantage) | [methods](references/methods-and-pipeline.md) |
32| A real task with **no** mechanical checker | **Rubrics as rewards** (the fourth reward source) | [methods](references/methods-and-pipeline.md) |
33| A multi-turn agent acting in an environment | **Agentic RL** (trajectory reward, rollout infra) | [methods](references/methods-and-pipeline.md) |
34| A verifiable checker (math/code/tests) as the reward | **RLVR** (via GRPO or a GRPO-family variant — GSPO/DAPO/RLOO) — the dominant 2026 reasoning recipe | [methods](references/methods-and-pipeline.md) |
35| Scale preference labels cheaply | **RLAIF / Constitutional AI** (model-as-judge) | [data](references/reward-and-data.md) |
36| A quick lift with no RL loop | **Rejection sampling** (best-of-N → SFT) | [methods](references/methods-and-pipeline.md) |
37| Train/choose the reward model itself | **Bradley-Terry RM**, ORM vs PRM, generative RM | [reward](references/reward-and-data.md) |
38| Stop reward hacking / over-refusal | KL regularization, eval harness, over-optimization controls | [over-optimization](references/over-optimization-and-eval.md) |
39| Interpret a **live** GRPO run's metrics | Advantage mean/std, entropy, reward exhaustion, degenerate groups | [diagnostics](references/grpo-run-diagnostics.md) |
40| Build a robust RLVR checker (not just "use a verifier") | Extract → normalize → SymPy equivalence → element-wise grading | [reward](references/reward-and-data.md) |
41| Compose fine-tuned checkpoints / strip an unwanted attribute | **Model merging** (averaging, weighted, interpolation, adapter merging) | [reward](references/reward-and-data.md) |
42
43## When to Use This Skill
44
45Activate when the user asks (in any language) some form of:
46
47- "How do I run RLHF / align a model / train with human feedback?"
48- "DPO vs PPO vs GRPO — which preference/RL method?"
49- "How do I train a reasoning model / RLVR / GRPO like DeepSeek-R1?"
50- "How do I build/choose a reward model? ORM or PRM?"
51- "Should I use Constitutional AI / RLAIF instead of human labels?"
52- "My fine-tune still has a preference/safety/refusal gap after SFT — now what?"
53- "How do I collect preference data / what about synthetic preference data?"
54- "My RL model is reward-hacking / over-refusing — how do I fix over-optimization?"
55
56If the gap is missing *knowledge* (→ RAG), missing *format/behavior demonstrable with labels*
57(→ SFT), or *reasoning closeable by more thinking on a hosted model* (→ raise the thinking
58budget), you usually do **not** need this skill. Confirm with
59[ai-architecture-advisor](../ai-architecture-advisor/SKILL.md) first if unsure.
60
61## Scope Boundaries (Use These Skills for Depth)
62
63- **Per-algorithm catalogue + decision tree (PPO/DPO/GRPO/RLVR/RULER/...)** ->
64 [ai-llm/references/post-training.md](../ai-llm/references/post-training.md)
65- **TRL / SFT / DPO / GRPO implementation in code** -> `huggingface-skills:` plugin (TRL)
66- **Distributed RL training scale (FSDP, vLLM rollout, async RL)** ->
67 [ai-distributed-training](../ai-distributed-training/SKILL.md)
68- **Eval methodology, judge calibration, thresholds** -> [ai-evals](../ai-evals/SKILL.md)
69- **The prompt→RAG→SFT→post-train promotion decision** ->
70 [ai-architecture-advisor](../ai-architecture-advisor/SKILL.md)
71- **Reasoning-model build walkthrough** -> Raschka, *Build a Reasoning Model* (see sources)
72
73## Workflow
74
751. **Confirm post-training is the right rung.** Is the gap *knowledge* (→ RAG), *format/behavior
76 demonstrable with labels* (→ SFT), or *reasoning closeable on a hosted model* (→ raise the
77 thinking budget)? If yes to any, stop — you don't need post-training. → verify: name the gap type.
782. **Exhaust SFT.** Establish the SFT baseline; only proceed if a measurable preference/safety/
79 reasoning gap remains. → verify: SFT eval shows the residual gap.
803. **Identify the reward signal you can actually produce** — human pairs, AI feedback, a written
81 rubric, or a verifiable checker. This, not a benchmark, picks the algorithm. → verify: signal is real and labelable.
824. **Pick the method** (see *Choosing the Method*): on-policy distillation if a stronger teacher
83 exists; otherwise offline DPO/DAAs first, promote to GRPO/RLOO online on evidence, RLVR when
84 the reward is verifiable. → verify: simplest method that fits the signal.
855. **Build/choose the reward model or checker** (see *Reward Modeling*). → verify: RM accuracy or checker coverage.
866. **Train with an eval harness from step 1, and KL scoped to the reward source** (KL when the
87 reward is learned; β=0 with a verifiable checker). → verify: held-out true-objective metric, not reward curve.
887. **Hand off** per-algorithm depth to [ai-llm/references/post-training.md](../ai-llm/references/post-training.md)
89 and scale to [ai-distributed-training](../ai-distributed-training/SKILL.md).
90
91## The Post-Training Pipeline
92
93Post-training is a sequence, not a single algorithm. Each stage is reached only when the
94previous one is exhausted and a measurable gap remains.
95
96```text
97pretrained base
98 |
99 v
1001. SFT (instruction tuning) teach the format/behavior from demonstrations
101 | gap remains: preferences, safety, style the labels can't express
102 v
1032. preference optimization DPO / DAAs (offline) OR reward model + GRPO/RLOO (online)
104 | gap remains: multi-step reasoning, verifiable correctness
105 v
1063. reasoning RL (RLVR) verifiable rewards (math/code/tests), usually via GRPO
107 |
108 v
109aligned / reasoning model + continuous eval against over-optimization
110```
111
112Two orthogonal choices run through stages 2–3:
113
114- **Online vs offline.** Offline (DPO/DAAs) trains on a fixed preference dataset — simple,
115 stable, no sampling loop or reward model. Online (GRPO/RLOO, or historically PPO) samples from the current policy
116 and scores it live — higher ceiling, more compute and moving parts. Start offline; go online
117 when offline plateaus or you need a reward model's generalization.
118- **Reward source.** Human preferences → reward model; AI preferences → RLAIF/Constitutional
119 AI; a written multi-criteria rubric → rubrics-as-rewards; verifiable checker (compiler, unit
120 tests, math solver) → RLVR. The reward source you can actually produce determines the
121 algorithm more than any benchmark does — and it also determines whether KL is your trust
122 region (learned reward) or clipping is (verifiable checker).
123- **Reference-based vs reference-free.** Within the DAA family, DPO/KTO keep a frozen reference
124 model (memory cost, implicit drift bound); ORPO/SimPO drop it (cheaper, no drift bound — pair
125 with a capability regression suite).
126
127## Choosing the Method
128
129Pick by the **reward signal you can produce**, then by compute budget. Full per-algorithm
130detail and a decision tree are in
131[ai-llm/references/post-training.md](../ai-llm/references/post-training.md); the front-door
132logic:
133
1341. **Can you write demonstrations?** → SFT first. Do not reach for RL to teach something a
135 few hundred labeled examples would teach.
1362. **Do you have pairwise preferences and want simplicity?** → **DPO** (then KTO/ORPO/SimPO
137 if its numerics misbehave or you only have binary good/bad signals).
1383. **Does a stronger teacher model already exist, with a small student?** → **on-policy
139 distillation** before any RL loop: the teacher scores the student's *own* rollouts
140 token-by-token (on-policy, dense). Reported to outperform SFT and GRPO in that setting and to
141 restore generalization SFT loses.
1424. **Can you afford a reward model + online RL for a higher ceiling?** → a **critic-free
143 group-baseline method (GRPO/RLOO)** is the 2026 default; it drops the value model and its
144 optimizer state. **PPO** remains the reference algorithm (InstructGPT lineage) but ships under
145 `trl.experimental` — a learned reward model does *not* imply PPO.
1465. **Is the reward verifiable (math/code/tests)?** → **RLVR**, usually via GRPO or a GRPO-family
147 variant (DAPO/GSPO/RLOO) — the dominant 2026 reasoning recipe, now a portfolio rather than one
148 fixed algorithm; no human labels needed.
1496. **Is the task real work with no mechanical checker?** → **rubrics as rewards**: a structured
150 multi-criteria rubric grades the response. Legible and auditable, but a model-mediated proxy —
151 so the KL and over-optimization controls apply as they do for a reward model.
1527. **Are human labels the bottleneck?** → **RLAIF / Constitutional AI** to generate the
153 preference/critique signal from a model + a written constitution.
1548. **Want a quick gain without an RL loop?** → **Rejection sampling**: best-of-N generate →
155 score → SFT on the winners.
156
157## Reward Modeling (the load-bearing component)
158
159In reward-model-based RLHF, model quality is capped by reward-model quality. Key choices:
160
161- **Bradley-Terry RM** — the standard: an LM with a scalar value head trained on preference
162 pairs to predict which response a human prefers. Quality depends on preference-data balance
163 and avoiding spurious length/format correlations.
164- **ORM vs PRM** — Outcome Reward Models score the final answer; **Process Reward Models**
165 score each reasoning step. PRMs help on multi-step reasoning but need step-level labels and
166 are costlier to build. PRMs themselves split into **discriminative** (a scalar per step — the
167 2023 form, brittle on step segmentation and documented as hackable) and **generative** (the
168 verifier reasons, then judges — the 2026 default where PRMs are used at all).
169- **Generative reward modeling / LLM-as-a-judge** — use a model to emit a critique or score
170 instead of a scalar head; flexible, but inherits the judge's biases (calibrate via
171 [ai-evals](../ai-evals/SKILL.md)).
172- For **RLVR you skip the reward model** — a deterministic checker is the reward. That is why
173 RLVR is cheaper and *harder* to over-optimize than reward-model RL where the checker exists.
174 The checker is a much tighter proxy, not the true objective: incomplete tests are still
175 hackable.
176- **Rubrics as rewards** — when the task is real work with no mechanical checker, a structured
177 multi-criteria rubric can be the reward instead of forcing a fake verifier or falling back to
178 opaque pairwise preferences. Still a model-mediated proxy; treat it like a reward model for
179 over-optimization purposes.
180
181Depth: [references/reward-and-data.md](references/reward-and-data.md).
182
183## Over-Optimization Is the Default Failure Mode
184
185Preference RL optimizes a *proxy* for what you want, so it Goodharts silently — the model
186games the reward while the true objective degrades. Controls:
187
188- **KL regularization — scoped by reward source.** With a **learned** reward (RM+PPO, rubric
189 grader, DPO's implicit β) KL to the reference policy is the primary trust region and the main
190 knob against reward hacking: tune it, don't omit it. Under a **verifiable checker (RLVR)**,
191 `beta=0` is the 2026 standard — TRL's `GRPOConfig` ships `beta=0.0`, DAPO drops the KL term,
192 GSPO sets it to zero — and the trust region is carried by PPO-style clipping instead. Reach
193 for a nonzero β there only on evidence of drift or capability regression.
194- **Eval harness, always** — "completed" is wrong if anything was skipped; measure the *true*
195 objective (held-out human eval / verifiable tests), not just rising reward. Watch for
196 **over-refusal** (the model refuses safe requests) and length/sycophancy inflation.
197- **On-policy data + pretraining-gradient mixing** — mitigate forgetting and distribution
198 collapse.
199
200Depth: [references/over-optimization-and-eval.md](references/over-optimization-and-eval.md).
201
202## Known Traps
203
204- reaching for PPO/GRPO when **DPO** would do — paying for a reward model + RL loop you don't need
205- post-training at all when the gap is missing *knowledge* (RAG) or *format* (SFT), not preference/reasoning
206- treating RLHF as one algorithm — it's a pipeline (SFT → preference → reasoning RL) with online/offline and reward-source choices inside it
207- training a reward model on imbalanced/length-correlated preferences, then optimizing its spurious signal
208- running preference RL **without an eval harness** — reward goes up, true quality goes down, silently (Goodhart)
209- omitting the **KL penalty in reward-model RL** and watching the policy drift off its trusted SFT behavior (reward hacking, over-refusal) — but *carrying* a nonzero KL into RLVR by reflex, where β=0 is standard and KL mostly caps the reasoning gain
210- carrying a **`beta` value across method families** — DPO's β (~0.1, an implicit-reward temperature) and a GRPO KL coefficient (0.0–0.001) are different objects two orders of magnitude apart
211- reaching for **GRPO when a stronger teacher already exists** — on-policy distillation is the cheaper and often better move for a small student
212- picking among DPO/KTO/ORPO/SimPO from a list of adjectives instead of the **reference-based vs reference-free** tradeoff (a frozen model in memory and an implicit drift bound, or neither)
213- assuming a single-turn RLVR recipe transfers to a **multi-turn agent** — trajectory-level reward, cross-turn credit assignment, and rollout infrastructure are all new problems
214- using RLVR where the reward is *not* actually verifiable (no deterministic checker) — then it's just reward-model RL with a brittle checker
215- confusing ORM and PRM — process rewards need step-level labels you may not have
216- running **vanilla GRPO on a large MoE** and fighting non-convergence — token-level ratios break under expert-routing volatility; use **GSPO** (sequence-level)
217- ignoring **GRPO's length/std biases** that inflate response length and miscalibrate difficulty — use **Dr. GRPO** / **DAPO** fixes (see methods reference)
218- assuming a reasoning gap needs RLVR when, on a hosted model, raising the **thinking budget** would close it without any training
219
220## Common Anti-Patterns
221
222- jumping to RL before SFT is exhausted
223- choosing the algorithm from a benchmark instead of from the reward signal you can produce
224- treating reward-model quality as an afterthought when it caps the whole result
225- measuring success by reward curve instead of the true held-out objective
226- this skill re-teaching the per-algorithm math instead of routing to the ai-llm catalogue
227
228## Core Principles
229
2301. **SFT first, RL last.** Exhaust demonstrations before any reward-based method.
2312. **The reward signal picks the algorithm.** Four sources: human pairs → DPO/RM+GRPO; AI
232 preferences → RLAIF; a rubric → rubrics-as-rewards; a verifiable checker → RLVR.
2333. **Offline before online.** Start with DPO's simplicity; promote to GRPO/RLOO on evidence.
2344. **Reward quality caps model quality.** Invest in the reward model, rubric, or checker accordingly.
2355. **Assume over-optimization.** Always eval the true objective, or it Goodharts. Add KL to the
236 reference when the reward is *learned*; under a verifiable checker the trust region is
237 clipping and β=0 is standard.
238
239## Navigation: Core References
240
241- **[methods-and-pipeline.md](references/methods-and-pipeline.md)** — the SFT→preference→RL
242 pipeline, online vs offline, reference-based vs reference-free, and how each method
243 (DPO/PPO/GRPO/RLVR/rejection sampling/on-policy distillation) maps to a reward signal; also
244 agentic/multi-turn RL, rubrics-as-rewards, and the per-method `beta` anchor table; routes to
245 the ai-llm algorithm catalogue for per-algorithm depth
246- **[reward-and-data.md](references/reward-and-data.md)** — reward modeling (Bradley-Terry,
247 ORM/PRM, generative RM), preference-data collection, synthetic data, RLAIF/Constitutional AI
248- **[over-optimization-and-eval.md](references/over-optimization-and-eval.md)** — reward
249 hacking/Goodhart, KL regularization, over-refusal, and evaluating the true objective
250- **[grpo-run-diagnostics.md](references/grpo-run-diagnostics.md)** — reading a live GRPO/RLVR
251 run: advantage mean (sanity check) vs std (learning signal), degenerate zero-gradient groups,
252 reward exhaustion at 1.00, entropy trajectories, and a triage table
253
254## External Sources
255
256See **[data/sources.json](data/sources.json)** for primary references: Lambert's *RLHF* book
257(the anchor), InstructGPT, DPO, DeepSeek-R1 (GRPO/RLVR), Tülu 3, GKD and Thinking Machines'
258on-policy distillation, *Rubrics as Rewards*, the multi-turn agentic RL practitioner's guide,
259the PRM survey, Raschka's *Build a Reasoning Model* (verifier engineering + GRPO run telemetry),
260and Pai's *Designing Large Language Model Applications* (model merging/fusion taxonomy).
261
262## Fact-Checking
263
264- Algorithm names, framework support, and which labs use which recipe are volatile; verify
265 against current primary sources before recommending a specific one. TRL specifically turns
266 over fast — its `loss_type` roster, trainer namespaces (first-class vs `trl.experimental`),
267 and defaults all changed between 2026-07 and 2026-08.
268- The framework landscape is wider than TRL: **verl** (the common backbone for large-scale and
269 agentic RL, async rollout), **OpenRLHF** (multi-turn/VLM RL), and others (NeMo RL, AReaL,
270 ROLL, slime). Choose beyond TRL when scale, asynchronous rollout, or multi-turn environments
271 are the constraint; delegate depth to
272 [ai-distributed-training](../ai-distributed-training/SKILL.md). Health and feature claims for
273 any of these must be re-checked — they were not verified past 2026-08.
274- Model-specific recipe claims (e.g. "DeepSeek-R1 used X") must be checked against the model's
275 own technical report, not secondary summaries.
276- If you cannot verify, present guidance as a dated assumption, not a fact.
277
278## Learnings Loop
279
280Before applying this skill on a non-trivial task, read `learnings.consolidated.md` in this directory (and `learnings.md` if present).
281
282After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to `learnings.md` via `agents-skills-feedback-loop/scripts/append_learning.py`. Do not modify `SKILL.md` itself.