解决大模型推理中响应长度变化导致的训练不稳定问题
VL Norm: Rethink Loss Aggregation in RLVR
- 基于长度相关方差最小化,设计无偏且低方差的损失归一化方法
- 在不同模型规模和任务上均实现更优性能,最快提速2.67倍
- 代码简洁易用,可无缝集成到现有强化学习框架中
我们提出VL Norm(方差减少的长度相关归一化),一种针对强化学习中可验证奖励(RLVR)动态生成长度特性的简单而有效的损失聚合方法。近年来,RLVR在提升大语言模型推理能力方面展现出巨大潜力,但训练中响应长度变化剧烈,导致梯度方差高、优化不稳定。尽管先前方法如GRPO、DAPO和Dr. GRPO引入不同归一化项,仍存在估计偏差或高方差问题。通过理论与实证分析长度对策略损失的影响,我们将问题重构为寻找最小方差无偏估计器。所提方法不仅提供真实策略损失的无偏估计,理论上也最小化梯度方差。此外,仅需不足10行代码即可实现。大量实验表明,其在不同模型规模、最大长度和任务上均表现更优。集成至前沿算法DAPO后,在CountDown任务上收敛速度最快提升2.67倍。代码已开源:https://github.com/zerolllin/Delta-L-Normalization。
原文摘要 · Abstract (English)
We propose VL Norm (Variance-reduced Length-dependent Normalization), a simple yet effective loss aggregation method tailored to the characteristic of dynamic generation lengths in Reinforcement Learning with Verifiable Rewards (RLVR). Recently, RLVR has demonstrated strong potential in improving the reasoning capabilities of large language models (LLMs), but a major challenge lies in the large variability of response lengths during training, which leads to high gradient variance and unstable optimization. Although previous methods such as GRPO, DAPO, and Dr. GRPO introduce different loss normalization terms to address this issue, they either produce biased estimates or still suffer from high gradient variance. By analyzing the effect of varying lengths on policy loss both theoretically and empirically, we reformulate the problem as finding a minimum-variance unbiased estimator. Our proposed VL Norm not only provides an unbiased estimate of the true policy loss but also minimizes gradient variance in theory. Besides, VL Norm is easy to implement with less than 10 lines of code change. Extensive experiments show that it consistently achieves superior results across different model sizes, maximum lengths, and tasks. When integrated into the state-of-the-art RL algorithm DAPO, it achieves up to 2.67x faster convergence on the CountDown task. Our code is public at https://github.com/zerolllin/Delta-L-Normalization.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。