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 Wang

arXiv:2502.18449 · 2026-07-27 공개 · arXiv · PDF

reinforcement-learning code-generation llm-reasoning swe-bench software-engineering software-evolution llama3 open-source-software

Abstract

The recent DeepSeek-R1 release has demonstrated the immense potential of reinforcement learning (RL) in enhancing the general reasoning capabilities of large language models (LLMs). While DeepSeek-R1 and other follow-up work primarily focus on applying RL to competitive coding and math problems, this paper introduces SWE-RL, the first approach to scale RL-based LLM reasoning for real-world software engineering. Leveraging a lightweight rule-based reward (e.g., the similarity score between ground-truth and LLM-generated solutions), SWE-RL enables LLMs to autonomously recover a developer's reasoning processes and solutions by learning from extensive open-source software evolution data -- the record of a software's entire lifecycle, including its code snapshots, code changes, and events such as issues and pull requests. Trained on top of Llama 3, our resulting reasoning model, Llama3-SWE-RL-70B, achieves a 41.0% solve rate on SWE-bench Verified -- a human-verified collection of real-world GitHub issues. To our knowledge, this is the best performance reported for medium-sized (<100B) LLMs to date, even comparable to leading proprietary LLMs like GPT-4o. Surprisingly, despite performing RL solely on software evolution data, Llama3-SWE-RL has even emerged with generalized reasoning skills. For example, it shows improved results on five out-of-domain tasks, namely, function coding, library use, code reasoning, mathematics, and general language understanding, whereas a supervised-finetuning baseline even leads to performance degradation on average. Overall, SWE-RL opens up a new direction to improve the reasoning capabilities of LLMs through reinforcement learning on massive software engineering data.

한국어 요약

한 줄 요약

SWE-RL은 소프트웨어 진화 데이터와 규칙 기반 보상으로 LLM의 추론 능력을 향상시키는 새로운 강화 학습 접근법이다.

핵심 기여도

핵심 아이디어

SWE-RL은 소프트웨어 진화 데이터를 기반으로 LLM이 개발자의 추론 과정과 해결책을 자율적으로 학습하도록 유도하는 강화 학습 프레임워크이다. 기존 연구는 주로 경쟁 프로그래밍이나 수학 문제에 RL을 적용했으나, SWE-RL은 실제 소프트웨어 개발 환경에서 발생하는 이슈와 코드 변경 기록을 학습 데이터로 활용한다. 이는 소프트웨어의 전체 라이프사이클을 기록한 데이터(예: PR, 이슈, 코드 스냅샷)를 통해 모델이 실제 개발자와 유사한 추론 과정을 배울 수 있도록 한다. 핵심적인 아이디어는 규칙 기반 보상(예: difflib.SequenceMatcher 유사도 점수)을 사용하여 정확한 패치 생성을 유도하는 동시에, 학습 과정에서 형식 오류(예: 잘못된 패치 형식)에 대해 -1 점수를 부여함으로써 정확도를 높인다.

기술적 접근법

주요 결과

의의 및 한계

SWE-RL은 소프트웨어 진화 데이터를 기반으로 LLM의 추론 능력을 향상시키는 새로운 방향을 제시한다. 특히, 실제 개발 환경에서 발생하는 이슈를 해결하는 능력을 학습함으로써, 기존의 경쟁 프로그래밍 중심의 RL 접근법과 차별화된다. 또한, 학습된 모델이 OOD 태스크에서도 성능 향상을 보이는 점은 LLM의 일반화 능력 향상에 기여한다. 그러나 한계도 존재한다. 첫째, 보상 함수가 시퀀스 유사도를 기준으로 하기 때문에 의미적 동등성은 고려하지 않아, 대안적인 해결책을 탐색하는 데 제한이 있다. 둘째, Agentless Mini는 파일 경로 매핑을 기반으로 로컬라이제이션을 단순화하여 전체 컨텍스트를 고려하지 못한다. 셋째, 파이프라인 기반 접근법은 모델이 상호작용 피드백을 통해 학습하지 못하게 하며, 문제를 통합적으로 고려하는 능력을 제한한다. 넷째, 최적의 결과를 얻기 위해 높은 샘플링 예산이 필요하며, 실행 비용이 높은 프로젝트에서는 실용성이 떨어진다.

실용적 활용

SWE-RL은 실제 GitHub 이슈 해결, 코드 자동 생성, 라이브러리 사용 등 소프트웨어 엔지니어링 분야에서 즉각적으로 활용될 수 있다. 특히, 오픈소스 프로젝트에서 이슈를 자동으로 분석하고 해결하는 시스템 구축에 유용하며, 소프트웨어 테스트 자동화, 버그 추적, 코드 리팩토링 등 다양한 엔지니어링 작업에 적용 가능하다.