Groupwise Agentic Grading and Advantage Redistribution for Code Agent RL
Organizations: LLM Core, Xiaomi · Renmin University of China · Peking University · University of Hong Kong
Abstract
Reinforcement learning (RL) for code agents often uses executable tests to provide binary rewards. With these rewards, Group Relative Policy Optimization (GRPO) assigns identical advantages to test-passing trajectories within each rollout group, overlooking differences in implementation quality and adherence to task requirements. This leaves the policy without a learning signal that favors clean, targeted implementations over those containing unnecessary or out-of-scope changes. We introduce GAGAR, a framework for quality-aware credit redistribution in code agent RL. Built on dynamic sampling that retains groups containing both passing and failing trajectories, GAGAR places all trajectories from each group in a shared workspace, where an SFT-trained agentic grader jointly inspects them and ranks the test-passing candidates. Based on this ranking, we downweight lower-ranked trajectories and proportionally rescale the advantages of all test-passing trajectories to restore their original sum. This sum-preserving redistribution retains the relative weights established by quality-based downweighting while shifting credit toward higher-quality implementations. We evaluate GAGAR at industrial scale using pre-RL SFT checkpoints of MiMo-V2.6-Flash (310B total parameters) and MiMo-V2.6-Pro (1.02T total parameters). Controlled code-only Flash experiments show improved code agent performance, reduced trajectory-length growth, and more stable training. We further apply GAGAR in large-scale mixed-task RL with both Flash and Pro. Our results support combining test-based verification with groupwise agentic grading to improve the quality and stability of code agent RL.
Figures & tables
| Model | DeepSWE | SWE-bench Pro |
|---|---|---|
| K3 | 69.0 | 63.3 |
| GPT-5.6 Sol | 73.0 | 60.5 |
| Claude Opus 5 | 74.0 | 79.9 |
| MiMo-V2.6-Flash | 67.9 | 60.9 |
| MiMo-V2.6-Pro | 71.9 | 62.7 |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
| Dimension | Higher-Quality Signals | Lower-Quality Signals |
|---|---|---|
| Approach Suitability | Root-cause resolution Appropriate solution strategy | Symptom-level workarounds Fundamentally flawed strategy |
| Implementation Precision | Correct change locations Complete behavior coverage | Scattered special cases Redundant fallback logic |
| Minimality Of Changes | Necessary implementation edits Task-scoped changes | Unrelated refactoring Redundant helpers or branches |
| Unintended Side Effects | Preserved surrounding behavior Stable public interfaces | Unrelated behavior changes New risks in core code paths |
| Codebase Consistency | Reuse of existing abstractions Consistent code conventions | Ad hoc mechanisms Inconsistent style or comments |
RL for Code Generation
Reinforcement learning for code generation trains models to write, repair, and optimize programs using execution-based and other task-specific feedback.
See all 149 papers