TL;DR for operators

A code agent can produce two patches that pass the same tests while differing sharply in precision, scope, side effects, and consistency with the repository. Gagar1 keeps executable tests as the success gate, but adds an agentic grader to rank the quality of successful implementations.

The less obvious contribution is what happens after grading. Simply reducing the reinforcement assigned to weaker successful trajectories also reduces the group’s total positive credit. In the paper’s ablation, that design was accompanied by much faster growth in policy entropy and rollout length. Gagar instead redistributes positive advantage so better successful trajectories receive more relative credit while the original positive-credit total is preserved in the exact formulation.

For organizations training production coding agents, the reported combination is relevant to three decisions: whether to optimize beyond pass rate, whether quality supervision can reduce interaction and token cost, and whether the resulting RL process remains stable enough for expensive large-scale training. The evidence is encouraging but narrow: the strongest controlled results come from MiMo-V2.6-Flash on DeepSWE v1.1 and SWE-bench Pro, the independent quality audit covers 30 DeepSWE tasks, and the grader itself adds substantial computation.

A passing patch can still be the wrong lesson

Suppose a coding agent generates several solutions for the same repository task. Two pass every executable test. One changes the smallest necessary surface, follows existing abstractions, and preserves surrounding behavior. The other adds fallback branches, touches unrelated code, and introduces mechanisms that will cost reviewers more time to understand.

A binary reward treats those two successful trajectories alike.

That becomes a training problem rather than merely an evaluation problem. If reinforcement learning repeatedly gives identical positive credit to materially different successful implementations, the model receives little incentive to prefer the one a maintainer would actually want merged.

A natural response is to score implementation quality and reduce credit for the weaker passing patches. The paper shows why that apparently straightforward move creates another problem.

In its redistribution ablation, quality downweighting without redistribution saw policy entropy rise from 0.359 to 0.905 over 30 training steps, while mean rollout length grew from 47.1k to 114.1k tokens. With the full redistribution method, entropy moved from 0.358 to 0.513 and rollout length from 46.5k to 69.9k.

The distinction is not merely whether the training system knows which passing patch is better. It is whether expressing that preference unintentionally changes the balance between positive and negative reinforcement.

The grader ranks successful implementations, not success itself

Gagar leaves executable tests in charge of the primary outcome. Invalid trajectories and confirmed hacks are handled before quality grading, and only valid test-passing implementations receive quality rankings.

The groupwise grader is given considerably more context than a static patch scorer. It can inspect the task specification, repository, complete trajectories, submitted patches, and test outputs, and can perform targeted execution checks when additional evidence is needed.

Successful candidates are assessed across five dimensions:

Dimension Higher-quality behavior
Approach suitability Addresses the root cause with an appropriate strategy
Implementation precision Changes the correct locations and covers the required behavior
Minimality Keeps edits necessary and task-scoped
Side effects Preserves unrelated behavior and stable interfaces
Codebase consistency Reuses existing abstractions and conventions

This division of labor is important. Tests determine whether a trajectory succeeded. The grader asks which successful trajectory should be reinforced more strongly.

That design avoids making an LLM evaluator the sole authority over functional correctness while still allowing training to incorporate properties that executable tests may not capture.

Quality weighting needs a credit budget

Under the paper’s mean-centered binary reward setup, successful trajectories in a mixed group initially receive the same positive advantage. Let those original advantages be $A_i$, and let the grader assign each successful trajectory a quality factor $f_i$.

Multiplying $A_i$ by $f_i$ creates the desired ordering: weaker passing solutions receive less credit. But if the factors are discounts, the total positive advantage also falls while failed trajectories retain their negative advantages. The group therefore becomes more negatively weighted overall.

Gagar adds a shared multiplier:

$$ \lambda= \frac{S_{+}} {\sum_{j\in\mathcal{P}} f_j A_j}, $$

and transforms successful trajectories as

$$ A_i^{\star}=\lambda f_i A_i. $$

Failed trajectories retain $A_i$ in the exact formulation.

Because every successful trajectory receives the same $\lambda$, their relative quality ratios remain intact. Because $\lambda$ restores the original positive sum $S_+$, quality differentiation does not reduce the group’s aggregate positive reinforcement.

This is the paper’s central optimization contribution: ranking successful behavior and maintaining the positive-credit budget are treated as separate requirements.

