SWE-RL: Self-Play Software Engineering with Reinforcement Learning
December 26, 2025 ยท View on GitHub
An implementation of Self-play SWE-RL (SSR) - where AI agents create their own software engineering training tasks and learn to solve them.
๐ Based on Groundbreaking Research
This project implements concepts from:
"SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution"
Yuxiang Wei, Olivier Duchenne, Jade Copet, Quentin Carbonneaux, Lingming Zhang, Daniel Fried, Gabriel Synnaeve, Rishabh Singh, Sida I. Wang
Meta AI (FAIR) โข University of Illinois Urbana-Champaign โข Carnegie Mellon University
๐ Read the paper
We are deeply grateful to the research team for publishing this innovative work that demonstrates how reinforcement learning on real-world software evolution data can advance LLM reasoning capabilities.
๐ฏ What is SSR?
Self-play SWE-RL is a paradigm where:
- An Injector Agent creates realistic bugs in working code
- A Validator ensures the bugs are meaningful and solvable
- A Solver Agent attempts to fix the bugs using only test feedback
- Both agents improve through this self-play loop
โโโโโโโโโโโโโโโ
โ Inject โ โโโโ Creates bug + oracle test
โ Agent โ
โโโโโโโโฌโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโ
โ Validate โ โโโโ 7-step verification
โ (7 steps) โ
โโโโโโโโฌโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโ
โ Solver โ โโโโ Fixes bug using test only
โ Agent โ
โโโโโโโโฌโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโ
โ Reward โ โโโโ +1.0 if solved, 0.0 otherwise
โโโโโโโโโโโโโโโ
๐ Repository Structure
โโโ ssr-studio/ # Main implementation
โ โโโ demo.py # Run a complete episode
โ โโโ examples/ # Sample project for testing
โ โโโ src/ # Python backend
โ โโโ ui/ # Next.js dashboard
โโโ CONTRIBUTING.md
โโโ LICENSE
โโโ README.md # You are here
๐ Quick Start
cd ssr-studio
pip install openai anthropic rich pytest
# Run the demo (requires API key)
python demo.py --api-key YOUR_OPENAI_KEY
See ssr-studio/README.md for full documentation.
๐ฌ Key Innovation: 7-Step Validation
The SSR paper introduces rigorous validation for generated bugs:
| Step | Validation |
|---|---|
| 1 | Test file exists |
| 2 | Code parses correctly |
| 3 | Original tests still pass |
| 4 | Bug is in allowed scope |
| 5 | Oracle test fails on buggy code |
| 6 | Oracle test passes on clean code |
| 7 | Inverse mutation testing |
This ensures every generated training example is meaningful.
๐ Research Applications
- Training data generation - Create unlimited bug/fix pairs
- Model evaluation - Compare LLM fixing capabilities
- Self-improvement - Enable agents to generate their own curriculum
- Benchmark creation - Generate SWE-bench-style tasks
๐ Citation
@article{wei2024swerl,
title={SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution},
author={Wei, Yuxiang and Duchenne, Olivier and Copet, Jade and Carbonneaux, Quentin and Zhang, Lingming and Fried, Daniel and Synnaeve, Gabriel and Singh, Rishabh and Wang, Sida I.},
journal={arXiv preprint arXiv:2512.18552},
year={2024}
}
๐ License
MIT License - see LICENSE for details.