Part II / Reinforcement Learning

LLM post-training

Post-training is a ladder of data and objectives that turn a next-token model into a policy for instructions, preferences, tools, reasoning, and product constraints.

10
SFT

Imitate target responses or trajectories.

Preference

Learn which of two behaviors is better.

RL

Generate behavior, score it, and update the policy toward higher return.

Apprentice, critic, practice field

Pretraining gives an apprentice broad language and world patterns. Supervised fine-tuning shows worked examples of the job. Preference learning teaches a critic or direct rule for choosing better work. Reinforcement learning lets the apprentice practice, receive feedback on its own attempts, and change behavior. Each stage can exist without every later stage.

Mental model

SFT says "do this." Preference data says "this is better than that." RL says "try, receive a score, and shift probability toward actions with better return."

Pretraining itself is an optimization process, but in the common post-training taxonomy it is supervised next-token prediction over naturally occurring text, not RL. The distinction matters because pretraining has a target token at each position, while agent RL evaluates consequences of sampled behavior.

Five ways to improve the same reasoning engine

Concrete example

The engine sometimes produces an excellent four-step investigation but often guesses from the recent configuration change. We have replayable incidents, trace rubrics, and a final-cause oracle.

Rejection sampling
Generate many traces, keep those that pass gates, and train on the survivors.
SFT
Imitate expert or selected trajectories token by token.
DPO
Increase the chosen-versus-rejected preference margin relative to a reference policy.
RLHF / RLAIF
Train or use a preference reward, then optimize sampled responses with policy-gradient RL.
RLVR
Run online rollouts and optimize deterministic or otherwise verifiable incident outcomes.

The least complex useful step is often selection plus SFT. It requires no online policy optimization and can teach tool syntax, evidence structure, and common workflows. Its limit is coverage: the model imitates demonstrated behavior and may not recover when its own earlier action creates an unfamiliar observation.

The classic RLHF pipeline

The InstructGPT recipe has three recognizable stages: supervised fine-tuning on demonstrations; a reward model trained from human comparisons; and PPO optimization of the policy against that learned reward with a penalty for drifting from a reference.[source] "RLHF" is broader than this exact implementation, but the pipeline remains a useful reference.

The reward model takes a prompt and response and predicts preference. The policy then samples responses, the reward model scores them, and PPO raises the probability of high-advantage tokens. A KL term keeps the policy near a supervised reference, preserving capabilities and reducing exploitation of weak reward-model regions. The reward model is a scalable proxy for humans, so overoptimization and distribution shift remain central risks.

RLAIF replaces some human comparisons with AI-generated feedback or rankings.[source] It can scale nuanced labels but may amplify the judge model's biases, blind spots, or style preferences. Provenance should distinguish human, AI, deterministic, and mixed feedback.

DPO learns directly from preference pairs

DPO starts from a KL-constrained RLHF objective and rewrites the preference problem as a pairwise classification-style loss over the policy itself. Each training record contains a prompt, a chosen response, and a rejected response. The optimizer pushes the policy's chosen-versus-rejected log-probability margin above the same margin under a fixed reference policy, usually the supervised fine-tuned model that precedes preference training.[source]

Concrete example

For one incident, the chosen trace checks both network paths, cites returned evidence, and identifies the failing gateway. The rejected trace jumps from a recent configuration change to the wrong cause. DPO trains on that relative judgment. It does not need a separate reward model to convert the pair into scalar scores first. In an agent trace, the loss should cover tokens the policy generated, not tool results or other observations supplied by the environment.

margin = [log pi(chosen) - log pi_ref(chosen)] - [log pi(rejected) - log pi_ref(rejected)] The DPO loss is -log sigmoid(beta x margin). Training rewards a larger reference-relative gap between chosen and rejected responses.

The paper's phrase "your language model is secretly a reward model" has a narrow mathematical meaning. In the derivation, a scaled policy-to-reference log-probability ratio can represent the implicit reward, up to a prompt-dependent constant. It does not mean an arbitrary pretrained model already contains a trustworthy reward for human preferences.

This is more precise than saying DPO independently raises every chosen probability and lowers every rejected probability. The chosen probability can fall if the rejected probability falls farther. The loss acts on their reference-relative margin. Its beta coefficient comes from the KL penalty in the underlying RLHF objective: larger beta represents stronger pressure to stay near the reference.

The derivation assumes a pairwise preference model and describes the optimum of the KL-constrained objective. Those assumptions make the direct loss possible; they do not guarantee that a finite dataset captures every human preference or that optimization cannot overfit shortcuts such as response length.

