提出平衡聚合方法,解决大模型强化学习中响应长度偏差问题。
Balanced Aggregation: Understanding and Fixing Aggregation Bias in GRPO

- 按正负样本分别计算令牌均值,再用序列数量加权融合。
- 在六个推理与编码任务上,性能超越传统聚合方式。
- 适合做数学推理和代码生成的强化学习训练优化。
基于可验证奖励的强化学习(RLVR)已成为提升大语言模型推理与代码生成能力的核心范式,GRPO风格训练因其简洁高效被广泛采用。然而,一个关键设计尚未深入探讨:采样组内令牌级策略梯度项的聚合方式。标准GRPO使用序列聚合,而近期研究主张令牌聚合更优。我们发现这两种规则引入不同优化偏差:令牌聚合导致符号-长度耦合,序列聚合则通过序列级等权隐式降低长响应权重。为此,我们提出**平衡聚合(BA)**,一种简单即插即用的替代方案,其在正负样本子集内分别计算令牌级均值,并以序列数量为基础进行加权组合。在Qwen2.5-Math-7B和Qwen3-1.7B上,于DAPO-17k和Polaris数据集上,六个推理与编码基准测试表明,BA在训练稳定性和最终性能上持续优于标准令牌聚合与序列聚合。进一步分析显示,令牌与序列聚合的相对有效性主要由响应长度变化及正负样本长度差决定,凸显聚合方式在GRPO类RLVR中的关键设计地位。
原文摘要 · Abstract (English)
Reinforcement learning with verifiable rewards (RLVR) has become a central paradigm for improving reasoning and code generation in large language models, and GRPO-style training is widely adopted for its simplicity and effectiveness. However, an important design choice remains underexplored: how token-level policy gradient terms are aggregated within each sampled group. Standard GRPO uses sequence aggregation, while recent work has advocated token aggregation as a better alternative. We show that these two rules induce different optimization biases: token aggregation introduces sign-length coupling, while sequence aggregation implicitly downweights longer responses through sequence-level equal weighting. To address this tension, we propose \textbf{Balanced Aggregation (BA)}, a simple drop-in replacement that computes token-level means separately within the positive and negative subsets and then combines them with sequence-count-based weights. Experiments with Qwen2.5-Math-7B and Qwen3-1.7B on DAPO-17k and Polaris, evaluated on six reasoning and coding benchmarks, show that BA consistently improves training stability and final performance over standard token and sequence aggregation. Our analysis further shows that the relative effectiveness of token and sequence aggregation is largely governed by response-length variation and the positive-negative length gap, highlighting aggregation as a critical design dimension in GRPO-style RLVR.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。