RL Training Strategies & Practical Recipes — Every recipe and engineering trick that turns a policy-optimization paper into a model that actually trains

22 sections · classical RL through 2026 RLHF hyperparameters, stability, distributed, debugging

April 2026 · Version 1.0


1. Pre-Training and Cold-Start

1.1 The four canonical starting points

  1. Pure RL from scratch: random init policy. Classical control, AlphaZero-style self-play.
  2. Pure RL from a base model (R1-Zero): pretrained LM, no SFT, jump straight to RL on verifiable rewards. Works only above a critical scale.
  3. SFT → RL: supervised warm-start, then RL. Classical InstructGPT recipe.
  4. SFT → DPO/RL → rejection-sampling SFT → RL again (DeepSeek-R1): multi-stage interleaved SFT and RL.

1.2 When pure RL works (R1-Zero)

1.3 When SFT-first wins

1.4 R1-style 4-stage recipe

Key

DeepSeek-R1 multi-stage pipeline.

  1. Cold-start SFT: thousands of curated long-CoT examples.
  2. RL with GRPO: verifiable math/code rewards + format + language-consistency rewards.
  3. Rejection-sampling SFT: collect \(\sim 600\) k (correct, well-reasoned) traces from the RL'd model + \(\sim 200\) k general SFT data, retrain.
  4. Final RL: another GRPO pass for safety / helpfulness / general reasoning.

Each stage strengthens different capabilities; interleaving avoids the brittleness of pure-RL or pure-SFT.

1.5 The cold-start data choice

For RLHF cold start: \(\sim 10\) k–100k high-quality demos. For reasoning cold start: \(\sim 1\) k–10k carefully curated long-CoT exemplars. Quality > quantity by orders of magnitude.

2. Rollout Strategies and Data Collection

2.1 On-policy vs off-policy

On-policy (PPO, A2C): trajectories must come from the current policy or a very recent one. Sample-inefficient; clean theory.

Off-policy (DQN, SAC, TD3): trajectories from any policy work, with replay buffer. Sample-efficient; trickier stability.

Near-on-policy (GRPO, PPO with \(\sim 1\) epoch): one or two updates per rollout; effectively on-policy. Modern LLM RL leans here.

2.2 Vectorized environments

Run \(N\) parallel envs in one process; step them together. \(N\) typically 8–64 for classic Atari, 1024+ for IsaacGym.

Key

Vectorized rollout. Increase \(N\) env parallelism until either the GPU is saturated (large policy) or env step is the bottleneck. Then switch to multiprocessing or distributed actors.

2.3 Asynchronous actor-learner (IMPALA / A3C)

Many actors collect data in parallel, push to a central learner. V-trace corrects for the policy lag:

\[\bar{\rho}_t = \min(\rho_t, \bar{\rho}), \qquad \hat{V}(s_t) = V(s_t) + \sum_{k\ge t} \gamma^{k-t}\Big(\prod_{i<k} c_i\Big)\bar{\rho}_k\,\delta_k V.\]

\(\bar{\rho}\) is the truncation level (1.0 typical). Necessary at large scale.

2.4 Synchronous distributed actors (PPO-distributed)

All actors collect a fixed number of timesteps; learner waits for sync; one update; broadcast new weights. Easier to reason about; standard in modern PPO infra (Ray RLlib, OpenRLHF).

2.5 Massively-parallel sim (Isaac Lab, MJX, Genesis)

\(10^4+\) parallel envs on a single GPU. Trains quadruped locomotion in hours. Required for modern robotics RL.

2.6 Sample efficiency knobs

2.7 Trajectory length per rollout

3. Batch Composition and Update Frequency

3.1 The key ratios

3.2 PPO default ratios

3.3 LLM RLHF default ratios

3.4 GRPO group size \(G\)

Watch out

A group where all responses succeed (or all fail) gives zero advantage signal. Filter these prompts or use dynamic sampling (DAPO) to re-sample.