DPO removes
Relative to PPO-based RLHF: a separately trained reward model, a value critic, and the generate-score-update RL inner loop.
DPO keeps
A trainable policy, preference pairs, reference-policy log-probabilities, optimization hyperparameters, and independent evaluations.
Implementation note
With a frozen reference and fixed dataset, DPO can precompute reference log-probabilities if tokenization, templates, truncation, and masking stay identical. It need not keep a second model resident throughout training.

PPO, GRPO, and DPO move the policy differently

All three methods can steer a language model toward preferred behavior, but they consume different data and construct the learning signal differently.

DimensionPPO with criticGRPO-style RLDPO
Update signalAdvantage estimated with a learned value functionAdvantage computed from rewards within a prompt groupReference-relative margin between chosen and rejected responses
Training dataFresh or recent rollout trajectoriesGroups of fresh or recent responses to each promptPre-collected prompt, chosen, and rejected triples
Logical model rolesPolicy, critic, reference, and reward or verifierPolicy, reference, and reward or verifier; no criticPolicy and frozen reference; no critic or explicit reward model in the update
Reward machineryLearned reward model, verifier, environment reward, or mixtureLearned reward model, verifier, environment reward, or mixturePair labels are consumed by the loss; humans, an AI judge, or another scoring process may have produced them
Extra trainable estimatorCritic or value headNo criticNo critic
Data regimeUsually on-policy or near-on-policyUsually on-policy or near-on-policyUsually offline; its pairs are often off-policy relative to the model being trained, but the update itself is not an RL rollout loop
Distinctive costCritic training and rollout orchestrationSeveral sampled responses per promptBuilding representative, high-quality preference pairs

DPO is attractive when the preference dataset already covers the behavior that matters. It has fewer moving parts than PPO or GRPO, but it still has optimization choices, data-quality failures, overoptimization, distribution shift, and reference-policy sensitivity. The simpler pipeline still needs deliberate evaluation.

PPO and GRPO can collect new attempts from the current policy and observe their consequences in an environment. That lets the training distribution follow the learner and expose behaviors absent from a fixed dataset. It does not guarantee creative or correct reasoning; the environment, exploration policy, and reward still decide what can be discovered and reinforced.

DPO itself is normally an offline optimization stage. A round-based pipeline can generate new pairs with the current policy, label them, and run DPO again on that round's snapshot. Data collection then becomes an online outer loop, while the DPO update within each round remains offline. Fully online variants can interleave sampling and updates more tightly. Online iterative RLHF makes the broad distinction concrete.[source]

KTO works with examples labeled desirable or undesirable rather than paired comparisons.[source] Other preference objectives vary reference treatment, margins, calibration, and robustness. "Preference optimization" is the stable category; individual objectives are choices within it.

RLVR and process supervision

RL with verifiable rewards uses feedback that can be checked from a formal or environment-grounded result: exact math answers, code tests, game outcomes, or seeded incident facts. DeepSeekMath used GRPO for mathematical reasoning, and DeepSeek-R1 describes large-scale reasoning RL with rule-based rewards in gradeable domains.[source][source]

Verifiable does not mean complete. Tests may miss behavior; exact-answer rewards may ignore reasoning validity; a scenario oracle may encode only one acceptable diagnosis. Outcome supervision grades the final result. Process supervision grades intermediate steps. In one mathematical study, process-supervised reward models outperformed outcome-supervised models on its chosen MATH evaluation.[source] That result is important and scoped: it is not proof that every agent should reward narrated reasoning steps.

For the reasoning engine, process feedback is strongest when tied to observable acts: querying both redundant paths, citing returned evidence, distinguishing fact from hypothesis, respecting approval boundaries, and terminating for a stated reason. Hidden chain-of-thought should not be treated as a guaranteed faithful record of causal computation.

Misconception: DPO is RL without PPO

DPO is derived from an RLHF objective, but operationally it is an offline preference-optimization loss. It has no sampled environment interaction or policy-gradient rollout loop by itself. Say which sense you mean.

A practical escalation ladder

  1. Build trustworthy evaluation before optimizing.
  2. Use prompting and orchestration to establish the task interface.
  3. Select strong model-generated traces and measure best-of-n headroom.
  4. Use SFT when imitation covers important behavior.
  5. Use preference optimization when relative judgments are reliable.
  6. Use online RL when exploration, long-horizon consequences, or current-policy data justify the machinery.
  7. Keep release gates independent of the training reward.

This is not a maturity ranking. A verifiable game may justify online RL immediately; a sensitive support workflow may never justify unconstrained interaction. The data, environment, feedback fidelity, and risk define the method.

References