WorksComputer Science
CodeLift: Your Test Suite Is Secretly a Dense SWE Curriculum
Abstract
The pass-all-test binary reward has become a standard recipe for training software engineering agents, but its sparsity eliminates difference of partially correct patches. The test pass-rate is a natural alternative. However, we find that it is not a reliable indicator of patch quality. A functionality being tested can be covered by either one challenging test or one hundred trivial tests, where the majority might be already satisfied pass-to-pass tests. We introduce CodeLift, a reinforcement learning method that dynamically calibrates pass-rate rewards, turning the test suite into an adaptive curriculum. At each iteration, CodeLift groups tests that kill the same patches and patches that pass the same tests, then gives more weight to test groups that fewer patch groups pass. This reduces the impact of majority simple tests and focuses more on what is still challenging. Within each rollout, CodeLift applies the same scoring rule to repository snapshots, assigning credit to useful actions even when later ones introduce regressions. Experiments on SWE benchmarks show that CodeLift consistently improves pass@1/2/4/8 over binary and pass-rate baselines. Analyses show that CodeLift provides dense, stable learning signals and unlocks the inherent curriculum in the test suite.
Introduction
Large language model (LLM) agents have made notable progress in software engineering (SWE) ([10, 9]), where reinforcement learning with verifiable rewards (RLVR) served as a key contributor ([19, 17]). To solve an issue, the SWE agents typically navigate the repository, edit code, and run tests, where the final patches are used as the final answer to be verified. The standard recipe uses pass-all-test as a verifier, providing binary reward based on whether the final patch passes all hidden tests. While it is sound, its binary value is too sparse to distinguish the patches that partially resolve the issue from those that break existing functionality Thus, on challenging problems where all patches in a rollout group for the same issue fail, there is no learning signal from relative advantage, making training inefficient.
The test pass-rate is a natural denser alternative. However, a higher pass-rate does not always mean a better patch. In competitive programming, recent studies show that the pass-rate does not achieve a higher performance ceiling than the binary reward, as it may reinforce shortcuts (e.g., brute-force heuristics) ([11]). In SWE agentic coding, we find it even worse, as the pass rate may eventually lead to collapse (Figure 3). We identify three test-weighting imbalances behind such miscalibration. (1) Multiplicity imbalance: In practice, different test cases may check the same functionality and fail together when it is violated. A patch with a higher pass rate may fix only a few functionalities covered by many tests, while breaking many others covered by fewer tests. Thus, such test multiplicity can introduce reward biases, as a patch satisfying fewer functionalities might get more rewards. (2) Progress-regression imbalance: Most repository tests are regression tests that already pass and protect existing functionality [12] (pass-to-pass, P2P), while only a few hidden tests initially fail and check the requested progress (fail-to-pass, F2P). Under pass-rate rewards, the penalty for introducing P2P regressions can outweigh the reward for progress on F2P tests, discouraging agents from making changes. (3) Difficulty imbalance: Pass rate assigns equal weight to tests of different difficulty. When easy tests dominate the suite, a patch can get a high reward while still failing the challenging ones. In contrast, the progress on the hard tests can only affect a small proportion of the total reward.
Figure 3. Training dynamics. Scores monitored during training: (a,b) SWE-bench Verified scores (every 10 steps) and (c) R2E-Gym training rollouts (10-step moving average).
We introduce CodeLift, a reinforcement learning method that dynamically calibrates pass-rate through behavior balancing at each training step. The core idea is to use observed behavior of tests and patches to reduce pass-rate’s weighting imbalance by grouping tests killing the same patches and patches passing the same tests. Inspired by mutation testing theory DeMillo et al., [4], CodeLift uses different patch groups as empirical contrast sets, and estimates each test group’s current difficulty by the fraction of patch groups they kill. After that, it normalizes these weights across test groups, and then computes each patch’s reward as the sum of the weights of the groups it passes. This process naturally introduces an adaptive curriculum: all-pass tests and all-fail tests are classified to two distinct groups, while tests with distinguishable behaviors are classified into separate groups. As the policy improves during training, CodeLift updates the groups and their weights, giving less weight to easier groups and more to harder ones. For example, all-pass tests receive zero weight, with the remaining weights renormalized to keep scores in and keep weight sum to 1. If some patches later regress, the affected tests regain weight, rewarding patches that still pass and lowering the relative advantages of those that fail.
CodeLift further refines credit assignment through snapshot slicing, applying the same scoring rule used for final patches to intermediate repository states. The intuition is: when agents test their edits, they might be checking whether current changes work, making self-testing a natural checkpoint for evaluating the progress so far. If a rollout ended at that point, its cumulative edits would form a candidate final patch. CodeLift compares the snapshot’s score with the final patch’s score, adding the relative difference to the final advantage for the corresponding slice. Thus, it can assign credit to intermediate actions with progress even when later steps introduce regressions.
We evaluate CodeLift on SWE-bench Verified Jimenez et al., [10] and SWE-bench Pro Deng et al., [5] Python subset, using Qwen3-30B-A3B-Instruct-2507 (Qwen3) Team, [14] trained on R2E-Gym Jain et al., [9]. CodeLift consistently outperforms binary and enhanced pass-rate reward baselines across pass@1/2/4/8, with gains ranging from 2.75 to 7.40 on Verified and from 0.22 to 4.51 on Pro. Our analyses show that CodeLift provides denser learning signals, more balanced rewards, and adaptive curriculum driven by the policy’s test behavior at each training step.
Our contributions are as follows:
We identify three potential sources that miscalibrate pass-rate rewards for SWE agents: (1) multiplicity imbalance, (2) progress–regression imbalance, and (3) difficulty imbalances.
We introduce CodeLift with two key components: (1) behavior balancing and (2) snapshot slicing, which turns test results into dense rewards with adaptive curriculum and credit assignment.
We show CodeLift’s consistent gains over binary and enhanced pass-rate baselines on SWE benchmarks, and provide detailed analysis for its characteristics.
Learning from Repository Tests
SWE Agentic RL. Given an issue with golden tests, an agent samples a rollout by interacting with a repository environment through tool-call actions and tool-response observations. The final repository state is captured as a patch. A common objective is to maximize the probability that the final patch passes all required tests [9]:
where is the result of the test . All patches with failed tests get zero reward regardless of partial progress in this binary setting [11].
Imbalances in Pass-Rate Rewards. A natural dense reward is the fraction of passing tests:
However, counting tests equally for pass-rate rewards faces three test-weighting imbalances:
Multiplicity imbalance: In practice, diverse test cases can check the same functionalities under different inputs or conditions. However, it is challenging to determine the functionalities each test covers without human labeling. Though parameterized tests illustrates which tests are explicitly used for the same functionalities, they only cover a subset of test suite (e.g., 43.0% in R2E-Gym), and other non-parameterized tests may also cover the same functionalities. Figure 2 (left) shows a long-tailed distribution: most parameterized familes are covered by very few tests, while few contain far more tests and higher impact on pass rate. Thus, using raw pass-rate could introduce a flip in reward ordering: a patch satisfying fewer heavily tested functionalities might get a higher score than those achieveing more lightly-tested functionalities.
Progress–regression imbalance: For an SWE task, there are two types of tests: Pass-to-pass (P2P) tests check whether existing functionality is broken, which automatically passes in the original repository without changes and should keep passing after patch. Fail-to-pass (F2P) tests check whether requested changes are implemented, which initially fail but should pass if the patch is correctly implemented. Figure 2 (middle) shows that in most issues, P2P tests much more than F2P tests for most issues. Thus, most of the pass-rate reward comes from keeping existing functionality, leaving only a small share for implementing the requested changes.
Difficulty imbalance: It is challenging to find a ground-truth label for test’s difficulty. An empirical method is to estimate it via directly using the pass rate on each test. Figure 2 (right) shows that most tests pass on nearly all sampled patches. Thus, a patch can get a high pass-rate reward by passing all trivial tests while still failing on each challenging test. In contrast, progress on hard tests has a small impact on total reward.
Figure 2. Cumulative test-suite distributions on R2E-Gym. [Left] Tests per parameterized family. [Middle] F2P/P2P per issue distribution. [Right] final-patch test pass frequency distribution.
CodeLift
To reduce these test-weighting imbalances above, we propose CodeLift, which turns test outcomes into dense rewards with an adaptive curriculum. CodeLift contains two major components: behavior balancing and snapshot slicing: Behavior balancing defines the scoring rule, while snapshot slicing applies it within each rollout to refine credit for intermediate progress. We summarize the whole process of CodeLift in Algorithm 1 and illustrate it with an dummy example in Figure 1.
Figure 1. Overview of CodeLift. [Top] Behavior balancing: groups tests and patches by their outcomes, weights test groups by the patch groups they kill, and scores patches using these weights. [Bottom] Snapshot slicing: uses self-tests to select candidate checkpoints, scores intermediate snapshots and combines the snapshot deltas with final advantage to obtain slice advantage .
Algorithm 1 CodeLift policy update
Input: policy ; issue batch ; rollouts per issue ; each issue has golden tests.
;
for each issue do
Collect from rollout workers for
Test final patches: , ▷ Behavior balancing (where are patch vectors across tests; are test vectors across patches)
;
Compute test-group weights by Eq. (3) ( when all patch pass test group )
Compute all , , and by Eq. (6)
for each rollout do
for every generated token
if rollout contains self-tests then ▷ Snapshot slicing
(§ 3.2)
for
end if
Append to
end for
end for
If , optimize on with fixed credits and
Behavior balancing
To reduce the test-weighting imbalance when treating all test as equal in SWE tasks, CodeLift aggregates the tests and patches into groups based on their test result behavior. For each issue , we evaluate final patches on its golden tests to form . Each row records one patch’s test outcomes, and each column records one test’s outcomes across patches. We group identical rows into patch groups and identical columns into test groups (Algorithm 1, lines 4–6). With denoting test group ’s binary outcome on patch group , we compute its failure frequency and normalized weight :
where , or if all , and CodeLift’s final-patch rewards always lie in . By assigning one weight per test group, we reduce the influence of repeated tests that might cover the same functionality across P2P tests and F2P tests. This also automatically remove the influence of those trivial all-passing tests, and gives more weight to groups passed by fewer patch groups, focusing on what is still challenging currently.
Under such behavior balancing mechanism, the test results matrix and corresponding groups and weights updates as the policy evolves, which naturally introduces an adaptive curriculum. For example, as new patches pass some previously failed tests, such test might be merged to an all-pass groups with zero-weight since the cannot distinguish patch quality, where others might still has weights. Instead, if one patch failed on a test which is from a previous all-pass test group (i.e., regression), this test group will again obtain a positive weight when other patches still pass it.
Snapshot slicing
Before assign credits for intermediate steps, we need to first scoring the intermediate steps. CodeLift uses self-tests as checkpoints to cut traces into token intervals. The intuition is that when self-testing, the agent may be checking whether its current edits work and can be used as a candidate submission. In practice, if the rollout ended there, its cumulative edits can produce a code diff snapshot just like a candidate final patch. Thus, we can evaluate those snapshots with the same golden test suites and scoring rule (use same , , as final score).
For rollout , we cut slices with token intervals and cumulative endpoint states . Starting from the original state , we keep a boundary only when the complete golden-test vector changes, so changes with equal scalar scores remain distinct. We assign actions to the slice ending at the next change, with trailing actions in the final slice. If no vector changes, the whole rollout forms one slice. Each token receives , with earlier history as context. Without self-tests, we skip slicing and use the final advantage throughout.
We reuse behavior balancing’s groups and weights, keeping every slice reward on the same scale. With these fixed for the issue, we compute the state score as
We average the test outcomes within each group because tests that agree on final patches can disagree at intermediate states.
Credit assignment
We use these intermediate outcomes to refine credit within each rollout while preserving the comparison between final patches. Since snapshots and final patches share a scoring rule, we add their score difference to the final advantage ; denotes this snapshot correction, with :
CodeLift thus gives an earlier patch with a higher score more credit even if later edits lower the score (Figure 1). For the final slice, it keeps because the correction is zero; a single slice recovers final-score training. A positive correction increases credit, although the resulting advantage can still be negative.
Under our default leave-one-out (LOO) estimator [1], this simplifies to
We therefore compare each endpoint with the other rollouts’ mean final score, giving positive credit when it exceeds that reference. Here, we include repeated patch behaviors in the mean because each rollout is a separate sample. The fitted scoring rule still depends on rollout ’s outcomes, so we optimize a state-score surrogate for final success, holding scores and credits fixed. We provide the policy loss and alternative estimator in Appendix A, and work through Figure 1 in Appendix D.1.
Experiments
Setup
Settings Our main comparison and ablation settings use Qwen3-30B-A3B-Instruct-2507 [14] with R2E-Gym [9]. For robustness analysis, we further add Qwen3-Coder-30B-A3B-Instruct (Qwen3-Coder) with SWE-bench v1 [2]. We use 500 SWE-bench Verified and 266 Python SWE-bench Pro issues [5] for evaluation, where Verified closer to mostly single-file training tasks (R2E-Gym) and Pro focusing more complex multi-file changes. We report unbiased pass@k uses eight attempts per issue [3, 11]. All bases on SWE-agent [18]. Appendices A–B provides more details.
Baselines We mainly compare CodeLift with Binary and PassRate (Equations (1)–(2)). We also compare four enhanced pass-rate (PR) variants: (1) PR-Harmonic takes the harmonic mean of F2P and P2P pass rates to mitigate progress-regression imbalance. (2) PR-Reweighted uses the static test weights estimated via pass-rate before training [16, 11] to mitigate difficulty imbalance. (3) PR-VeRPO uses the dynamic test weights estimated via each rollout group’s test pass rates and kernel density for training dynamics and process credit assignment [15]. (4) PR-Process is a variant of PR-Harmonic but uses the same snapshot slicing mechanism as CodeLift. For ablation, we use a sequential removal for CodeLift’s major components: behavior balancing and snapshot slicing. We provide CL-Outcome, which removes snapshot slicing from CodeLift and assigns final credit to every token. We then replace behavior-balanced scoring with a binary reward to obtain Binary. Note that here we use the sequential ablation to evaluate snapshot slicing under a fixed dense scoring rule, since binary scores cannot distinguish partial progress among snapshots that do not pass all tests. We also compare the default LOO advantage estimator (RLOO [1]) with group-relative Z-score estimator (GRPO [13]) in Qwen3-Coder. More details in Appendix § 9.§ 5. All share the same setting unless specified.
Main comparison
CodeLift consistently improves performance and broadens issue coverage. Table 1 shows that CodeLift outperforms others on all benches at every shared reported sampling budget. On Verified, it outperforms Binary from 3.67 points at pass@1 to 6.00 at pass@8. We also conducted 95% paired issue-bootstrap intervals to support CodeLift’s advantage (Appendix B). Results on Pro further suggest that CodeLift generalizes to more complex multi-file tasks though trained on single-file tasks. When comparing with our enhanced pass-rate baselines (PR-Harmonic & PR-Process) and adapted reward baselines from existing competitive programming methods (PR-Reweighted & PR-VeRPO) [16, 11, 15], CodeLift still shows an advantage across benchmarks and settings.
| Method | SWE-bench Verified | SWE-bench Pro (Py) | ||||||
| pass@1 | pass@2 | pass@4 | pass@8 | pass@1 | pass@2 | pass@4 | pass@8 | |
| Base | 26.00 | 35.14 | 43.52 | 50.60 | 12.17 | 18.96 | 27.00 | 35.71 |
| Binary | 34.63 | 43.04 | 50.36 | 56.80 | 16.54 | 25.00 | 34.16 | 41.73 |
| PR-Harmonic | 34.45 | 43.76 | 51.62 | 58.00 | 16.92 | 24.70 | 32.56 | 38.72 |
| PR-VeRPO | 34.45 | 42.41 | 49.43 | 55.40 | 19.50 | 28.24 | 36.62 | 42.86 |
| PR-Process | 35.55 | 44.11 | 51.60 | 58.40 | 19.36 | 27.48 | 35.79 | 42.48 |
| CodeLift | 38.30 | 47.53 | 55.84 | 62.80 | 20.16 | 28.71 | 36.84 | 43.23 |
| vs. Binary | +3.67 | +4.49 | +5.48 | +6.00 | +3.62 | +3.71 | +2.68 | +1.50 |
| vs. PR-Harmonic | +3.85 | +3.77 | +4.22 | +4.80 | +3.24 | +4.01 | +4.28 | +4.51 |
| vs. PR-VeRPO | +3.85 | +5.12 | +6.41 | +7.40 | +0.66 | +0.47 | +0.22 | +0.37 |
| vs. PR-Process | +2.75 | +3.42 | +4.24 | +4.40 | +0.80 | +1.23 | +1.05 | +0.75 |
Table 1. Main results on SWE benchmarks. Entries are pass@k (%); Base is the initial model. Deltas show CodeLift gains in percentage points, and bold marks the highest score. We report raw PassRate and PR-Reweighted through their final evaluated checkpoint (step 50) in Figure 3b.
CodeLift sustains learning where pass-rate rewards degrade. Figure 3 shows that the dense signals of pass-rate rewards do not raise the performance ceiling of binary rewards in SWE: The raw PassRate collapses very fast, and PR-Reweighted also shows a clear drop. While PR-Harmonic and PR-VeRPO avoid collapse, their final performance remains comparable to Binary, which aligns with prior findings in competitive programming [11], no matter it is static weighting [16], dynamic weighting [15], or solely mitigating the P2P/F2P imbalance. Though snapshot slicing improves PR-Process’s performance over PR-Harmonic in Table 1, it is still sub-optimal to CodeLift. CodeLift also shows a stable performance at the end of training process, staying at 35.8–36.2% after steps 180, compared with Binary’s 30.4–35.0%. We further analyze such collapses of pass-rate baselines and stability of CodeLift in § 5.
Ablation Study and Robustness Analysis
CodeLift benefits from both behavior balancing and snapshot slicing. Table 2 shows lower scores when each component is removed step-by-step. We find that behavior-balanced scoring impacts more on Pro, while snapshot slicing impacts more on Verified. Specifically, behavior-balanced scoring improves Pro pass@1 over Binary by 3.34pp and snapshot slicing improves Verified pass@1 over CL-Outcome by 2.47pp. We additionally compare PR-Harmonic and PR-Process in Table 1 to assess snapshot slicing under an alternative dense scoring rule as an extra proxy reference.
| Method | Verified pass@1 | Verified pass@4 | Pro (Py) pass@1 | Pro (Py) pass@4 |
| CodeLift | 38.30 | 55.84 | 20.16 | 36.84 |
| −∆ snapshot | -2.47 | -4.47 | -0.28 | -0.15 |
| CL-Outcome | 35.83 | 51.37 | 19.88 | 36.69 |
| −∆ behavior | -1.20 | -1.01 | -3.34 | -2.53 |
| Binary | 34.63 | 50.36 | 16.54 | 34.16 |
Table 2. Ablation for CodeLift’s components. CL-Outcome removes snapshot slicing; Binary further removes behavior-balanced scoring.
CodeLift improves performance across training settings. Table 3 shows that CodeLift outperforms Binary on both benchmarks with either RLOO’s or GRPO’s advantage estimator in the Qwen3-Coder/SWE-rebench setting. Within each methods, the advantage estimators make little difference on their performance. On Verified, CodeLift improves pass@4 by 2.20 points with RLOO and 4.44 points with GRPO, supporting broader issue coverage under both estimators.
| Method | Adv. | Verified pass@1 | Verified pass@4 | Pro (Py) pass@1 | Pro (Py) pass@4 |
| Base | − | 44.13 | 57.80 | 34.59 | 49.94 |
| Binary | RLOO | 47.70 | 63.20 | 34.30 | 50.88 |
| Binary | GRPO | 47.05 | 61.36 | 34.77 | 50.38 |
| CodeLift | RLOO | 48.30 | 65.40 | 35.95 | 51.76 |
| CodeLift | GRPO | 48.80 | 65.80 | 35.76 | 51.40 |
Table 3. Robustness across training settings. Qwen3-Coder trained on SWE-rebench with RLOO or GRPO. Base is the initial model.
Analysis
CodeLift provides dense and stable signals. Figure 4 shows that CodeLift consistently provides more rollout groups with non-zero advantages than binary reward throughout the training, as the binary reward gives no relative signal when all sampled patches fail, even if some pass more tests than others. While pass-rate rewards can distinguish these partially correct patches, their dense feedback does not ensure stable learning and collapses in the early training stage. CodeLift maintains dense training signals throughout training process, with a mean of 75.1% active rollout groups, outperforming Binary’s 47.9%. More details are in Appendix C.1.
Figure 4. Training signal density: rollout groups with nonzero advantages (%).
Behavior balancing reduces pass-rate bias toward overly conservative. To understand why PassRate collapses while CodeLift remains stable, we (1) compare rewards for progress and regression and (2) which types of patches receive positive training signals. As shown in Figure 5, we find that with raw PassRate, when final patches make any changes, the mean final penalty for introducing regressions is 3.71 times than the mean final reward for making a real progress. Thus, the model is encouraged to be conservative, i.e., the potential reward for making progress may not be worth the risk of a large penalty, with 58.3% positive advantages come from the patches without pass rate changes. CodeLift mitigates such bias by balancing the reward contribution, avoiding the tests with similar behavior dominates the reward. As a result, it achieves a 1.08 ratio, close to parity. This is also reflected in its allocation of positive advantages, as 81.6% of them come from patches that make real progress.
Figure 5. Progress-Regression preferences: (a) Ratio of regression penalty to progress reward. (b) Positive credit by final-patch test pass rate: improved (green), unchanged (gray), worsened (red).
We further examine how test counts per parameterized test familes contribute to this reward imbalance. Intuitvely, a functionality covered by few tests have little impacts on pass-rate reward even when all its tests pass. Figure 6 compares positive reward changes for patches gaining exactly one fully passing test family. Under PassRate, 65.9% of these changes are below 0.05. Such small reward increases are less common under CodeLift. More details are in Appendix § 11.§ 2.
Figure 6. Positive reward changes for fully passing a test family.
CodeLift naturally introduces an adaptive curriculum. To see how the test weights change as the policy improves, we compare PassRate and CodeLift on the same training batches. As shown in Figure 7, we sort tests by how often sampled patches pass them. Under PassRate, most of the total weight is assigned to tests passed by every patch. Thus, most of its reward scale does not distinguish the sampled solutions, and the space for challenging test’s weights gradually decreases. CodeLift combines these trivial tests into one group with zero weight, and then assigns more weight to groups that fewer distinct patch groups pass. As more tests pass on every sampled patch, they join the all-pass group without occupying weight spaces. Thus, the weight distribution dynamically keeps stable throughout the training.

