GCD: Correcting Hidden-State Bias in Off-Policy Agentic RL

Changyuan Chen, Jianyu Xiang, Jiasheng Luo, Ziye Wang, Nallappan GunasekaranNeurIPS 2026

TL;DR

When training LLM agents with reinforcement learning, reusing old memory (the KV cache) across weight updates saves massive amounts of compute—but it silently corrupts the math by creating a "hybrid" policy that neither old nor new weights actually represent. Because every standard diagnostic is blind to this shift, training mysteriously collapses when data gets too stale. The authors introduce Gradient-Coupled KV Drift (GCD), a lightweight method that estimates and divides out this hidden bias for most tokens, selectively recomputing only the tricky ones to keep training rock-solid at double the previous staleness limits.

What Problem Does This Paper Address?

Training LLMs to reason and use tools via Reinforcement Learning (RL) has hit a wall: generating long, multi-turn agent trajectories (the "rollout" stage) takes way longer than actually updating the model's weights. Every time the weights update, the Key-Value (KV) cache—the stored memory of past tokens for trajectories still in progress—technically becomes obsolete. Recomputing a multi-thousand-token prefix from scratch after every update is brutally expensive, so production frameworks aggressively reuse the stale KV cache anyway.

To keep off-policy training stable, standard RL algorithms reweight gradients using importance ratios: the probability of a token under the new policy divided by its probability under the old policy ($\pi_{\theta_{\text{new}}} / \pi_{\theta_{\text{old}}}$). Here lies the hidden trap. When you run a forward pass with updated query and MLP weights, but read stale keys and values from the cache, you aren't computing $\pi_{\theta_{\text{new}}}$. You are computing a Frankenstein hybrid distribution ($\pi_{\text{hyb}}$).

The log-probability gap between $\pi_{\text{hyb}}$ and the true $\pi_{\theta_{\text{new}}}$ is what the authors call hidden-state bias. Worse, standard importance ratios are completely blind to it: $\pi_{\text{hyb}} / \pi_{\theta_{\text{old}}}$ looks like a mathematically well-behaved ratio, just aimed at the wrong target policy. Clipping, KL penalties, and variance bounds all fail to catch it, causing state-of-the-art methods like M2PO to suddenly collapse once cache staleness exceeds ~256 updates.

Figure 2: Why reusing a stale cache fails, and how GCD budgets the fix. (a) The old policy writes the cache and the new query reads it after s updates, so the ratio is computed on πhyb while the target is πθnew. (b) Inside one token, query and output are new while keys and values are old. Peaked attention makes stale entries unsafe to reuse; spread attention leaves them safe. (c) GCD detects tail tokens, gauges drift per layer, and recomputes only what it flags. Thumbnails, heat maps, and charts are illustrative; token shares and 1.9% extra cost are measured on Qwen3.5-9B at staleness 512.

Methods

Instead of trying to enforce a worst-case mathematical bound—which falls apart the moment an attention head lasers in on a single drifted token—the authors build an exception-safe framework called Gradient-Coupled KV Drift (GCD). It works in three steps:

  1. Cheap Bias Estimation (The Drift Gauge): To first order, a token's hidden-state bias equals how far the weights moved times how much the token leans on stale context. GCD estimates this per layer using statistics already lying around during training: 3 steps of power iteration for weight movement ($\|\Delta W\|_{\text{op}}$) multiplied by attention entropy (how spread out the attention is). For hybrid models with recurrent layers (like Qwen3.5's Gated DeltaNet), it adds a state-decay term based on the recurrence's spectral radius.
  2. Dividing Out the Bias: On expectation, the bias is a KL divergence, meaning its average sign is strictly non-negative. GCD simply divides this estimated drift out of the importance weight: $w_t^{\text{GCD}} = (\pi_{\text{hyb}} / \pi_{\theta_{\text{old}}}) \cdot \exp(-\hat{b}_t)$. This cleanly composes with existing trust-region methods like M2PO and GRPO.
  3. Tail-Event Detection & Selective Recompute: When a token's attention is sharply peaked on one cached position, entropy is near zero, causing the first-order estimate to under-predict the true drift. A lightweight detector flags tokens with spiky attention (high max-attention weight or low entropy) or excessive layer drift. Only for these flagged tokens does GCD selectively refresh the top-$k$ attended KV positions (or re-roll recurrent states from a clean checkpoint).