4. Hyperparameter Recipes

4.1 Discount factor \(\gamma\)

4.2 GAE \(\lambda\)

4.3 PPO clip \(\epsilon\)

4.4 KL coefficient \(\beta\)

4.5 Learning rate

4.6 Adam epsilon (the famous one)

\(\epsilon_{\mathrm{Adam}} = 10^{-5}\) for RL (default \(10^{-8}\) destabilizes Atari PPO!). Documented in CleanRL.

4.7 Entropy coefficient

4.8 Value function coefficient

\(c_v = 0.5\) for PPO. Higher (1–2) when value loss is dominating; lower if value-loss training is unstable.

5. Stability Tricks

5.1 Reward normalization / scaling

5.2 Observation normalization

Maintain running mean / std of observations; subtract mean, divide by std, clip \(\pm 5\). Necessary for many MuJoCo / Atari policies.

5.3 Value function clipping

Key

Clipped value loss.

\[V_t^{\mathrm{clip}} = V_{\mathrm{old}}(s_t) + \mathrm{clip}\big(V_\theta(s_t) - V_{\mathrm{old}}(s_t),\, -\epsilon,\, \epsilon\big),\]

\[\mathcal{L}_V = \max\big((V_\theta - R)^2,\ (V^{\mathrm{clip}} - R)^2\big).\]

Mirrors the policy clip, prevents value-net overshoot.

5.4 Gradient clipping

Global norm clip: \(g \leftarrow g \cdot \min(1, \tau / \|g\|)\), \(\tau = 0.5\) standard. Prevents single-batch divergence.

5.5 EMA / target networks

5.6 Loss spike mitigation

5.7 Adaptive KL regularization

Key

Adaptive \(\beta\) (PPO-Penalty).

\[\beta \leftarrow \begin{cases} 2\beta & \text{if } \mathbb{E}[\mathrm{KL}(\pi_{\mathrm{old}}\|\pi_\theta)] > 1.5\,d_{\mathrm{target}} \\[2pt] \beta/2 & \text{if } \mathbb{E}[\mathrm{KL}] < d_{\mathrm{target}}/1.5 \\[2pt] \beta & \text{else} \end{cases}\]

\(d_{\mathrm{target}} \sim 0.01\) for most LLM RL.

5.8 Trust-region and natural gradient

TRPO uses CG to compute \(F^{-1}g\) + line search for guaranteed improvement; PPO approximates with clip. ACKTR uses K-FAC for cheaper natural gradient.

5.9 Whitening advantages

Per minibatch: \(\hat{A} \leftarrow (\hat{A} - \mathrm{mean}(\hat{A})) / (\mathrm{std}(\hat{A}) + 10^{-8})\). Standard for PPO; not for GRPO (whose advantage is already group-relative).

6. Exploration Strategies

6.1 Action-space exploration

6.2 Entropy bonus annealing

Key

Entropy schedule. Start \(c_e \sim 0.01\) early to encourage exploration; anneal to 0 over training. For LLM RLHF, \(c_e = 0\) is fine because per-token sampling temperature provides exploration.

6.3 Sampling temperature for LLM RL

6.4 Intrinsic motivation

6.5 Population-based exploration

7. Curriculum Learning

7.1 Forward curriculum

Start at easy difficulty; advance when success rate exceeds threshold (e.g., 80%). Common in robotics manipulation, Atari with shaped progression.

7.2 Reverse curriculum

Start agent near the goal; expand starting state distribution backward. Effective for sparse-reward goal-reaching tasks.

7.3 Adaptive curriculum

Per-sample difficulty based on current policy success. Variants:

7.4 Self-play as curriculum

For zero-sum games (AlphaZero, AlphaStar): play against past versions or current opponent. Auto-generates appropriate difficulty.

7.5 Hindsight curriculum

HER + curriculum: use achieved goals as the curriculum's task distribution. Effectively a free curriculum without any difficulty engineering.

7.6 Domain randomization as curriculum