Figure 7. Test weights training dynamics. (a,b) Test-weight shares within rollout groups under PassRate and CodeLift. (c) Share of rollout groups where every final patch passes all tests.
We further track test-group counts and weights to examine how the curriculum changes as the policy improves. As shown in Figure 8, easy test groups roughly remain stable in both high counts and carry low average weights.
Figure 8. Test groups training dynamics. (a) Groups per issue. (b) Average weight per group.
This follows the grouping mechanism: simple tests universally passed by patches will gradually join the same all-pass groups without adding weight. Medium-difficulty groups show the largest decline in number, consistent with partially learned tests becoming easier to pass. Hard groups decrease much more slowly, but their average weight keeps rising, so passing one hard group contributes more to the reward on average. Our analysis of the same issue’s test groups across training windows further shows that their weights change with the policy’s performance: Comparing with previous windows, CodeLift gives less weight when more patches pass its tests, and more weight when fewer pass on average (Appendix § 11.§ 3).
Snapshot slicing improves credit assignment and reduces regressions. We track how often test pass rates fall between consecutive slice endpoints and the size of these decreases. As shown in Figure 9, CodeLift has fewer decreases per rollout (a) and smaller mean decreases (b) than Binary or CL-Outcome late in training. To check whether final-only credit misses useful intermediate work, we compare slice advantages with and without slicing on the same CodeLift rollouts, keeping state scores and the peer baseline fixed. Final-only credit gives every slice the final patch’s advantage, even when an intermediate patch scores higher. With slicing, CodeLift changes zero or negative advantages into positive ones in 23.4% of intermediate slices, providing credit to useful actions within these rollouts (Appendix § 11.§ 4). This gives credit to intermediate work even when later edits lower the final score.

