SuperAPI AI Directory

swe-rl

SWE-RL is the official code repository released by Facebook Research, corresponding to the paper "SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution" (NeurIPS'25). This work proposes the first method to extend reinforcement-learning-style LLM reasoning to real-world software engineering tasks, using open-source software evolution data and rule-based rewards for training. The code repository provides prompt templates and implementations of sequence-similarity-based reward functions, including three reward APIs: calculate_search_replace_reward, calculate_reward_unidiff, and calculate_reward, along with an Agentless Mini pipeline improved based on Agentless, supporting asynchronous inference, file-level localization, and reranking with multiple reproduction tests. The project has undergone code refactoring to improve quality and accessibility, and may differ from the internal implementation; if you encounter bugs, you can submit an issue. Overall, it is released under the CC BY-NC 4.0 license, and the Agentless Mini part uses the MIT license.

Open website

About this tool

Purpose

SWE-RL is the official code repository for the paper "SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution" (published at NeurIPS'25). This work proposes the first method to extend LLM reasoning capabilities through reinforcement learning for real-world software engineering tasks, trained with the help of open-source software evolution data and rule-based rewards.

Main Capabilities

The code repository currently provides the prompt templates and sequence-similarity-based reward function implementations used in the paper:

  • Prompt templates are located at src/swerl/core/prompts.py
  • Reward functions are located at src/swerl/core/reward.py

A total of three reward function APIs are provided:

  1. calculate_search_replace_reward: computes the similarity between search/replace changes and oracle changes (used in the paper);
  2. calculate_reward_unidiff: computes the similarity between two sets of unified diffs;
  3. calculate_reward: a more general API that can be paired with any edit format.

The repository also provides toy examples for search/replace change rewards, unified diff rewards, and the general version, and lists the function signatures of calculate_reward_unidiff and calculate_reward, which can be viewed in swerl.core.reward.

Agentless Mini

Agentless Mini is built on Agentless and brings the following key improvements and functional changes:

  • Uses openai-python for fast asynchronous inference;
  • Code refactoring with better extensibility, parallelization, and accessibility;
  • Performs only file-level localization, and the entire file content will be used for repair;
  • Supports reranking using multiple reproduction tests.

Usage

Environment setup: run the commands provided in the repository to install dependencies.

Agentless Mini can work with any OpenAI-compatible endpoint. If you want to self-host a Hugging Face model, a common choice is vLLM and SGLang. Taking vLLM as an example, the repository provides the corresponding launch method. In addition, the environment variables required by Agentless Mini need to be set.

Once the environment variables are configured correctly, Agentless Mini can be run. The simplest way is to provide an oracle file for repair, which can serve as a good proxy for end-to-end results. The repository also demonstrates a greedy decoding demo of the complete pipeline.

Applicable Scenarios

Training and research on large language model reasoning for real software engineering tasks, especially reinforcement learning experiments based on open-source software evolution data; the reward function can also be used in one's own projects to evaluate the similarity of search/replace changes or unified diffs.

Limitations and Notes

  • The project has undergone substantial code refactoring to improve quality and accessibility, which may lead to potential inconsistencies with the internal implementation; if you encounter bugs, you can submit an issue, and the repository is also gradually adding more information.
  • Due to refactoring and infrastructure differences, reproducing test generation, regression test selection, and test execution is currently a work in progress (WIP) and will be updated later.
  • Regarding licensing, most of SWE-RL is licensed under CC BY-NC 4.0, but some content in the project is subject to different license terms: Agentless Mini is licensed under MIT.

Acknowledgments

The repository thanks Agentless, SWE-Gym, SWE-Fixer, SWE-bench, Moatless EvalTools, and Nebius SWE-agent.

(Note: the repository name is swe-rl, and the official repository path is facebookresearch/swe-rl.)