Start with narrow randomization range; widen as policy succeeds. Eventual: full real-world distribution.

8. Sim-to-Real for Robotics

8.1 Domain randomization

Trained policy is invariant to nuisances \(\to\) transfers.

8.2 Asymmetric actor-critic

Critic uses privileged info (full state \(s\), terrain map \(\xi\)); actor uses only egocentric observations \(o\):

\[\pi_\theta(a|o), \qquad V_\phi(s, \xi).\]

Variance reduction without leaking privileged info to the deployable policy.

8.3 Privileged-to-vision distillation

After RL, distill the privileged actor (which sees \(s, \xi\)) into a vision-only student (sees \(o\)):

\[\mathcal{L}_{\mathrm{distill}} = \mathbb{E}\big[\|\pi_S(o) - \pi_T(s, \xi)\|^2 + \alpha\,\mathrm{KL}(\pi_T\|\pi_S)\big].\]

Student deployed in real world.

8.4 System identification (SysID)

Learn dynamics parameters from a few seconds of real-world data. Use to narrow domain randomization or to retune the real-world policy in-place.

8.5 Online adaptation

RMA (Rapid Motor Adaptation): an adaptation module estimates env parameters from recent observation history, feeds them to the policy.

8.6 Curriculum + DR

Key

Sim-to-real recipe (locomotion).

  1. Train teacher with privileged info, full DR range, in \(10^4\) parallel envs.
  2. Distill to vision-only student in same envs.
  3. Deploy on real robot; collect \(\sim 1\) minute of data.
  4. SysID + retune student LR; brief online adaptation.

8.7 Eureka / DrEureka for reward + DR design

LLM proposes reward functions and DR ranges; train with massive parallel sim; evaluate; refine. Useful when the search space is large.

9. Offline-to-Online Fine-Tuning

9.1 Why?

Offline RL is safe but bounded by data quality. Online fine-tune leverages further interaction. Pre-training is the same idea as in supervised learning: cheaper, faster overall.

9.2 Standard recipe

  1. Pre-train policy + critic offline (CQL, IQL).
  2. Continue online with SAC / TD3.
  3. Mix offline data into online replay buffer with ratio \(\rho\).
  4. Anneal conservatism during online phase.

9.3 Catastrophic forgetting mitigations

9.4 For LLM RLHF

Offline-to-online RLHF: SFT on demonstrations \(\to\) DPO on offline preferences \(\to\) online iterative DPO with model-generated samples.

10. Distributed RL Training

10.1 Architectures

10.2 For LLM RL

10.3 Reference model handling

10.4 Actor / learner separation in LLM RL

10.5 Frameworks for distributed RL

Framework Use Strengths
Ray RLlib Classical distributed RL Multi-algorithm, scaling
SEED RL TPU-friendly distributed High throughput
torchbeast PyTorch IMPALA Reference impl
OpenRLHF LLM RLHF / DPO / GRPO Ray + DeepSpeed; production
verl (Volcano) LLM RL at scale Used in R1 reproductions
trlX Distributed PPO/RLHF Mature
NeMo Aligner (NVIDIA) RLHF in NeMo stack Best on H100/B200 clusters

11. LLM RLHF Training Pipelines

11.1 Stage 1: SFT

11.2 Stage 2: Reward Model training

11.3 Stage 3: PPO

Key

PPO-RLHF default hyperparameters.

  • LR: \(1 \times 10^{-6}\)\(5 \times 10^{-6}\).
  • Batch: 64–512 prompts.
  • Sample 1 response per prompt; max-tokens 256–2048.
  • PPO epochs: 1–4.
  • Clip \(\epsilon = 0.2\).
  • KL coefficient \(\beta\): adaptive, target KL \(\sim 0.02\).
  • Value head: shared backbone, separate scalar head.
  • Critic LR: same as policy.
  • Reward whitening: per-batch z-score.

11.4 Common issues in PPO-RLHF

