Designing a Critic-Free RL Pipeline for Training Reasoning Models
Machine LearningModel answerLast updated
Build a post-training system for a 70B reasoning LLM using group-relative optimization, exploring advantage estimation, memory efficiency, and reward design.
Context
You're architecting the post-training infrastructure for a 70-billion-parameter language model specialized in mathematical reasoning and code generation. Traditional reinforcement learning approaches that maintain separate actor, critic, reference, and reward networks create prohibitive memory demands and coordination complexity across your GPU cluster.
Your team is evaluating a critic-free reinforcement learning approach that estimates advantages by comparing multiple sampled outputs for each prompt, combined with an attention mechanism that compresses key-value cache storage through latent representations.
Your Task
Design and justify the technical decisions for this training pipeline, addressing:
Part 1: Group-Based Advantage Calculation
Explain how to estimate per-sequence advantages without training a value network. For a given prompt and a collection of G generated responses with associated rewards, derive the advantage formula and describe how it integrates into the policy gradient objective. What is the mathematical relationship between the probability ratio clipping mechanism and the KL divergence regularization term? Analyze what happens when the group size is very small versus moderately large.
Part 2: Infrastructure and Memory Analysis
Calculate the memory footprint difference between maintaining a critic network versus eliminating it for a 70B model under mixed-precision training. Additionally, compare standard grouped-query attention against a latent-space attention design that compresses key-value representations. Provide concrete numbers for cache memory requirements when generating 16 outputs of 16,000 tokens each, and explain how this affects throughput and maximum context capacity.
Part 3: Reward Engineering for Reasoning Tasks
Design a reward function that combines execution-based correctness verification with structural format requirements. Identify two common pathological behaviors that emerge during reinforcement learning with verifiable rewards (such as the model exploiting length-based advantage normalization or collapsing to repetitive outputs). For each failure mode, propose specific algorithmic or reward-shaping interventions that address the root cause.
Hints
Hint 1
The group mean serves as an empirical baseline estimate—think about what happens to variance when group size approaches 2
Hint 2
Memory savings come from both inference-time weight storage and training-time optimizer states; quantify each separately
Hint 3
Length-based normalization creates perverse incentives when advantages are negative; consider alternatives that treat all tokens equally
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer: Critic-Free RL for Reasoning Models
Evaluation Criteria
Strong candidates will provide exact formulas for advantage estimation, calculate concrete memory numbers rather than speaking vaguely about "improvements," and demonstrate knowledge of specific failure modes observed in practice with verifiable rewards.
Part 1: Group-Based Advantage Estimation
Core Mechanism
The key insight is replacing a learned value function with an empirical baseline computed from the group itself. For each prompt q, sample G responses from the current policy and score each. The advantage for response i becomes:
A_i = (r_i - μ) / (σ + ε)
where:
μ = (1/G) Σ r_j (group mean)
σ = sqrt((1/G) Σ (r_j - μ)²) (group std)
ε = 10^-8 (numerical stability)
Since rewards are assigned at the sequence level (outcome-based, not per-token), every token in response i receives the same advantage value A_i. The group mean provides an unbiased estimate of the expected return for that prompt, eliminating the need for a separate critic network.
Policy Gradient Objective
The loss function combines clipped probability ratios with explicit KL regularization:
L(θ) = E[ (1/G) Σ_i (1/|o_i|) Σ_t (
min(π_ratio_{i,t} · A_i, clip(π_ratio_{i,t}, 1-δ, 1+δ) · A_i)
- β · KL_{i,t}
)]
where:
π_ratio_{i,t} = π_new(token_t | context) / π_old(token_t | context)
KL_{i,t} = (π_new / π_ref) - log(π_new / π_ref) - 1 (reverse KL, k3 form)
Key differences from standard PPO:
- Advantage structure: Single scalar per sequence versus temporally-varying per-token advantages from GAE
- KL handling: Added as an explicit loss term rather than absorbed into per-token rewards, keeping the advantage calculation clean
- Estimator choice: The k3 KL estimator is unbiased, non-negative, and exhibits lower variance than log-ratio alternatives
Group Size Effects
Small groups (G = 2-4):
- Advantages become nearly binary: approximately ±1 for different outcomes, 0 for ties
- Standard deviation estimate is unreliable with high variance
- For binary rewards with pass rate
p, the probability of zero-variance groups (all pass or all fail) isp^G + (1-p)^G- At G=2, p=0.2: approximately 68% of groups yield no learning signal
- Many prompts produce no gradient updates
- Rare correct solutions on difficult problems may never be sampled
Adequate groups (G = 12-16):
- Baseline stabilizes, providing reliable advantage estimates
- Zero-variance probability drops dramatically: at G=16, p=0.2 gives ~3% dead groups
- Sufficient diversity to capture occasional correct solutions
- Tradeoff: requires G× more generation compute, making rollout the bottleneck
Part 2: Memory and Attention Architecture
Memory Footprint Comparison
Per-model costs for 70B parameters:
Inference only (bf16): 70B × 2 bytes = 140 GB
Trainable model (mixed-precision Adam):
- bf16 weights: 2 bytes/param
- bf16 gradients: 2 bytes/param
- fp32 master weights: 4 bytes/param
- Adam momentum + variance: 8 bytes/param
- Total: 16 bytes/param = 1,120 GB
Full system comparison:
| Component | Standard PPO | Critic-Free Approach |
|---|---|---|
| Policy network (trainable) | 1,120 GB | 1,120 GB |
| Critic network (trainable) | 1,120 GB | — |
| Reference policy (frozen) | 140 GB | 140 GB |
| Reward model (frozen) | 140 GB | — (rule-based) |
| Total | 2,520 GB | 1,260 GB |
This represents a 50% reduction in total memory requirements.
Practical implications:
- During generation: eliminates 140 GB of critic weights, freeing HBM for larger KV caches
- During training: saves ~1,120 GB of optimizer states and gradients (roughly 14 H100-80GB GPUs worth of sharded memory)
- Reference policy can be offloaded to CPU or its log-probabilities precomputed once per batch
Latent Attention vs. Standard Attention
Consider a Llama-style 70B architecture: 80 layers, 8 KV heads, head dimension 128.
Standard grouped-query attention:
Cache per token = 2 (K,V) × 8 heads × 128 dim × 80 layers × 2 bytes
= 327,680 bytes ≈ 320 KB/token
Multi-head latent attention (MLA): Caches a compressed 512-dimensional joint latent plus a 64-dimensional RoPE key per layer:
Cache per token = (512 + 64) dim × 80 layers × 2 bytes
= 92,160 bytes ≈ 90 KB/token
Compression ratio: ~3.6×
Concrete example: 16 sequences × 16K tokens = 262,144 tokens
| Attention Type | Total KV Cache |
|---|---|
| Grouped-query | ~84 GB (exceeds single 80GB GPU) |
| Latent | ~24 GB |
Benefits of latent compression:
- Capacity: ~3.6× more concurrent sequences or ~3.6× longer context in same memory budget
- Throughput: Decode is memory-bandwidth limited; smaller cache directly increases tokens/second
- Sharing: All G group members share the prompt's cached latents
- Integration: Decompression matrices fold into existing query/output projections
Important caveat: This is an architectural choice made during pretraining. Retrofitting an existing model requires extensive retraining and should not be attempted as a post-training modification.
Part 3: Reward Design and Failure Modes
Composite Reward Function
R(o) = R_correctness(o) + λ · R_structure(o), λ ∈ [0.1, 0.2]
Correctness component (R_correctness ∈ {0, 1}):
- Mathematics: symbolic equivalence via computer algebra (e.g., SymPy comparison after simplification)
- Code: execute against hidden test suites in sandboxed environment with resource limits
- Unparseable outputs receive 0
Structure component (R_structure ∈ {0, 1}):
- Validates presence of required formatting (reasoning tags, answer delimiters)
- Checks for exactly one reasoning section followed by final answer
- No extraneous text outside designated sections
Keep λ small to ensure well-formatted incorrect answers (0.2) are always dominated by correct answers (1.0+). Never use learned reward models for correctness verification—this creates reward hacking vulnerabilities.
Failure Mode 1: Length Exploitation
Mechanism:
The 1/|o_i| normalization dilutes per-token gradients for longer sequences. When advantage is negative (incorrect answer), spreading the penalty across more tokens reduces per-token gradient magnitude. This creates an incentive to generate longer outputs when uncertain.
Symptoms:
- Average response length increases while accuracy plateaus or declines
- Increased truncation at maximum length limits
- Rambling, repetitive reasoning that never reaches a conclusion
Mitigation strategies:
- Token-level aggregation: Remove sequence-length normalization and average over all tokens in the batch uniformly
- Direct length penalty: Add explicit reward shaping:
R_length = max(0, 1 - (len - target) / margin)that ramps from 0 to -1 - Separate length regularization: Include
λ_len · (len(o_i) / target_len)as an additive penalty term in the loss
Failure Mode 2: Entropy Collapse
Mechanism:
The policy distribution sharpens too aggressively, causing all G samples from a prompt to become nearly identical. This creates zero-variance groups where σ ≈ 0, eliminating the learning signal. The model gets stuck in repetitive loops.
Symptoms:
- Rapidly decreasing output diversity (measured by n-gram overlap within groups)
- High percentage of groups with identical or near-identical completions
- Repetitive reasoning patterns without logical progression
Mitigation strategies:
- Entropy bonus: Add explicit entropy regularization to the loss:
λ_ent · H[π(·|context)]to maintain exploration - Temperature during sampling: Use temperature > 1.0 during group generation (rollout phase), even if training target is temperature 1.0
- KL coefficient annealing: Start with lower β values and gradually increase to allow initial exploration before enforcing proximity to reference
- Remove symmetric clipping: The clip operation limits how much low-probability exploratory tokens can be up-weighted; consider asymmetric clipping that constrains down-weighting more than up-weighting
Additional Considerations
Advantage normalization alternatives:
- Drop standard deviation division entirely, using only
r_i - mean(r)(simpler, removes variance weighting of different difficulty levels) - Normalize across the full batch rather than per-group to stabilize variance estimates
Monitoring metrics:
- Track per-group variance distribution to detect collapse
- Monitor length distributions and correlation with reward
- Measure diversity via self-BLEU or distinct n-gram ratios within groups