用单元测试自动生成可验证的软件开发任务,提升AI编程能力。
SWE-Flow: Synthesizing Software Engineering Data in a Test-Driven Manner
- 从单元测试反推开发步骤,构建运行时依赖图指导代码生成。
- 生成16,061个训练实例和2,020个测试实例,形成SWE-Flow-Eval基准。
- 适合研究TDD驱动的代码生成与自动化编程的开发者使用。
我们提出SWE-Flow,一种基于测试驱动开发(TDD)的数据合成框架。不同于依赖人工提交问题的现有软件工程数据,SWE-Flow直接从单元测试中自动推断增量开发步骤,这些测试天然包含高层次需求。其核心是构建运行时依赖图(RDG),精确捕捉函数间交互,从而生成结构化、分步的开发计划。每一步生成部分代码库、对应单元测试及必要代码修改,形成完整可验证的TDD任务。基于真实GitHub项目,我们生成了16,061个训练实例和2,020个测试实例,构建了SWE-Flow-Eval基准。实验表明,在该数据集上微调开源模型可显著提升基于TDD的编码性能。为促进研究,所有代码、数据集、模型及Docker镜像均已公开于[Github](https://github.com/Hambaobao/SWE-Flow)。
原文摘要 · Abstract (English)
We introduce **SWE-Flow**, a novel data synthesis framework grounded in Test-Driven Development (TDD). Unlike existing software engineering data that rely on human-submitted issues, **SWE-Flow** automatically infers incremental development steps directly from unit tests, which inherently encapsulate high-level requirements. The core of **SWE-Flow** is the construction of a Runtime Dependency Graph (RDG), which precisely captures function interactions, enabling the generation of a structured, step-by-step *development schedule*. At each step, **SWE-Flow** produces a partial codebase, the corresponding unit tests, and the necessary code modifications, resulting in fully verifiable TDD tasks. With this approach, we generated 16,061 training instances and 2,020 test instances from real-world GitHub projects, creating the **SWE-Flow-Eval** benchmark. Our experiments show that fine-tuning open model on this dataset significantly improves performance in TDD-based coding. To facilitate further research, we release all code, datasets, models, and Docker images at [Github](https://github.com/Hambaobao/SWE-Flow).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。