11.5 Iterative RLHF

After PPO converges:

  1. Sample new responses from RL'd model.
  2. Collect preferences (or RM scores).
  3. Update RM.
  4. Run PPO again from current policy.
  5. Repeat 2–4 times. Each iteration tightens the alignment.

12. DPO Training Pipelines

12.1 Standard DPO recipe

Key

DPO defaults.

  • Pre-stage: SFT on demos.
  • Data: \(\sim 10\) k–100k preference pairs.
  • LR: \(5 \times 10^{-7}\)\(5 \times 10^{-6}\) (lower than SFT!).
  • \(\beta\): 0.1 standard; lower (0.01) for stronger optimization, higher (1.0) for more conservative.
  • Batch: 8–64 pairs.
  • Epochs: 1 (more risks overfitting).
  • Linear warmup over 10% of steps; cosine to 0.

12.2 ORPO (combined SFT + preference)

Skip the SFT stage; one-step training with combined loss:

\[\mathcal{L}_{\mathrm{ORPO}} = \mathcal{L}_{\mathrm{SFT}}(y_w) - \lambda\log\sigma\!\left(\log\frac{\mathrm{odds}(\pi_\theta(y_w))}{\mathrm{odds}(\pi_\theta(y_l))}\right).\]

\(\lambda \sim 0.1\). No reference policy, half the memory.

12.3 SimPO (no reference policy)

Length-normalized log-prob, drops reference. Saves memory; good for resource-constrained settings.

12.4 KTO (single-response thumbs)

Useful when you only have \(+/-\) flags, not pairs. Up to \(5\times\) more sample-efficient with binary feedback.

12.5 Iterative / online DPO

  1. Start with SFT model.
  2. Sample \(K\) responses per prompt with current \(\pi_\theta\).
  3. Score with RM (or LLM judge); form preference pairs.
  4. Run DPO for one epoch.
  5. Repeat 2–5 times.

Closes the gap with PPO at much lower complexity.

12.6 Mixing prompts

For DPO data: cover the prompt distribution you want at inference. Pure helpfulness pairs \(\to\) helpful but maybe unsafe. Mix safety + helpfulness pairs at \(\sim 70/30\) ratio.

12.7 Self-play DPO (SPIN)

Generate responses from current model; the previous-iteration model's responses are losing; current model's responses are winning. Iterative bootstrap. Effective when starting from a strong SFT.

13. GRPO Training Recipes

13.1 Default GRPO setup (DeepSeek-style)

Key

GRPO defaults.

  • Group size \(G\): 8–64 (16 typical).
  • Sampling temperature: 0.6–1.0.
  • Max generation: 4096–16384 tokens for reasoning (long CoT).
  • PPO-style clip \(\epsilon\): 0.2.
  • KL coefficient \(\beta\): 0.001–0.04.
  • LR: \(1 \times 10^{-6}\)\(5 \times 10^{-6}\).
  • Reward normalization: group-relative (built into GRPO).
  • Filter trivial-pass groups: skip prompts where all responses succeed or fail.

13.2 R1-style verifiable-reward GRPO

13.3 DAPO improvements

13.4 Dr. GRPO

Drop length normalization to remove length / difficulty bias; otherwise identical.

13.5 Common GRPO failure modes

13.6 R1-Zero specifics

Pure RL from base model:

14. Diffusion Alignment Training Recipes

14.1 Diffusion-DPO standard recipe

Key

SDXL/SD3/FLUX DPO defaults.

  • Data: 10k–100k preferred-vs-rejected image pairs at the same prompt.
  • LR: \(1 \times 10^{-7}\)\(1 \times 10^{-6}\) (very low!).
  • \(\beta\): 1000–5000 (much larger than text DPO due to per-step diffusion loss scaling).
  • Batch: 1–4 (large memory cost).
  • Epochs: 1.
  • Optimizer: AdamW, weight decay 0.01.
  • LoRA training (rank 8–64) often used for efficiency.

