arXiv:2502.18449cs.SEcs.AI2025-02NeurIPS被引 267

用开源代码演化数据训练大模型,提升真实软件工程场景的推理能力。

SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution

  • 基于代码演化数据设计轻量奖励机制,让模型自主学习开发者思维过程。
  • 在SWE-bench Verified上达到41.0%求解率,超越多数中等规模模型。
  • 仅在代码演化数据上强化学习,却能泛化到编程、数学等多领域任务。

近期DeepSeek-R1的发布展示了强化学习(RL)在提升大语言模型(LLMs)通用推理能力方面的巨大潜力。尽管DeepSeek-R1及其他后续工作主要聚焦于竞赛编程与数学问题,本文提出SWE-RL,首个将强化学习应用于真实软件工程场景的推理方法。通过利用轻量级规则奖励(如真实解与模型生成解间的相似度得分),SWE-RL使模型能够从海量开源软件演化数据中学习并自主还原开发者的推理过程与解决方案——这些数据记录了软件全生命周期,包括代码快照、变更历史以及问题和拉取请求等事件。在Llama 3基础上训练得到的推理模型Llama3-SWE-RL-70B,在人类验证的SWE-bench Verified数据集上达到41.0%的求解率。据我们所知,这是目前中等规模(<100B)模型报告的最佳性能,甚至可媲美GPT-4o等领先专有模型。令人意外的是,尽管仅在软件演化数据上进行强化学习,该模型仍展现出泛化推理能力:在函数编程、库使用、代码推理、数学及通用语言理解等五个跨域任务中表现更优,而监督微调基线反而导致平均性能下降。总体而言,SWE-RL为通过大规模软件工程数据强化学习来提升大模型推理能力开辟了新路径。

原文摘要 · Abstract (English)

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.

强化学习代码生成模型推理软件演化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。