arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.01555cs.LGcs.AI
收藏

重新思考RLHF中的KL正则化:从价值估计到梯度优化

Rethinking KL Regularization in RLHF: From Value Estimation to Gradient Optimization

Kezhao Liu, Jason Klein Liu, Mingtao Chen, Yiming Liu

AI总结:

本研究构建统一框架分析RLHF中KL正则化的两种实现方式,证明同策略下部分形式梯度等价,指出GRPO采用的实现为有偏近似,还修正了异策略实现的偏差,为KL正则化的合理选择与实现提供梯度层面的理论支撑。

摘要:

基于人类反馈的强化学习(Reinforcement Learning from Human Feedback, RLHF)利用库尔贝克-莱布勒(Kullback-Leibler, KL)散度损失来稳定训练并防止过拟合。然而在GRPO等方法中,其实现可能受数值价值估计相关原则的指导,这种做法忽略了该项作为优化损失的功能作用。为分析这一问题,我们构建了一个统一框架,将两种看似截然不同的实现方式关联起来:一种是将数学项$k_n$作为策略得分函数的分离系数(“奖励中的$k_n$”),另一种是将其作为直接损失函数用于梯度传播(“$k_n$作为损失”)。我们证明后者始终可以通过前者中的等效梯度系数进行分析,从而统一了两种视角。通过该框架,我们证明传统的“奖励中的$k_1$”(如PPO中的实现)是反向KL(Reverse KL, RKL)正则化的原则性损失形式。我们进一步得到一项关键发现:在同策略(on-policy)条件下,“$k_2$作为损失”的公式实际上与“奖励中的$k_1$”梯度等价。这一等价性由本研究首次证明,确认了二者都是RKL目标的理论合理实现。相比之下,我们证明近期采用的“$k_3$作为损失”(如GRPO中的实现)仅仅是原则性损失的一阶有偏近似。此外,我们指出“$k_n$作为损失”方法的常见异策略(off-policy)实现因忽略重要性采样而存在偏差,并提出了一种原则性的修正方案。我们的发现为KL正则化的选择与正确实现提供了全面的、基于梯度的理论依据,为构建更鲁棒、更有效的RLHF系统铺平了道路。

英文摘要:

Reinforcement Learning from Human Feedback (RLHF) leverages a Kullback-Leibler (KL) divergence loss to stabilize training and prevent overfitting. However, in methods such as GRPO, its implementation may be guided by principles from numerical value estimation-a practice that overlooks the term's functional role as an optimization loss. To analyze this issue, we establish a unified framework that connects two seemingly distinct implementation styles: using the mathematical term $k_n$ as a detached coefficient for the policy's score function ('$k_n$ in reward') or as a direct loss function through which gradients are propagated ('$k_n$ as loss'). We show that the latter can always be analyzed via an equivalent gradient coefficient in the former, unifying the two perspectives. Through this framework, we prove that the conventional '$k_1$ in reward' (like in PPO) is the principled loss for Reverse KL (RKL) regularization. We further establish a key finding: under on-policy conditions, the '$k_2$ as loss' formulation is, in fact, gradient-equivalent to '$k_1$ in reward'. This equivalence, first proven in our work, identifies both as the theoretically sound implementations of the RKL objective. In contrast, we show that the recently adopted '$k_3$ as loss' (like in GRPO) is merely a first-order, biased approximation of the principled loss. Furthermore, we argue that common off-policy implementations of '$k_n$ as loss' methods are biased due to neglected importance sampling, and we propose a principled correction. Our findings provide a comprehensive, gradient-based rationale for choosing and correctly implementing KL regularization, paving the way for more robust and effective RLHF systems.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