The practical training implementation adds a cap on $\lambda$ and then re-centers the group. When that cap activates, zero mean is restored, but the original positive sum and failed-trajectory advantages are no longer guaranteed to remain exactly unchanged. The clean conservation result therefore describes the unbounded formulation, not every realized training update.

The controlled results connect quality, efficiency, and stability

At training step 28 on DeepSWE v1.1, Gagar reached a 62.2% pass rate versus 50.2% for binary-outcome training. Gagar later reached 63.4% at step 44.

At the shared step-28 checkpoint, mean interaction turns fell from 132.3 to 111.6, a reported 15.6% reduction, while mean trajectory length fell from 191.9k to 172.9k tokens, a 9.9% reduction.

The SWE-bench Pro comparison points in the same operational direction. Mean turns fell from 58.4 to 54.6 and token length from 79.9k to 68.6k at the corresponding comparison, while continued Gagar training eventually reached a 62.5% pass rate at step 52.

The separate blinded DeepSWE quality audit is useful because it tests whether benchmark gains were accompanied by changes in the implementations themselves. On 30 randomly sampled tasks, Gagar received a mean quality score of 4.03 versus 3.70 for the baseline, a 69.8% average win rate among passing candidates, and a 65.0% group-first share after splitting cross-method ties. The highest quality tier contained 34.3% of Gagar candidates versus 25.4% of baseline candidates.

The redistribution ablation sharpens the mechanism claim. At DeepSWE step 28, the downweighting-only variant achieved 56.2% with 143.5 mean turns and 236.0k mean tokens, compared with 62.2%, 111.6 turns, and 172.9k tokens for the full method.

That experiment does not establish that reward shaping generally destabilizes RL. It isolates a narrower failure mode: reducing positive advantages according to quality without compensating for the removed positive credit.

The production case is about review cost as well as pass rate

For teams deciding whether to deploy code agents into repository workflows, pass rate is only one cost center.

A patch that requires less reviewer interpretation, fewer corrective iterations, and fewer unnecessary repository changes can reduce integration burden even when another candidate passes the same tests. The paper’s quality rubric therefore aligns with several properties that production engineering organizations already inspect during code review.

The reductions in interaction turns and tokens also create a plausible pathway to lower serving cost, latency, and queue pressure when agents operate at scale. This is a Cognaptus inference from the reported efficiency measures, not a measured dollar-return calculation in the paper.

For teams training their own code-agent models, the stability result may be equally consequential. Late-stage degradation in an expensive RL run can waste substantial compute. The ablation suggests that quality-aware credit assignment should be evaluated not only by whether it improves preferred behavior, but also by whether it preserves the aggregate reinforcement structure that kept the original training process stable.

Repository-aware grading could therefore become part of the training-control layer: tests verify functional completion, while a richer evaluator expresses which successful implementations are worth reproducing.

The grader is also part of the cost structure

The additional supervision is not free.

The authors report reducing average group grading time from roughly 2,000 seconds with an initial Claude Opus 5 implementation to roughly 600 seconds with their SFT-trained grader. That is a substantial improvement, but still material infrastructure overhead.

The strongest controlled evidence also remains concentrated in MiMo-V2.6-Flash and two repository-level coding benchmarks. The blinded implementation-quality audit covers 30 DeepSWE tasks, and the paper reports checkpoint trajectories rather than statistical uncertainty intervals around the major performance differences.

Industrial mixed-task RL results for MiMo-V2.6-Flash and MiMo-V2.6-Pro show that the method can be integrated into much larger heterogeneous training workloads. Those results demonstrate applicability at scale; they do not isolate Gagar’s marginal contribution as cleanly as the controlled code-only comparison and redistribution ablation.

So the deployment question is not whether every coding system should add an expensive grader. It is whether, for a training program where implementation quality and training stability justify the extra evaluator cost, richer supervision can be incorporated without accidentally weakening the learning signal.

Gagar’s answer is architectural: retain executable success, judge quality among successes, and preserve the positive-credit budget while redistributing who receives it.

That separation may be more consequential than the grader itself.

Cognaptus: Automate the Present, Incubate the Future.


  1. Jinhao Dong and Liang Zhao and Zihao Yue and Wenhan Ma and Linghao Zhang and Lei Li and Shicheng Li and Yifan Song and Bowen Ye and Fuli Luo (2026). Groupwise Agentic Grading and Advantage Redistribution for Code Agent RL. arXiv:2609.32577. https://arxiv.org/abs/2609.32577 ↩︎