| RLEF | |
|---|---|
| dialog before answer t; answer t | |
| policy being trained; starting model, the KL reference | |
| task reward; reward with the KL penalty | |
| weight of the KL penalty | |
| @ | solve rate with submissions chosen from answers |
| SWE-RL | |
| one sampled response: reasoning and edits | |
| predicted patch; merged patch | |
| difflib similarity, in | |
| reward of response | |
| Constants | |
| RLEF's KL weight | |
| RLEF's final reward; its penalty for an answer without valid code | |
| 3 | RLEF's turn limit in training and main evaluations |
| 16 | SWE-RL's responses per issue, the GRPO group |
Context. In code a reward can be computed by running the program on tests. Earlier RL for code used that signal for single attempts, while the loops used in practice (write code, run it, read the error, repair) were built by prompting, and at an equal number of samples they rarely beat drawing independent solutions. Real software adds a second problem. Most repositories cannot be built and run cheaply, so there are no tests to compute a reward from. Gehring et al. (2025), with RLEFreinforcement learning with execution feedback: RL through multi-turn episodes in which the model sees the results of running its code on example tests before trying again, train Llama 3 models with RL inside the repair loop itself, on competitive programming. Wei et al. (2025), with SWE-RLthe method's name, for RL on software evolution data: the record of code changes, issues and pull requests in public repositories, train on real GitHub issues and reward a generated patch by its textual similarity to the patch the developers merged, with no execution at all. Together they show that a model learns to use feedback when it is trained in the loop where the feedback arrives, and that the history of real repositories supplies a reward informative enough for RL where nothing can be run.
Both papers rest on two design choices. The reward comes from something the model cannot see or copy, held-out tests in RLEF and the developer's own patch in SWE-RL, and the training episode has the shape of the deployment loop. With these, an RLEF-trained 70B model solves 40% of the CodeContestscompetitive programming problems with public and hidden tests; 13,328 training problems (RLEF drops 669 that lack public or private tests), 117 validation and 165 test problems test problems with at most three attempts, more than earlier GPT-4 pipelines reached with up to 100 samples, and its repairs depend on what the feedback says. SWE-RL's 70B model resolves 41.0% of the issues in SWE-bench Verified500 real GitHub issues from Python repositories, checked by humans to be solvable, each graded by running the repository's tests on the submitted patch, ahead of a supervised model trained on the same pull requestsproposed code changes submitted for review and merging into a repository, with their discussion and linked issues, and it matches or beats its base model on every out-of-domain benchmark reported, where the supervised model falls below the base on most.
Setting. An RLEF episode is a dialog: the problem statement, a code answer, the result of running it on the problem's public teststhe example inputs and outputs given with a problem, used for feedback during the episode (failed inputs with expected and actual output, an exception trace, a timeout or a memory error), another answer, and so on. It ends when the public tests pass or after three answersthe turn limit used in training and in the main evaluations, and the final answer is then run on the private testswhy: the model never sees them; graded on the public tests alone, it could copy the expected outputs shown in the feedback into its next answer. With the policy being trained, the language model writing each answer, its starting model the initial Llama 3 Instruct model, also the reference of the KL penalty and the dialog before answer : problem statement, earlier answers and their feedback, each answer receives where the task reward at the end of an episode whose final answer passes all public and private tests, if any test fails, for an answer with no valid code, otherwise 0, and the weight of the KL penalty, 0.05 weights a KL penaltythe log ratio subtracted from the reward, whose expectation is the Kullback-Leibler divergence of the trained model from its start. Training uses PPOproximal policy optimization: policy-gradient RL that clips each update so the policy moves only a little, with a learned value function as baseline on CodeContests, starting from the Instruct versions of Llama 3.0 8B and Llama 3.1 8B and 70B. Results are @the expected fraction of problems solved when final answers, chosen from generated answers, are submitted; each turn of a dialog counts as one of the solve rates. An SWE-RL prompt holds an issue, the full contents of the files the merged pull request changed and of some relevant unchanged files, and asks for reasoning followed by search-and-replace edits. A response receives with the ratio of Python's difflib.SequenceMatcher: twice the number of matched elements over the total length of both sequences, a number in comparing the predicted patch the patch extracted from the model's edits with the merged patch the patch the developers merged for the issue. Llama-3.3-70B-Instruct is trained with GRPOgroup relative policy optimization: PPO-style updates without a value function, where each response's advantage is its reward minus the group mean, divided by the group standard deviation on groups of 16 responses per issue.
Main findings (all empirical). RLEF raises the 1@3one final answer from at most three generated answers, which is one dialog with up to three turns test solve rate, in percent, from 10.5 to 16.0 at 8B and from 27.5 to 40.1 at 70B; the previous best, the GPT-4 agent pipeline AlphaCodiuma hand-designed multi-step pipeline that prompts a model to reflect, generate tests, write code and repair it, scored 29 with 5 answers from 100 samples. At 10@100 the gains are smaller (50.3 to 54.5 at 70B), which the authors read as RL reducing the diversity of outputs. Before RLEF, a feedback dialog gains little or nothing over independent answers at the same budget (the same ), for Llama or GPT-4o; after it, the dialog is clearly ahead, and repairs largely fail when the feedback comes from an unrelated problem. Supervised fine-tuning on successful dialogs, or RL on single answers, falls well short. SWE-RL resolves 41.0% of SWE-bench Verified against 36.2% for the supervised baseline; given the right files and one greedy answer, it repairs 34.8% of issues against 29.6% for supervised training and 5.4% for the base model, and its similarity reward beats an exact-match reward (34.8 against 29.0).
Consequences and limits. For a coding agent the lesson is to train in the deployment loop, reward on tests the model cannot see, and count every attempt against the budget; feedback helps mainly a model trained to use it. When no tests can be run, similarity to real human fixes is a usable reward, and repository history supplies far more training issues than curated benchmarks. The limits differ by paper. RLEF improves one self-contained program per problem, needs test cases, and its gains shrink at large sample budgets. SWE-RL's reward measures how closely a patch resembles the developer's, so a correct fix written differently gets a low reward, a limitation the authors state; its benchmark score also depends on a pipeline with 500 samples per issue and test-based reranking, and training never involved execution. Neither paper reports error bars on its main benchmark.
In RLEF, training makes a feedback dialog beat independent answers at the same budget. At 1@3 the Llama 3.1 Instruct models score about the same answering three times independently or in one feedback dialog (test set, 8B: 11.8 and 10.5; 70B: 26.2 and 27.4), and GPT-4o does slightly worse with feedback (25.3 and 24.3), which reproduces the earlier finding that repair loops rarely beat independent sampling. After RLEF the dialog is far ahead: 9.7 for three independent answers against 16.0 for the dialog at 8B, 30.3 against 40.1 at 70B. The multi-turn gain carries over to HumanEval+ and MBPP+benchmarks of short Python functions written from a description, with extended test suites, whose feedback format differs (70B dialogs, before and after RLEF: 75.0 to 80.4 and 70.2 to 72.2). With up to 100 samples spread over dialogs, RLEF models do better with 3, 5 or 10 turns per dialog than with independent answers, best at 5, while the 8B model before training does best with independent answers at most budgets.
In RLEF, the gain comes from reading the feedback. Better scores in a dialog could come from more diverse attempts or from repair. To separate the two, the feedback at inference is replaced by the result of running a wrong solution to an unrelated problem, while episodes still stop when the true public tests pass. With true feedback, RLEF models fix far more errors of every type in turns 2 and 3 than the starting models, which often resubmit the same code. With random feedback these repairs largely disappear, and pass@1the probability that the final answer of one dialog is correct; pass@10 is the probability that at least one of 10 dialogs ends correct falls, and falls more as the turn limit grows, while pass@10 drops only slightly, so with useless feedback the model falls back on sampling new attempts, and with real feedback it repairs the one it has. RLEF models also produce fewer wrong outputs in their first answer, and more timeouts.
In RLEF, RL in the multi-turn loop matters more than the data or the turns alone. Supervised fine-tuning on 313,639 successful dialogs sampled from the 70B model gives test solve rates of 10.0 (8B) and 27.2 (70B), against 16.0 and 40.1 for RLEF, and few-shotwith a few worked example dialogs placed in the prompt examples of such dialogs hurt. RL on single answers, with the same training loop but no feedback turns, gives 10.9 (8B) and 32.9 (70B) when the model is then used in dialogs; at 8B, adding a separately trained repair model gives 12.6, and RL with the feedback text withheld (the model is only asked to try again) gives 10.9. Two implementation choices also matter. The value function predicts one value per answer, from the last token of its prompt, and every token of the answer shares that advantage; a per-token value gives 13.7 at 8B. The KL term takes an answer's probability as the geometric mean of its token probabilities, so the penalty is the average of the per-token log ratios rather than their sum, which the authors chose to avoid a bias toward short answers.
In SWE-RL, repository history yields RL data at scale, and the reward must credit partial matches. All public GitHub events from 2015 to August 2024 and clones of 4.6M repositories are joined into 24M pull requests with their issues, discussion and file contents at the merge basethe commit from which the pull request's changes started, the state a developer actually worked on, filtered of bot changes and empty or enormous diffs to about 11M, and reduced by heuristics (a linked bug-fixing issue, edits to code files) to 273k seeds, the pull requests used for training, with every SWE-bench repository excluded. Early runs that showed only the changed files taught the model to edit every file it was shown, so Llama 3.1 70B predicts relevant unchanged files to include. An exact-match reward grows more slowly, and its average over training samples is still near zero at the end of training. The paper's reason: real fixes vary too much to reproduce verbatim, while the similarity reward credits partial progress; a further one, which it does not state, is that a group of equal rewards gives GRPO no advantage to follow. Trained the same way, the exact-match model still repairs 29.0% of issues with the right files given (repair is judged by tests, not by matching the merged patch), against 34.8%, at similar format accuracy.
In SWE-RL, RL repairs better than supervised training on the same pull requests. The supervised baseline is trained on reasoning and edits that Llama-3.3-70B-Instruct wrote when shown each seed's real patch, filtered to well-formed edits that apply to the files, on similar synthetic file-localization answers, and mixed with general coding and dialog data. With the right files in context and one greedy answer, the base model produces a well-formed edit only 12.2% of the time and repairs 5.4% of issues (16.6% with a 20-sample majority vote); supervised training raises format accuracy to 96.2% and repair to 29.6%, and RL reaches 34.8% at 95.6% format accuracy. In the full pipeline, Agentless Minia fixed sequence of model calls: find the relevant files, sample repairs, generate tests that reproduce the issue, then rerank patches by those tests and the repository's existing tests, RL gives 41.0% and supervised training 36.2%. The score grows from 33.6% with the fewest repair samples tried to 40.0% at 160 and then flattens (41.0% at 500), and from 38.8% to 41.0% as reproduction tests go from 1 to 20. The RL model also localizes files and writes reproduction tests, tasks it was never trained on (the supervised model saw localization data).
In SWE-RL, RL on issues alone keeps other skills, while supervised training loses some. Zero-shot and greedy, the RL model matches or beats its base on every out-of-domain benchmark reported: HumanEval+ 79.9 against 76.2, CRUXEvala benchmark of predicting a short Python function's output from its input (O) or an input from its output (I)-O 75.5 against 61.9, MATH 73.7 against 63.2, MMLUmultiple-choice questions on 57 academic and professional subjects 86.8 against 86.5, and equal on BigCodeBench-Hardharder tasks of a benchmark of practical Python functions that call many libraries. The supervised model falls below the base on HumanEval+, BigCodeBench, MMLU and strict-format MATH, while gaining on CRUXEval. Part of the MATH gap is format: only the RL model reliably writes the requested "Answer:" line, and with a lenient parser the base model scores 70.9 and the supervised model 71.7. Single gains of one or two points are within noise, as the authors acknowledge, and they argue significance from the consistent direction across benchmarks. Reasoning traces with self-reflection and alternative approaches are shown in-domain and out, as qualitative examples.
Terms
- RLEF
- PPO through dialogs of up to three answers with execution feedback from public tests; reward from public and private tests at the end
- Public vs private tests
- feedback comes from the public tests; the reward needs the hidden ones, so expected outputs cannot be copied
- @
- every turn counts as a sample, so dialogs and independent answers are compared at equal budget
- Turn-level value
- one value per answer, predicted at its prompt's last token; a per-token value did worse (13.7 against 16.0 at 8B)
- Random-feedback test
- feedback from an unrelated problem removes most repairs; pass@1 falls, pass@10 barely
- SWE-RL reward
- for malformed output, else difflib similarity of the predicted to the merged patch
- Exact-match reward
- still near zero at the end of training; 29.0% repair against 34.8% for similarity
- Relevant unchanged files
- added to prompts so the model does not learn to edit every file it is shown
- Agentless Mini
- find files, sample 500 repairs, generate reproduction tests, rerank; 41.0% on SWE-bench Verified
- Out-of-domain effect
- RL matches or beats the base model everywhere reported; supervised training on the same seeds falls below it on most
Quiz
- Why do SWE-RL prompts include relevant files that the merged pull request did not change?If every file shown needs an edit, the model learns that shortcut and fails when the context contains irrelevant code, as it does in real use. Distractor files force it to locate the fault.
- What is the main limitation of SWE-RL's reward that the authors themselves state?difflib similarity measures surface resemblance to the merged patch, not functional equivalence, so the policy is discouraged from exploring valid alternative fixes. No execution or learned reward model is involved.
- On MATH with the strict answer format, the RL model scores 73.7, the base 63.2 and the supervised model 54.0. How should this be read?Only the RL model reliably wrote the requested answer line; relaxing the parser shrinks the gap to 2 to 3 points. The direction still favors RL, but most of the strict gap is format.
Sources
- Jonas Gehring, Kunhao Zheng, Jade Copet, Vegard Mella, Taco Cohen, and Gabriel Synnaeve. RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learning. ICML, 2025.
- Yuxiang Wei et al. SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution. NeurIPS, 2025.