Figure 9. Regressions training dynamics. (a) Pass-rate decreases count. (b) decrease magnitude.
CodeLift’s Curriculum does not need extra rollout effort. By design, CodeLift’s behavior balancing estimates test difficulty from the final-patch test results already collected during normal test-based RL training. As the policy improves, these results change and the groups and weights adapt, naturally introducing a curriculum without extra rollouts. In contrast, similar pass-rate rewards for competitive programming ([16, 11]) use separately sampled offline test pass frequencies for offline test difficulty estimation. However, CodeLift does need extra testing effort for snapshot slicing, which evaluates the intermediate snapshot’s patches and provides extra credit assignments. In our main CodeLift experiment, snapshot slicing requires evaluating an average of 2.35 additional non-final patches per rollout beyond the final patch. These additional test executions run on CPUs rather than GPUs and require no additional rollout generation.
Related Work
Repository-level SWE tasks. SWE-bench evaluates repository issue resolution ([10]), while SWE-agent provides navigation, editing, and execution interfaces ([18]). R2E-Gym and SWE-rebench supply executable training tasks ([9] (Bardotindinov et al. 2025)). R2E-Gym fine-tunes agents on successful trajectories. CodeLift builds on these datasets and environment, extending final-outcome RL with behavior-balanced rewards and intermediate credit.
Coding rewards. MiMo [16] calibrates test difficulty using multiple models’ solutions and assigns partial rewards by difficulty level. Li et al. [11] find no consistent final-performance gains from raw or statically reweighted pass-rate rewards over binary rewards. VeRPO [15] weights tests by current pass frequencies and their density, combining per-turn and final rewards. These methods use test frequency statistics for competitive programming. In contrast, repository-level SWE additionally requires preserving existing functionality (P2P) while implementing requested changes (F2P). CodeLift exploits the more fundamental patch testing behavior mechanism to provide a balanced, dense supervision, with grouped tests as dynamic curriculum. To fairly compare with related works in SWE scenarios, our PR-Reweighted baseline further adapts the difficulty-driven static calibration philosophy (i.e., IOI partial scoring) from MiMo and Li et al. [11], and dynamic pass-rate frequency density weighting from VeRPO [15] to SWE. We also introduce PR-Harmonic and PR-Process to balance F2P/P2P pass rates with or without our proposed snapshot slicing credit assignment, which are enhanced pass-rate baselines specific for SWE tasks (Section 4).
Fine-grained credit assignment. GiGPO [6] compares subsequent returns from actions at repeated states. TreeRL [8] and Branching Policy Optimization (BPO) [7] estimate intermediate values from sampled continuations. CodeLift instead evaluates the patch already produced at each checkpoint and uses its test score to credit the preceding interaction slice.
Limitations
We train and evaluate CodeLift on Python repositories, using established public datasets with executable tests. These resources let us focus on the RL method; building comparable datasets for other languages is outside the scope of this work. Accordingly, our self-test detection, and data checks have been validated on Python projects with test runners such as pytest. CodeLift’s scoring and credit rules use test outcomes, but its performance in other languages remains to be evaluated.
Conclusion
We introduce CodeLift, which combines behavior balancing and snapshot slicing to provide dense rewards for SWE agents. Its behavior balancing groups tests and patches to reduce pass-rate imbalances, which naturally introduces an adaptive curriculum from existing final-patch outcomes. Its snapshot slicing applies the same scoring rule to intermediate patches, assigning credit for steps with progress even when later edits introduce regressions. Experiments on SWE-bench Verified and SWE-bench Pro (Py) show consistent advantage over binary and enhanced pass-rate baselines. Our analyses show denser learning signals, more balanced rewards, and test weights that adapt to the changing policy.
Reproducibility statement. Code repository is in https://github.com/Siyuexi/CodeLift
Experimental Details
Setting details
We use R2E-Gym-Subset and the filtered SWE-rebench v1 release to train Qwen3 and Qwen3-Coder, respectively. In our training settings as shown in Table 4, we exclude prompts above 8,192 tokens, counting system and issue messages with the model’s tokenizer and chat template. After filtering, all methods share the filtered 4,455 R2E-Gym or 1,100 SWE-rebench issues.
| Parameter | Value |
| Issues per batch | 64 |
| Rollouts per issue | 8 |
| Minibatch (issues) | 16 |
| Update epochs | 1 |
| Learning rate | |
| Clip width | |
| Prompt tokens | 8,192 |
| Response tokens | 122,880 |
| Training temperature | 1.0 |
| Policy loss | GSPO |
| Advantage estimator | RLOO |
| Entropy / KL coefficient | 0 / 0 |
Table 4. Shared training parameters.
We use the SWE-agent harness for training and evaluation, which provides a persistent shell, a string-replacement editor, and a submit action. The agent can inspect and run existing repository tests, while additional benchmark tests and grading scripts remain in the evaluator. For both training and evaluation, we set a 120-second shell-command timeout. During training, we also shuffle issues and set the dataset and rollout seeds to 42.
For fair comparison, we fix all training seeds to 42, and 8-repeat evaluation with different seeds: 42, 4, 424, 2424, 44, 45, 46, 47. All the settings for training and evaluation, including the infrastructure, deployment, framework, datasets, seeds, algorithm, keep consistent across all methods to ensure fairness. The only difference among the methods is their own reward calculation and credit assignment.
Reward hacking prevention
To prevent model reward hacking during all method’s training and evaluation settings, we limit model’s access to reference solutions by we disabling network access in the sandbox and replace the repository’s Git history with a single initial commit and no remotes. These safeguards apply to all compared methods.
Engineering Details
CodeLift captures cumulative patches after recognized self-tests and at the end of each rollout. For self-tests, we recognize Python test runners (pytest, unittest, tox, and nox), make test/make check, and test shell scripts, capturing the patch once the command finishes regardless of its exit status.
It is important to note that self-test outputs do not determine reward or enter the weight calculation in any situation. Self-test commands select candidate checkpoints, which we evaluate on the same golden tests as the original and final states. These test vectors determine slice boundaries and scores (§ 3.2).
Optimization and advantage estimators
We use GSPO to compute the likelihood ratio and clipped policy loss ([20]), with RLOO ([1]) or GRPO ([13]) for advantage estimation. For token in rollout , let be its probability given the history and the number of generated tokens. GSPO uses a sequence ratio and its token form for our slice advantages:
Here preserves the forward value and stops its gradient. Let for , or when slicing is skipped. We use
We then average the loss over tokens within each rollout and over rollouts in the minibatch, with . Each update uses one epoch and no entropy or KL regularization.
By default, we use REINFORCE Leave-One-Out (RLOO. Equation (6)). For the GRPO comparison, we change only the final-advantage estimator: let and be the mean and sample standard deviation of the issue group’s final rewards. We compute the final advantage as
where is the Binary reward or CodeLift score. CodeLift then adds the snapshot-to-final score difference at its original scale (Equation (5)), so only the final comparison is standardized.
Reward baselines and ablation
PR-Harmonic. We use the harmonic mean value of P2P pass rate and F2P pass rate to calibrate their imbalance. Let and be the pass rates on the original F2P and P2P test sets. When both sets are nonempty, we compute the reward as
The reward is zero when both rates are zero. If one set is empty, we use the other set’s pass rate. Within each set, tests receive equal weight.
PR-Process. We apply PR-Harmonic’s score to each repository snapshot and use CodeLift’s snapshot slicing to construct an enhanced pass-rate baseline with credit assignment. This comparison keeps the harmonic scoring rule and adds credit for intermediate progress.
PR-Reweighted. PR-Reweighted is an SWE-task adaptation for the test’s static weighting philosophy of existing competitive programming pass-rate baselines ([16]) and ([11]). Specifically, we adapt the test-difficulty labeling procedure of Li et al. [11], inspired by MiMo’s difficulty-based code reward ([16]). Before training, we estimate test difficulty from final patches generated by Binary over four successive calibration stages. Let be test ’s pass frequency in stage , and that stage’s overall success rate. We compute
where contains stages with an observed outcome for test . Using these estimates, we set the weights before training and keep them fixed. Specifically, within each issue, we assign weight 1 to tests at or above the 67th percentile of , weight 3 to those below the 33rd percentile, and weight 2 to the rest, using linear interpolation for the percentiles. If all calibrated frequencies are at least 0.9 or at most 0.1, we assign weight 1 or 3, respectively. As a fallback, we use weight 2 for tests without positive calibration weight and for all tests in issues with fewer than eight usable calibration patches.
PR-VeRPO. PR-VeRPO is an SWE-task adaptation for the test’s dynamic weighting via test frequency density method, following the original VeRPO [15] from its original competitive programming scenario to SWE agentic tasks. For each issue, we pool the candidates captured after self-tests and at rollout completion, retaining repeated outcomes and excluding the original repository state. Each test’s pass frequency across these candidates determines its weight:
The population standard deviation is over tests. When all frequencies coincide, we use the equal-frequency limit, where the kernel sum is the number of tests. We sum the weights of passed tests without weight-sum normalization to obtain each candidate’s local reward and center these rewards over all candidates for the issue. We multiply each rollout’s final full-test success by , where is its candidate count, then subtract the mean discounted success across all rollouts for the issue. Candidate credit is this centered final reward plus times its centered local reward. We use , , , and , and assign the resulting credit to the candidate’s generated-token interval.
CL-Outcome. CL-Outcome retains CodeLift’s behavior-balanced scoring and snapshot evaluation, but assigns to every generated token. Similarly, PR-Harmonic uses the same snapshot evaluation, with the rollout advantage computed from its final reward.
Evaluation and Uncertainty
Benchmarks and checkpoints. Before we start any experiment, we set a global target with fixed budgets for evaluation: (1) Qwen3/R2E-Gym: uses step200 (near 3 epochs) for main comparison evaluation. (2) Qwen3-Coder/SWE-rebench: uses step100 (near 6 epochs) for robustness evaluation. We also set an early-stop protocol before training: if any model’s validation score remained below the pre-training validation score for 30 consecutive steps, it was deemed to have collapsed. For collapsed models, we report the validation curves up to early stopping, including the final evaluated step and its score, without conducting further evaluations across multiple random seeds. Under these rules, we report all successful method’s results in Table 1 and all collapsed model information in Figure 3.
Repeated evaluation. We sample eight attempts per issue at temperature 1.0, allowing 1,200 seconds for each rollout and 600 seconds for evaluation. For successful attempts on issue , we report
with a zero numerator when . We count missing attempts as failures, keeping for Verified and for Pro. To report differences, we subtract the displayed percentages after rounding to two decimals. We train each Qwen3 method once, then repeat evaluation attempts to measure variation in the trained model’s sampled outputs.
Paired uncertainty. We use paired bootstrap intervals to check CodeLift’s gains on Verified (Table 5), finding gains over Binary, PR-Harmonic, PR-Process, PR-VeRPO, and CL-Outcome across pass@1/2/4/8. For this check, we resample the 500 issues with replacement 20,000 times, keeping all eight attempts and the method pairings for each selected issue. The 2.5th and 97.5th percentiles of the resulting mean differences then give the interval endpoints. Because only issues are resampled, these intervals measure variation across issues with the trained models and sampled attempts fixed.
| Method | pass@1 | pass@2 | pass@4 | pass@8 |
| Binary | +3.67[+2.10,+5.28] | +4.49[+2.61,+6.38] | +5.48[+3.12,+7.85] | +6.00[+2.80,+9.20] |
| PR-Harmonic | +3.85[+2.20,+5.55] | +3.77[+1.88,+5.70] | +4.22[+1.89,+6.63] | +4.80[+1.60,+8.00] |
| PR-Process | +2.75[+1.23,+4.30] | +3.42[+1.69,+5.17] | +4.24[+1.91,+6.55] | +4.40[+1.00,+7.80] |
| PR-VeRPO | +3.85[+2.25,+5.48] | +5.12[+3.22,+7.03] | +6.41[+3.97,+8.92] | +7.40[+4.00,+10.80] |
| CL-Outcome | +2.47[+0.95,+4.03] | +3.44[+1.66,+5.25] | +4.47[+2.22,+6.75] | +5.00[+2.00,+8.20] |
Table 5. CodeLift’s gains on Verified with 95% paired bootstrap intervals (pp).
We also check the effect of missing attempts while keeping the benchmark denominator fixed. Even if all seven missing CL-Outcome attempts succeed and both missing CodeLift attempts fail, CodeLift retains a 2.30-point Verified pass@1 gain.
Further Analysis Details
We use Qwen3 training rollouts for the analyses below unless stated otherwise. To track progress in Figure 4, Figure 7, and Figure 8, we reconstruct successive batches of sampled rollouts (sampling cohorts) and label them Training step.
Final-patch credit and signal density
Let be test group ’s final outcome on rollout , and let count passing rollouts before patch grouping. We can write this group’s contribution to the RLOO advantage as
Thus, CodeLift assigns credit according to both a test group’s weight and how its outcomes differ across patches. If every final patch fails a group, CodeLift gives it positive weight but cannot use it to distinguish those patches. It can still credit an intermediate state that passes the group. When some final patches pass and others fail, the group contributes nonzero advantages, though contributions from different groups may cancel.
To separate the credit rule from patch generation, we score the same patches under each rule (Table 6). CodeLift’s behavior balancing accounts for most of the increase in rollout groups with nonzero advantages. Beyond this increase, snapshot slicing also changes credit within groups that already have a signal.
| Credit rule | Share (%) |
| Binary | 48.07 |
| CL-Outcome | 74.99 |
| CodeLift | 75.02 |
Table 6. Nonzero-advantage rollout groups on the same CodeLift rollouts.
CL-Outcome retains a nonzero signal wherever Binary RLOO has one on the same rollouts, because such a group includes both a fully passing patch with score one and a failing patch with score below one. CodeLift also retains this comparison in the final slice. When a group has no final-only signal, however, slicing adds one only if an intermediate score differs from the shared final score.
To track signal density during training, we use each method’s own rollouts (Figure 4): cohorts 1–210 for CodeLift and Binary, and 1–51 for PassRate. Within these ranges, we divide the number of groups with any nonzero advantage by all scored groups. We then smooth the curves over ten cohorts and pool group counts for the reported means.
Reward changes and positive credit
We compare rewards for progress and regression by scoring the same CodeLift patches under both reward rules (Figure 5a and Figure 6). For this comparison, each unparameterized test forms a singleton family, and a family passes when all its tests pass. We then compare each final patch with its evaluated original state and divide the absolute mean reward change for a net loss of passing families by the mean change for a net gain. As a further check, we exclude issues with inconsistent original outcomes: PassRate’s loss/gain ratio changes from 3.71 to 3.68, while CodeLift’s remains at 1.08.
To examine the effect of test counts, we select CodeLift patches that gain exactly one fully passing family over the original repository (Figure 6). We then score this set under both rules, using Equation 4 for CodeLift, and plot the cumulative share of positive reward changes for each rule. Conditioning separately on positive reward changes yields 36,778 samples for PassRate and 20,609 for CodeLift. The reported percentages below 0.05 are computed within these respective subsets.
We also examine which patches receive positive credit (Figure 5b), using each method’s own complete eight-rollout groups from cohorts 49–51. For this analysis, we separate final patches by whether their raw pass rate increases, stays unchanged, or decreases from the original state. Within each category, we then sum and divide by the total positive advantage.
Adaptive curriculum
To track how CodeLift allocates weight as the policy improves, we sort tests by how often the evaluated final patches pass them in each issue batch (Figure 7). For this comparison, we use batches with at least one failing patch and report the rate of all-pass rollout groups separately. We also track test-group counts and weights within pass-frequency intervals of , , and percent (Figure 8). To obtain these curves, we recompute the bins in each batch and pool eleven neighboring cohorts, averaging counts per issue occurrence and weights per test group.
We also follow individual test groups over time by matching groups containing the same tests across training windows (Table 7). For each issue, we first select its earliest complete eight-rollout group in cohorts 1–70, 71–140, and 141–210. We then retain issues evaluated on the same tests in all three windows and match groups across consecutive windows. Across the resulting 11,216 pairs, CodeLift gives less weight to groups passed by more rollouts and more weight to those passed by fewer, on average. Here, pass counts include all rollouts, whereas uses distinct patch groups. Because CodeLift also normalizes weights across test groups in the same issue, a group’s weight can change even if the same number of rollouts passes it.
| Passing rollouts | Failure frequency Before | Failure frequency After | Weight Before | Weight After |
| More | 0.609 | 0.439 | 0.460 | 0.434 |
| Fewer | 0.439 | 0.598 | 0.395 | 0.471 |
| Same | 0.475 | 0.475 | 0.347 | 0.361 |
Table 7. Changes in test groups with fixed membership across training windows.
Snapshot credit and regression measurements
We compare credit with and without slicing on each method’s recorded rollouts, keeping state scores and the peer baseline fixed (Table 8). This comparison covers cohorts 1–210, with 1,047 intermediate slices for CodeLift and 5,741 for CL-Outcome. With slicing, CodeLift changes zero or negative advantages under final-only credit into positive ones for 245 (23.4%) of its intermediate slices. It also changes some positive advantages to negative ones, retaining credit for useful intermediate work and removing it from intermediate regressions.
| Rollout source | CodeLift | CL-Outcome |
| Intermediate slices: to | 23.4 | 17.1 |
| Intermediate slices: to | 23.9 | 24.1 |
Table 8. Effect of slicing on recorded rollouts (%).
We also measure regressions by counting decreases in raw pass rate between consecutive credited states, starting from the original repository (Figure 9). To measure their size, we average decreases within each rollout, assigning zero when none occur, then average across rollouts. We smooth the curves with an eleven-step centered window.
Case Study
We first work through the full calculation, then use recorded cases to illustrate behavior balancing’s correction of test multiplicity bias and snapshot slicing’s credit for intermediate progress and regressions.
Preliminary: Calculation workflow
We use the five sampled patches in Figure 1 to illustrate how CodeLift computes rewards and slice advantages from test outcomes.
Since P1 and P4 pass the same tests, CodeLift places them in the same patch group, leaving four distinct patch groups. It also groups T3 and T5 together because both pass on every sampled patch. This gives five test groups, which reject (3, 3, 0, 2, 2) patch groups, respectively. CodeLift normalizes these counts to weights (0.3, 0.3, 0, 0.2, 0.2), then sums the weights of the test groups each patch passes to obtain final scores (0.3, 0.2, 0.2, 0.3, 0.7).
To compute the advantage for rollout 5, CodeLift compares its score with the mean final score of the other rollouts. P1 and P4 still count as separate samples here, so the peer baseline is . The final advantage is therefore .
CodeLift uses this same baseline to assign credit to each slice (Table 9). For example, the first snapshot passes T2 and T4 and receives a score of 0.5. This is lower than the rollout’s final score but higher than the peer baseline. Its snapshot correction is therefore negative, while its slice advantage is positive.
| Endpoint | Score | Correction | Advantage |
| First snapshot | 0.5 | −0.2 | +0.25 |
| Second snapshot | 0.8 | +0.1 | +0.55 |
| Final patch | 0.7 | 0 | +0.45 |
Table 9. Slice credit for rollout 5 in Figure 1.
blackBehavior balancing for test multiplicity
In this subsection, we discuss a pandas issue involving three internal classes: Block, DatetimeTZBlock, and ExtensionBlock. Accessing these classes should emit a deprecation warning, and they should no longer appear in the exposed module namespace. The existing make_block function must also remain usable for constructing blocks from timezone-aware datetime data. The tests check these three behaviors, but the warning check is repeated for each class, while the namespace and block construction checks each have one test. We compare two final patches fron an 8-rollout groups in Table 10. Final patch A adds the required warnings but leaves the namespace incorrect and breaks block construction. Final patch B corrects the namespace and preserves block construction, but still fails the warning checks.
| Tested behavior | Group weight | Final patch A | Final patch B |
| Test outcomes (passed / total) | |||
| Deprecation warnings | 0.375 | ✓ (3/3) | × (0/3) |
| Module namespace | 0.375 | × (0/1) | ✓ (1/1) |
| Block construction | 0.250 | × (0/1) | ✓ (1/1) |
| Other shared tests | 0.000 | 4/4 | 4/4 |
| Total tests passed | 7/9 | 6/9 | |
| Final reward | |||
| PassRate | 0.778 | 0.667 | |
| CodeLift | 0.375 | 0.625 |
Table 10. Test outcomes and final rewards for two pandas patches. Counts report passed/total tests; ✓/× mark passing/failing test groups. Weights are computed from all eight final patches in the rollout group. The higher reward under each rule is bold.
Table 10 shows that raw PassRate score and CodeLift’s behavior balanced score rank the two final patches differently. PassRate favors A because its three passing warning tests outnumber B’s two passing tests for namespace and block construction. CodeLift groups the tests and constructs three separate groups for warning, namespace, and block construction, with the weights of 0.375, 0.375, and 0.250. The other four tests pass on every final patch and receive zero weight. Thus, CodeLift gives B a higher final reward for satisfying two of the three behaviors, even though A passes more tests. We examine how groups and weights change during training in Appendix § 11.§ 3.
blackSnapshot slicing for intermediate credit
In this subsection, we discuss two issue cases. The first asks NumPy’s NumpyVersion to parse versions such as 10.0.1; the second asks aiohttp to reject chunked encoding for HTTP/1.0. We use their recorded rollouts to compare how final-only credit and snapshot slicing assign credit to intermediate and final patches (Table 11). For each comparison, the state scores and peer baseline are the same.
| Case | State | Tests passed | Score | Slice credit |
| NumPy | Intermediate snapshot | 8/8 | 1.000 | +0.143 |
| Final patch | 3/8 | 0.333 | -0.524 | |
| aiohttp | Intermediate snapshot | 63/66 | 0.000 | -0.857 |
| Final patch | 66/66 | 1.000 | +0.143 |
Table 11. Intermediate and final credit in two recorded rollouts.
NumPy: a repair followed by regression. The agent first modifies the regular expression to allow multiple digits in the major version. This intermediate patch passes all eight tests. However, the agent later rewrites the full pattern, breaking five prerelease and development tests. With a final score of 1/3 and a peer baseline of 6/7, final-only credit assigns −11/21 to both slices, including the earlier successful repair. With snapshot slicing, CodeLift gives the earlier repair +1/7 and keeps −11/21 for the final rewrite.
aiohttp: a regression followed by repair. The original code passes 65 of 66 tests. To reject HTTP/1.0 chunked encoding, the agent adds a version check using HttpVersion11 but omits its import. This causes a NameError, leaving 63 of 66 tests passing. The agent then adds the import while keeping the version check, and the final patch passes all 66 tests.
With a peer baseline of 6/7, final-only credit assigns +1/7 to both slices, including the one that introduced the error. Although the intermediate patch passes 63 tests, it fails every test group with positive weight, giving it a score of zero. CodeLift therefore assigns −6/7 to this intermediate slice and +1/7 to the final slice. The negative credit applies to all actions in the intermediate slice, including the version check retained in the final repair.
Prompt Templates
We use the same system and user prompt templates across methods (Figure 10–Figure 12). The user prompt inserts each issue at {problem_statement}. For Pro, this includes its requirements and interface specifications. We show the template with /testbed, replacing it with /app for Pro. Tool definitions are supplied separately by the agent interface.

