AI Today

🏭 RepoFactory turns 10,159 code repositories into training environments for coding agents

· 4 min

In brief


🎓 Researchers from IQuest Research, Beihang University and Shanghai Jiao Tong University present RepoFactory in a paper dated November 18, 2026. The method turns real software repositories into verifiable training environments: an agent gets a written specification and must build a complete project from scratch, checked by the original's tests. A loop (the Environment Evolution Loop) revises specification, tests and checker until a score for validity, coupling and scope rises. The result is 10,159 environments from 17 domains. The model Qwen3.5-35B-A3B, fine-tuned on this data (RepoHorizen-35B-A3B), rises from 23.8 to 46.4 points on the NL2Repo benchmark and from 45.1 to 53.5 on average across five benchmarks. So far the method works only for Python projects.


📄 The paper "From Repositories to Training Environments: Scaling Long-Horizon Coding Agents with Environment Evolution Loop" appeared on November 18, 2026 (arXiv 2611.21152). Authors include Yang Tian, Tianyu Zheng, Jian Yang and Bryan Dai of Beihang University, Shanghai Jiao Tong University and IQuest Research. Code and dataset are linked at github.com/IQuestLab/RepoFactory and on Hugging Face (IQuestLab/RepoFactory); the page gives no link for the trained model's weights.

🎯 The problem: agents for long programming tasks need many verifiable training environments. Existing pipelines are linear and stop after validation; self-improvement with model rollouts is slow and costly for long tasks.

⚙️ The method: suitable repositories are searched and filtered (at least five implementation files, under 40,000 lines of Python, tests passing in a sandbox). A Docker runtime, an AST analysis and a synthesis agent follow; the agent writes the specification and an API manifest and checks them against the symbols the original tests import. The agent's task is to rebuild the project from the specification without the original code. The Environment Evolution Loop then optimizes, without rollouts and without training, the product Q = A · C · S: A is 1 if the original passes the tests and the unchanged empty workspace does not; C measures coupling through reachable call pairs in the call graph; S measures scope from line count and number of runtime dependencies. A construction agent (Qwen3.8-Max) revises oracle, specification and tests for up to 12 rounds and keeps a change only if the score strictly increases. On 500 sampled repositories, the number of valid environments rose from 169 to 347 (33.8 to 69.4 percent), mostly from the first repair.

📈 Results: the dataset holds 10,159 environments in 17 domains; the training data comprise 10,947 trajectories from 5,577 environments, with a median original of about 4,200 lines in 26 source files. For Qwen3.5-35B-A3B the figures (before to after) are: NL2Repo 23.8 to 46.4, SWE-bench Verified 65.8 to 72.2, SWE-bench Pro 42.4 to 47.6, SWE-bench Multilingual 59.7 to 61.0 and Terminal-Bench 2.1 33.7 to 40.5; on average 45.1 to 53.5. Without the evolution loop the average gain is +6.4 instead of +8.5 points. On NL2Repo, RepoHorizen's 46.4 is ahead of the GPT-5.5 (45.1), Gemini-3.1 Pro (33.4), DeepSeek-V4-Pro (38.5) and MiniMax-M3 (42.1) entries in the paper's table; Claude Opus 5 stands well above at 75.3. Against six open SWE datasets of about 11,000 trajectories each, RepoFactory leads on all five benchmarks; on NL2Repo the lead over the strongest baseline (OpenSWE, 25.2) is 21.2 points. Accuracy keeps rising with the number of environments, with no saturation seen by the authors. The NL2Repo gain ranges from 12.2 to 22.6 points depending on model size (9B, 27B, 35B-A3B).

🔬 Limits: the work covers only Python projects. The metrics C and S describe broad structure and do not say which capabilities a given task requires. The figures are the authors' own and have not been independently verified.

Sources

Open in the interactive reader →

This post was selected, researched, written and rated by AI. The AI can be wrong: check the sources. Imprint, privacy policy and terms of service