Datasets

No new benchmarks are introduced. The authors train and evaluate on two established benchmarks:

  • MATH-500: Used to test complex mathematical reasoning and training stability across extreme staleness regimes.
  • $\tau$-bench (Retail and Airline domains): A canonical agentic benchmark featuring multi-turn tool use and long trajectories (thousands of tokens), evaluated using $\text{pass}^k$ reliability (solving a task across all $k$ attempts).

Key Insights and Ideas

  • Standard RL diagnostics are flying blind: Metrics like clip fraction, effective sample size, and second moments ($\mathbb{E}[w_t^2]$) look totally healthy during naive KV reuse because the estimand itself has quietly shifted, not the variance.
  • Bias concentrates where the agent actually "thinks": System prompts and tool outputs suffer negligible bias (< 0.005 nats), whereas active agent-reasoning tokens exhibit an order-of-magnitude higher drift (~0.03 nats). When confident, attention is sharp; when reasoning, attention disperses across stale context, pulling in drift.
  • Full attention is the main culprit in hybrid stacks: In Qwen3.5-9B, full-attention layers make up only 25% of the network (interleaved 1:3 with recurrent DeltaNet layers), yet they carry 72–77% of the total hidden-state bias.
  • It’s true bias correction, not secret regularization: A clever control experiment ("matched-mean damping") shrank all token weights uniformly by the same average amount as GCD. It matched GCD on surface-level weight-health metrics, yet failed to replicate GCD's downstream accuracy gains—proving that per-token, structure-aware correction is doing the heavy lifting.

Key Results

Bias growth with staleness and training stability on MATH-500 and tau-bench.

Bias growth with staleness and training stability on MATH-500 and tau-bench.
  • Breaking the Staleness Ceiling: On Qwen3.5-9B with MATH-500, M2PO collapses to 48.1% accuracy at a staleness of 512 updates. M2PO+GCD holds 67.1%, and even survives out to staleness 1024 (59.4% across 4/5 seeds) where all baselines diverge.
  • Agentic Reliability: On $\tau$-bench retail ($\text{pass}^4$), M2PO+GCD beats M2PO by +5.7 points at staleness 256 (44.1% vs. 38.4%) and +18.9 points at staleness 512.
  • Sharp Ratio Correction & Tiny Overhead: GCD slashes importance-ratio log-error relative to exact recompute by 46–56%. At staleness 512 on Qwen3.5-9B, selective recompute adds just 1.9% extra FLOPs, boosting rollout throughput 1.38$\times$ over full recompute (and 1.15$\times$ over naive reuse by enabling 3$\times$ larger stable batch sizes).
  • Pure Transformer Transfer: On Llama-3.1-8B (100% full attention), GCD remains stable at staleness 512 on MATH-500 while M2PO diverges across all seeds, running 1.27$\times$ faster than full recompute (though 5% slower than naive reuse since there are no recurrent layers to dilute KV refresh costs).

Limitations and Future Work

  • Single-Node & Dense Models Only: Experiments are scoped to single-node setups (4$\times$H100s) on dense models (Qwen3.5 2B–9B, Llama-3.1-8B). Mixture-of-Experts (MoE) models introduce routing staleness—old tokens routed to different experts under new weights—which GCD does not model.
  • Bounded Weight Updates Required: GCD's first-order Taylor expansion assumes moderate weight steps. At staleness 1024, an outlier batch with $\|\Delta W\|_{\text{op}} = 1.7$ flagged 87% of tokens, causing selective recompute to be skipped and diverging one seed.
  • Correct on Average, Not Per-Token: Because $\hat{b}_t \ge 0$, GCD nudges the ~24–29% of tokens that happen to have negative true bias slightly the wrong way, winning via the overall expectation.
  • Future Directions: Extending drift estimation to MoE router staleness, handling large weight jumps ($\|\Delta W\|_{\text{op}} > 1$), and integrating directly into distributed, cross-node asynchronous RL schedulers.

Summary updated

BibTeX
@inproceedings{chen2026gcd,
  author = {Changyuan Chen and Jianyu Xiang and Jiasheng Luo and Ziye Wang and NALLAPPAN GUNASEKARAN},
  title = {{GCD: Correcting Hidden-State Bias in Off-Policy Agentic RL}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=GHjzEOgABS},
}
Figure