14.2 DDPO / DPOK (PPO on diffusion)

14.3 Reward backprop (DRaFT, AlignProp, ReFL)

14.4 Composite reward for diffusion

\[r = w_{\mathrm{HPS}}\,r_{\mathrm{HPS}} + w_{\mathrm{CLIP}}\,r_{\mathrm{CLIP}} + w_{\mathrm{aes}}\,r_{\mathrm{aes}} - w_{\mathrm{NSFW}}\,r_{\mathrm{NSFW}}.\]

15. Robotics Training Recipes

15.1 Locomotion (ANYmal, Cassie, H1, G1)

Key

Quadruped/biped locomotion recipe.

  1. Isaac Lab / MJX with \(\sim 4096\) parallel envs.
  2. PPO, LR \(3 \times 10^{-4}\), \(\gamma = 0.99\), \(\lambda = 0.95\), clip 0.2.
  3. Composite reward: track velocity, stability, smoothness penalties.
  4. Domain randomization: terrain, friction, mass, motor delay, sensor noise.
  5. Train teacher with privileged info (terrain map).
  6. Distill teacher \(\to\) vision-only student.
  7. Sim-to-real with brief on-robot adaptation.

15.2 Manipulation (table-top tasks)

15.3 Bimanual / dexterous (ALOHA, ShadowHand)

15.4 VLA training (RT-2, OpenVLA, \(\pi_0\))

  1. Base: pretrained VLM.
  2. Co-train with mix of robot trajectories + web image-text data.
  3. Discretize actions (RT-2/OpenVLA) or use FM head (\(\pi_0\)).
  4. Massive batch size; gradient checkpointing; mixed precision.
  5. For RL fine-tune: sparse success + Q-chunking.

15.5 Humanoid mocap RL (DeepMimic, AMP, ASE)

16. Eval Strategies During Training

16.1 What to log

16.2 Held-out eval cadence

16.3 Benchmarks

16.4 Pass@k for code/reasoning

\[\mathrm{pass@}k = 1 - \prod_{i=1}^{k}(1 - p_i),\]

where \(p_i\) is success of \(i\)-th independent sample. Standard for LiveCodeBench / HumanEval.

16.5 Win rate (Arena-style)

For DPO/RLHF eval: pairwise comparison against a strong baseline (GPT-4, Claude) judged by another LLM. Compute win rate or Elo.

17. Debugging Failed Training Runs

17.1 Diagnostic tree

  1. Reward not increasing? \(\to\) verify reward computation manually on samples.
  2. Reward increasing, eval flat? \(\to\) reward hacking; check for length explosion, repetition, format-only optimization.
  3. KL exploding? \(\to\) check reference model frozen; reduce LR; increase \(\beta\); reduce PPO epochs.
  4. Entropy collapsing too fast? \(\to\) increase entropy bonus; raise sampling temperature.
  5. Value loss not decreasing? \(\to\) value head undertrained; increase \(c_v\); consider separate value net.
  6. Gradient spikes? \(\to\) tighten clip \(\tau\); investigate problematic batches; add reward clipping.
  7. Mode collapse in DPO? \(\to\) lower LR; reduce epochs; increase \(\beta\).
  8. Length exploding in GRPO? \(\to\) switch to Dr. GRPO or add explicit length penalty.

17.2 Sanity checks before scaling

17.3 Ablations to run

18. Compute and Memory Engineering

18.1 Memory math (LLM RLHF)

For a 7B model in BF16 + Adam states + gradients:

\[\mathrm{Mem} \approx 14 \cdot 7\mathrm{B} \cdot 1\,\mathrm{B} = 98\ \mathrm{GB},\]

plus activations + KV cache. Fits with FSDP / ZeRO-3 across 8 GPUs.

18.2 PPO doubles memory

PPO needs the reference policy too: \(\sim 2\times\) the model footprint. Solutions:

18.3 Generation acceleration

18.4 Gradient checkpointing