System prompt
You are a helpful assistant that can interact with a
computer to solve tasks.
User prompt (1/3)
<uploaded_files>
/testbed
</uploaded_files>
I have uploaded a python code repository in the /testbed
directory. You can explore and modify files using the
available tools. Consider the following issue description:
<issue_description>
{problem_statement}
</issue_description>
Can you help me implement the necessary changes to the
repository to fix the <issue_description>?
I have already taken care of all changes to any of the test
files described in the <issue_description>. This means you
DON'T have to modify the testing logic or any of the tests
in any way!
Also the development Python environment is already set up
for you (i.e., all dependencies already installed), so you
don't need to install other packages.
Your task is to make the minimal changes to non-test files
in the /testbed directory to ensure the <issue_description>
is satisfied.
Follow these steps to resolve the issue:
1. First, explore the codebase to locate and understand the
code relevant to the <issue_description>.
- Use efficient search commands to identify key files and
functions.
- You should err on the side of caution and look at various
relevant files and build your understanding of
- how the code works
- what are the expected behaviors and edge cases
- what are the potential root causes for the given issue
2. Assess whether you can reproduce the issue:
- Create a script at '/testbed/reproduce_issue.py' that
demonstrates the error.
- Execute this script to confirm the error behavior.
- You should reproduce the issue before fixing it.
- Your reproduction script should also assert the expected
behavior for the fixed code.Figure 10. System and user prompt templates (part 1 of 3).

