论LLM强化学习中训练-推理不匹配的起源与演化
研究论文 · 2026/11/02
大语言模型的同策略强化学习假设训练响应来自当前策略,但实际中推理引擎采样响应而训练器计算梯度,导致训练-推理不匹配,使数据偏离策略。不匹配有两个来源:引擎的数值差异和异步采样的陈旧权重,针对一种来源的校正可能在另一种下失效。我们通过评估采样器权重下的训练器,将每个采样令牌误差精确分解为数值差异和策略滞后,并追踪训练过程。数值差异近似恒定,导致固定偏差,可通过在每个前缀处中心化得分消除其主导偏差。策略滞后由训练器自身更新产生,其偏差进入下一次更新,扩大下一次滞后,形成反馈循环。重要性加权仅在滞后比集中时能切断该循环,在Qwen3-1.7B上,当有效样本量低于一半时失效。据此我们提出差异-滞后校正(DLC),中心化数值差异、根据采样器权重裁剪滞后比,并在有效样本量低于一半时重新同步采样器。在陈旧采样器下,DLC在Qwen3-0.6B和Qwen3-1.7B上将与同策略训练的KL散度保持在两次独立同策略训练间KL的两倍以内,其重新同步防止了逐令牌校正遗留的崩溃,而基于采样器前缀测量的KL无法检测到这种崩溃。
该研究深入分析了LLM强化学习中训练-推理不匹配的根源,提出了针对性的校正方法,并在多个模型上验证了其有效性,对提升异步强化学习的稳定性具有重要价值。
On-policy reinforcement learning for large language models assumes that training responses are sampled from the current policy. In practice, an inference engine samples the responses and a separate trainer computes the gradients, and the training-inference mismatch between the two makes the training data off-policy. The mismatch has two sources, the numerics of the engine and the stale weights of asynchronous sampling, and a correction that stabilizes training under one source can fail under the other. We ask which property of a mismatch source decides the correction it needs. Evaluating the trainer at the sampler's weights splits each sampled-token error exactly into a numerical discrepancy of the engine and a policy lag of the trainer, and we follow both through training. The numerical discrepancy stays approximately constant, so it biases the updates by a nearly fixed amount, and centering the score at each prefix removes its leading bias. The policy lag is produced by the trainer's own updates: the bias it leaves enters the next update, which enlarges the next lag and closes a feedback loop. Importance weighting cuts this loop only while the lag ratio stays concentrated, and on Qwen3-1.7B it fails at the step where the effective sample size of the ratio falls below one half. From this account we derive the discrepancy-lag correction (DLC), which centers the numerical discrepancy, clips the lag ratio against the sampler's weights and resynchronizes the sampler when this effective sample size falls below one half. Under a stale sampler, DLC keeps the KL divergence from on-policy training within twice the KL between two independent on-policy trainings on Qwen3-0.6B and Qwen3-1.7B, and its resynchronization prevents collapses that the per-token corrections leave and that a KL measured on the sampler's prefixes does not detect.