提出更稳定准确的KL散度估计方法,解决语言模型对比中的方差难题。
Better Estimation of the Kullback--Leibler Divergence Between Language Models
- 采用Rao-Blackwell化改进采样估计,降低方差并保证无偏性。
- 实验显示新方法在情感控制微调中显著减少估计波动。
- 适用于强化学习、知识蒸馏等需精确比较模型的场景。
估计语言模型间的Kullback--Leibler (KL) 散度在强化学习从人类反馈(RLHF)、可解释性和知识蒸馏等领域有广泛应用。然而,计算任意两个语言模型间精确的KL散度是不可行的。因此,实践者通常依赖基于采样的估计器。尽管简单的蒙特卡洛(MC)估计器能提供无偏估计,但其方差极大,甚至可能出现负值(非负量),严重影响可靠性。本文提出一种无偏且方差不超过标准蒙特卡洛估计器的Rao--Blackwellized估计器。在情感控制微调的实证研究中,新方法显著提升了KL估计的稳定性并大幅降低方差。此外,我们还推导出KL散度梯度的类似Rao--Blackwellized估计器,使训练过程更稳定,并生成更多位于奖励与KL权衡前沿的模型,优于使用传统MC梯度估计器训练的结果。
原文摘要 · Abstract (English)
Estimating the Kullback--Leibler (KL) divergence between language models has many applications, e.g., reinforcement learning from human feedback (RLHF), interpretability, and knowledge distillation. However, computing the exact KL divergence between two arbitrary language models is intractable. Thus, practitioners often resort to sampling-based estimators. While it is easy to fashion a simple Monte Carlo (MC) estimator that provides an unbiased estimate of the KL divergence between language models, this estimator notoriously suffers from high variance and can even result in a negative estimate of the KL divergence, a non-negative quantity. In this paper, we introduce a Rao--Blackwellized estimator that is unbiased and provably has variance less than or equal to that of the standard Monte Carlo estimator. In an empirical study on sentiment-controlled fine-tuning, we show that our estimator provides more stable KL estimates and reduces variance substantially. Additionally, we derive an analogous Rao--Blackwellized estimator of the gradient of the KL divergence, which leads to more stable training and produces models that more frequently appear on the Pareto frontier of reward vs. KL compared to the ones trained with the MC estimator of the gradient.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。