Balanced Aggregation: Understanding and Fixing Aggregation Bias in GRPO
Zhiyuan Zeng, Jiameng Huang, Zhangyue Yin, Jiashuo Liu, Ziniu Li, Bingrui Li, Yuhao Wu, Yining Zheng, Ge Zhang, Wenhao Huang, Xipeng Qiu
arXiv:2605.04077 · 2026-05-08 공개 · arXiv · PDF
Abstract
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 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.
한국어 요약
📋 한 줄 요약
**[LLM 강화학습 / RLVR]** GRPO에서 토큰·시퀀스 집계 방식의 편향을 분석하고, positive/negative 부분집합을 분리해 평균 내는 단순한 Balanced Aggregation으로 학습 안정성과 성능을 개선한다.
🎯 핵심 기여도
- GRPO에서 token aggregation과 sequence aggregation이 서로 다른 최적화 편향을 유발함을 명시적으로 분석: token aggregation은 부호-길이 결합, sequence aggregation은 긴 응답의 암묵적 다운웨이팅 발생
- positive와 negative 부분집합 내에서 각각 토큰 평균을 따로 구한 뒤 시퀀스 수 기반 가중치로 합치는 Balanced Aggregation(BA) 제안
- Qwen2.5-Math-7B와 Qwen3-1.7B 기반 DAPO-17k와 Polaris 학습에서 6개 추론·코딩 벤치마크 전반에 걸쳐 학습 안정성과 최종 성능을 일관되게 개선
- token aggregation과 sequence aggregation의 상대적 우위가 응답 길이 변동과 positive-negative 길이 격차에 의해 좌우됨을 실증해 집계 방식이 GRPO의 핵심 설계 축임을 강조
💡 핵심 아이디어
GRPO에서 그룹 내 정책 그라디언트를 어떻게 합하느냐는 단순한 구현 디테일이 아니라 학습 동역학에 본질적 편향을 만든다. 토큰 평균은 길이가 부호와 결합돼 길이 편향을, 시퀀스 평균은 긴 응답을 암묵적으로 깎는다. 양쪽 편향을 동시에 줄이려면 positive와 negative를 분리해 토큰 평균을 낸 뒤 시퀀스 수에 기반한 가중치로 합치면 된다.
🔬 기술적 접근법
- **모델/방법론**: Balanced Aggregation(BA) — GRPO 그라디언트 집계 규칙의 drop-in 대체
- **핵심 기법**: 그룹 내 응답을 보상 부호 기준으로 positive·negative 두 부분집합으로 나누고, 각 부분집합 안에서 토큰 단위 평균 그라디언트를 계산한 뒤 두 부분집합을 시퀀스 개수 기반 가중치로 결합. 응답 길이 변동과 positive-negative 길이 격차에 따라 발생하는 편향을 동시에 완화하면서도 구현은 매우 단순
📊 주요 결과
- Qwen2.5-Math-7B와 Qwen3-1.7B 기반 DAPO-17k·Polaris 학습에서 표준 token/sequence aggregation 대비 일관된 성능 향상
- 6개의 추론·코딩 벤치마크 전반에서 학습 안정성과 최종 성능 모두 개선
- aggregation 방식의 상대적 효과가 응답 길이 변동·길이 격차와 강하게 상관됨을 분석으로 확인
💭 의의 및 한계
**의의**: 광범위하게 채택된 GRPO 학습에서 흔히 간과되던 집계 규칙이 사실상 핵심 하이퍼파라미터임을 보이고, 추가 비용 없이 적용 가능한 강한 베이스라인을 제공한다. **한계**: 분석이 수학·코딩처럼 검증 가능한 보상 도메인 중심이며, 멀티턴·도구 사용 같은 보다 복잡한 환경에서도 동일한 균형이 최적인지에 대한 추가 검증이 필요하다.
🚀 실용적 활용
- 수학·코딩 RLVR 학습 파이프라인의 표준 GRPO 집계 규칙 교체
- 응답 길이 변동이 큰 추론 모델 학습 안정화 도구
- 자체 RL 학습 인프라에서 추가 비용 없이 적용 가능한 성능 개선 트릭