Save memory by recomputing activations in backward pass at the cost of \(\sim 30\%\) extra compute. Standard for full-FT large models.

18.5 Mixed precision and FP8

18.6 LoRA / PEFT for RLHF

18.7 Reference model sharing tricks

19. Multi-Task and Generalization

19.1 Task sampling

19.2 Multi-task PPO

Single policy across \(K\) tasks. Per-task reward normalization to prevent dominance. Sometimes one-hot task ID concatenated to observation.

19.3 Distillation across tasks

After per-task experts, distill into a single multi-task policy:

\[\mathcal{L}_{\mathrm{multi}} = \sum_k \lambda_k\,\mathbb{E}_{(s,a)\sim\pi_k^*}\big[-\log\pi_\theta(a|s, k)\big].\]

19.4 Meta-RL recipes

20. Common Failure Modes Catalogued

20.1 For PPO

20.2 For DPO

20.3 For GRPO / R1-style

20.4 For robotics

21. Production Best Practices (2026)

21.1 LLM RLHF stack

21.2 LLM reasoning stack

21.3 Diffusion alignment stack

21.4 Robotics stack

Appendix A: Hyperparameter Cheat Card

Setting PPO (control) PPO-RLHF GRPO (R1)
LR 3e-4 1e-6–5e-6 1e-6–5e-6
Adam \(\epsilon\) 1e-5 1e-8 1e-8
Discount \(\gamma\) 0.99 1.0 1.0
GAE \(\lambda\) 0.95 0.95
Clip \(\epsilon\) 0.2 0.2 0.2
KL coef \(\beta\) 0.01–0.1 0.001–0.04
Entropy \(c_e\) 0.01 0.0 0.0
Value coef \(c_v\) 0.5 0.5–1.0 — (no value)
Epochs/rollout 4–10 1–4 1
Mini-batch 64–1024 full or 1/4 per group
Grad clip \(\tau\) 0.5 1.0 1.0
Group \(G\) 8–64
Sample temp 1.0 0.6–1.0

Appendix B: Pre-Run Checklist

  1. Reward computed correctly on hand-checked samples.
  2. Reference policy frozen (verify gradient flow).
  3. KL anchor active (log \(\mathrm{KL}(\pi\|\pi_{\mathrm{ref}})\) from step 1).
  4. Sample prompts read for sanity.
  5. Hyperparameters from a known-good recipe (no exotic settings).
  6. Tiny-scale overfitting test passes (100 samples, model memorizes).
  7. Eval pipeline runs end-to-end on a checkpoint.
  8. Logging: per-component reward, KL, entropy, gradient norm, value loss.
  9. Checkpoint cadence + max keep set.
  10. Failure-recovery: skip-bad-batches and rollback ready.

Appendix C: Twenty Things a Senior RL Engineer Should Just Know

  1. Adam \(\epsilon = 10^{-5}\) for RL.
  2. Reward normalization by std, not mean.
  3. Observation normalization is necessary for MuJoCo.
  4. GAE with \(\lambda = 0.95\).
  5. KL anchor is non-negotiable in RLHF.
  6. Length normalize RM data.
  7. Use ensembles of RMs.
  8. Filter trivial-pass prompts in GRPO.
  9. Dr. GRPO removes length bias.
  10. DPO needs only 1 epoch.
  11. DPO LR is much smaller than SFT LR.
  12. For diffusion DPO, \(\beta \sim 1000\), not 0.1.
  13. Sample-and-read your policy outputs every checkpoint.
  14. Privileged-to-vision distillation closes most sim-to-real gaps.
  15. Eureka can design rewards better than humans.
  16. Vectorized envs first; distributed only when GPU saturated.
  17. LoRA + frozen base saves \(2\times\) memory in DPO/GRPO.
  18. Pre-compute reference log-probs once per epoch.
  19. AlpacaEval 2 + Arena-Hard correlate well with human prefs.
  20. The held-out human eval is the only ground truth.