arXiv:2512.21852cs.LGcs.AI2025-12被引 18

研究强化学习训练大模型时KL正则化估计方法的影响,发现无偏估计更稳定、效果更好。

A Comedy of Estimators: On KL Regularization in RL Training of LLMs

  • 对比不同KL估计方式对梯度偏差的影响,揭示设计选择如何影响训练
  • 在同策略设置下,无偏估计使模型在分布内和分布外任务上表现更优
  • 异步离策略训练中,KL正则化有助于提升稳定性,适合实际部署场景

大语言模型的推理能力可通过强化学习(RL)显著提升。其训练目标包含一个正则项,即训练策略与参考策略之间的反向Kullback-Leibler(KL)散度。由于精确计算KL散度不可行,实践中常使用基于在线样本的多种估计器来近似。尽管广泛应用,包括多个开源库中,但尚未有系统性研究分析这些估计器在目标函数中的整合方式及其对下游性能的影响。近期研究表明,现有实现方式并未提供所声称目标的正确梯度,造成目标与实现间的不一致。本文进一步分析多种估计器配置的梯度特性,揭示设计选择如何导致梯度偏差。通过在 exttt{Qwen2.5-7B}、 exttt{Llama-3.1-8B-Instruct} 与 exttt{Qwen3-4B-Instruct-2507} 上进行RL微调,并评估其在分布内与分布外任务上的表现,我们发现:在同策略设置下,具有偏差梯度的估计配置会导致训练不稳定;而采用无偏梯度的配置则在分布内及分布外任务上均取得更优性能。此外,在异步离策略设置中,我们观察到KL正则化有助于稳定训练。

原文摘要 · Abstract (English)

The reasoning performance of large language models (LLMs) can be substantially improved by training them with reinforcement learning (RL). The RL objective for LLM training involves a regularization term, which is the reverse Kullback-Leibler (KL) divergence between the trained policy and the reference policy. Since computing the KL divergence exactly is intractable, various estimators are used in practice to estimate it from on-policy samples. Despite its wide adoption, including in several open-source libraries, there is no systematic study analyzing the numerous ways of incorporating KL estimators in the objective and their effect on the downstream performance of RL-trained models. Recent works show that prevailing practices for incorporating KL regularization do not provide correct gradients for stated objectives, creating a discrepancy between the objective and its implementation. In this paper, we further analyze these practices and study the gradients of several estimators configurations, revealing how design choices shape gradient bias. We substantiate these findings with empirical observations by RL fine-tuning \texttt{Qwen2.5-7B}, \texttt{Llama-3.1-8B-Instruct} and \texttt{Qwen3-4B-Instruct-2507} with different configurations and evaluating their performance on both in- and out-of-distribution tasks. Through our analysis, we observe that, in on-policy settings: (1) estimator configurations with biased gradients can result in training instabilities; and (2) using estimator configurations resulting in unbiased gradients leads to better performance on in-domain as well as out-of-domain tasks. We also investigate the performance resulting from different KL configurations in off-policy settings and observe that KL regularization can help stabilize off-policy RL training resulting from asynchronous setups.

强化学习大模型训练KL正则化梯度偏差

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。