User prompt (3/3)
7. Test edge cases:
- Identify potential edge cases that might challenge your solution.
- Create additional test cases in a separate file '/testbed/edge_case_tests.py'.
- Execute these tests to verify your solution's robustness.
- You should run multiple rounds of edge cases. When creating edge cases:
- Consider complex scenarios beyond the original issue description
- Test for regressions to ensure existing functionality remains intact
- At each round you should write multiple edge test cases in the same file to be efficient
8. Refine if necessary:
- If edge case testing reveals issues, refine your solution accordingly.
- Ensure your final implementation handles all identified scenarios correctly.
- Document any assumptions or limitations of your solution.
9. Submit your solution:
- Once you have verified your solution, submit your solution using the `submit` tool.
A successful resolution means:
- The specific error/issue described no longer occurs
- Your changes maintain compatibility with existing functionality
- Edge cases are properly handledFigure 12. User prompt template (part 3 of 3).

Analyze the root cause:
Identify the underlying problem based on your code exploration and reproduction results.
Critically analyze different potential approaches to fix the issue.
You NEED to explicitly reason about multiple approaches to fix the issue. Next, find the most elegant and effective solution among them considering the tradeoffs (correctness, generality, side effects, etc.).
You would need to reason about execution paths, edge cases, and other potential issues. You should look at the unit tests to understand the expected behavior of the relevant code.
Implement your solution:
Make targeted changes to the necessary files following idiomatic code patterns once you determine the root cause.
You should be thorough and methodical.
Verify your solution:
Rerun your reproduction script to confirm the error is fixed.
If verification fails, iterate on your solution until successful. If you identify the reproduction script is buggy, adjust it as needed.
Run unit tests:
Find and run the relevant unit tests relevant to the performed fix.
You should run the unit tests to ensure your solution is correct and does not cause any regressions.
In cases where the unit tests are do not pass, you should consider whether the unit tests does not reflect the new expected behavior of the code. If so, you can test it by writing additional edge test cases.
Use the existing test runner to run the unit tests you identify as relevant to the changes you made. For example:
python -m pytest -xvs sympy/physics/units/tests/test_dimensions_transcendental.pypython -m pytest tests/test_domain_py.py::test_pymethod_options./tests/runtests.py constraints.tests.CheckConstraintTests -v 2
RUN ALL relevant unit tests to ensure your solution is correct and does not cause any regressions.
DO NOT MODIFY any of the existing unit tests. You can add new edge test cases in a separate file if needed BUT DO NOT MODIFY THE EXISTING TESTS.
Figure 11. User prompt template (part 2 of 3).
References
- [1]Arash Ahmadian, Chris Cremer, Matthias Gallé, Marzieh Fadaee, Julia Kreutzer, Olivier Pietquin, Ahmet Üstün, and Sara Hooker. Back to Basics: Revisiting REINFORCE-Style Optimization for Learning from Human Feedback in LLMs. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 12248–12267, 2024. doi: 10.18653/v1/2024.acl-long.662.DOI
- [2]Ibragim Badertdinov, Alexander Golubev, Maksim Nekrashevich, Anton Shevtsov, Simon Karasik, Andrei Andriushchenko, Maria Trofimova, Daria Litvintseva, and Boris Yangel. SWE-rebench: An Automated Pipeline for Task Collection and Decontaminated Evaluation of Software Engineering Agents. In Advances in Neural Information Processing Systems, volume 38, 2025. doi: 10.52202/085713-0788.DOI
- [3]Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating Large Language Models Trained on Code, 2021. URL https://arxiv.org/abs/2107.03374.
- [4]Richard A DeMillo, Richard J Lipton, and Frederick G Sayward. Hints on test data selection: Help for the practicing programmer. Computer, 11(4):34–41, 1978.DOI
- [5]Xiang Deng, Jeff Da, Edwin Pan, Yannis Yiming He, Charles Ide, Kanak Garg, Niklas Lauffer, Andrew Park, Nitin Pasari, Chetan Rane, Karmini Sampath, Maya Krishnan, Srivatsa Kundurthy, Sean Hendryx, Zifan Wang, Vijay Bharadwaj, Jeff Holm, Raja Aluri, Chen Bo Calvin Zhang, Noah Jacobson, Bing Liu, and Brad Kenstler. SWE-Bench Pro: Can AI Agents Solve Long-Horizon Software Engineering Tasks?, 2025. URL https://arxiv.org/abs/2509.16941.
- [6]Lang Feng, Zhenghai Xue, Tingcong Liu, and Bo An. Group-in-Group Policy Optimization for LLM Agent Training. In Advances in Neural Information Processing Systems, volume 38, pp. 46375–46408, 2025. doi: 10.52202/085713-1544.DOI
- [7]Bowei He, Yankai Chen, Xiaokun Zhang, and Xue Liu. Branching Policy Optimization: Sandbox-Native Language Agent Reinforcement Learning, 2026. URL https://arxiv.org/abs/2607.14171.
- [8]Zhenyu Hou, Ziniu Hu, Yujiang Li, Rui Lu, Jie Tang, and Yuxiao Dong. TreeRL: LLM Reinforcement Learning with On-Policy Tree Search, 2025. URL https://arxiv.org/abs/2506.11902.
- [9]Naman Jain, Jaskirat Singh, Manish Shetty, Liang Zheng, Koushik Sen, and Ion Stoica. R2E-Gym: Procedural Environments and Hybrid Verifiers for Scaling Open-Weights SWE Agents, 2025. URL https://arxiv.org/abs/2504.07164.
- [10]Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik Narasimhan. SWE-bench: Can Language Models Resolve Real-World GitHub Issues? In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=VTF8yNQM66.arxiv.org/abs/2310.06770
- [11]Xin-Ye Li, Ren-Biao Liu, Yun-Ji Zhang, Hui Sun, Zheng Xie, and Ming Li. Exploring pass-rate reward in reinforcement learning for code generation. arXiv preprint arXiv:2605.02944, 2026.arxiv.org/abs/2605.02944
- [12]Gregg Rothermel and Mary Jean Harrold. A safe, efficient regression test selection technique. ACM Transactions on Software Engineering and Methodology (TOSEM), 6(2):173–210, 1997.DOI
- [13]Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y. K. Li, Y. Wu, and Daya Guo. DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models, 2024. URL https://arxiv.org/abs/2402.03300.
- [14]Qwen Team. Qwen3 technical report, 2025. URL https://arxiv.org/abs/2505.09388.
- [15]Longwen Wang, Yirui Liu, Xuan’er Wu, Xiaohui Hu, Yuankai Fan, Kaidong Yu, Qizhen Weng, Wei Xi, and Xuelong Li. Beyond binary: Turning partial success into dense verifiable rewards for reinforcement learning in code generation. arXiv preprint arXiv:2601.03525, 2026.arxiv.org/abs/2601.03525
- [16]LLM Xiaomi, Bingquan Xia, Bowen Shen, Dawei Zhu, Di Zhang, Gang Wang, Hailin Zhang, Huajun Liu, Jiebao Xiao, Jinhao Dong, et al. Mimo: Unlocking the reasoning potential of language model—from pretraining to posttraining. arXiv preprint arXiv:2505.07608, 2025.
- [17]Anyi Xu, Bangcai Lin, Bing Xue, Bingxuan Wang, Bingzheng Xu, Bochao Wu, Bowei Zhang, Chaofan Lin, Chen Dong, Chenchen Ling, et al. Deepseek-v4: Towards highly efficient million-token context intelligence. arXiv preprint arXiv:2606.19348, 2026.arxiv.org/abs/2606.19348
- [18]John Yang, Carlos Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and Ofir Press. Swe-agent: Agent-computer interfaces enable automated software engineering. Advances in Neural Information Processing Systems, 37:50528–50652, 2024.arxiv.org/abs/2405.15793
- [19]Aohan Zeng, Xin Lv, Zhenyu Hou, Zhengxiao Du, Qinkai Zheng, Bin Chen, Da Yin, Chendi Ge, Chenghua Huang, Chengxing Xie, et al. Glm-5: from vibe coding to agentic engineering. arXiv preprint arXiv:2602.15763, 2026.arxiv.org/abs/2602.15763
- [20]Chujie Zheng, Shixuan Liu, Mingze Li, Xiong-Hui Chen, Bowen Yu, Chang Gao, Kai Dang, Yuqiong Liu, Rui Men, An Yang, Jingren Zhou, and Junyang Lin. Group Sequence Policy Optimization, 2025. URL https://arxiv.org/abs/2507.18071.






