Rust in Everything
← Papers

From Repositories to Training Environments: Scaling Long-Horizon Coding Agents with Environment Evolution Loop

Yang Tian, Tianyu Zheng, Xiyuan Yang, Yaxin Du, Chengran Yang, Bo Zhao et al.

2026-11-18▲ 12arXiv 2611.21152v2Hugging FaceCode

AI-generated from the full paper (deepseek-flash). It may contain mistakes; check the original.

TL;DR

RepoFactory converts real repositories into full-repository generation environments and uses a low-cost proxy feedback loop to improve their training value, yielding RepoHorizen-35B-A3B with a 22.6-point NL2Repo gain.

Problem

Existing environment-construction pipelines often follow a linear process that ends with validation, keep the reference implementation fixed, and discard repositories that remain unsuitable even when further revision could make them usable. Feedback such as execution diagnostics and coverage improves reliability but does not explicitly optimize training value, which may remain limited when tasks require little implementation work or coordination across components. Using model rollouts or downstream training for feedback is costly and delayed, especially for long-horizon coding tasks.

Method

RepoFactory converts real-world repositories into verifiable environments e=(I,W,V,O), where I is the language specification, W is an isolated workspace and runtime, V is the verifier, and O is the oracle implementation. During training, an agent receives (I,W) and reconstructs a project P=π(I,W), which is scored by V(P) in [0,1]. The pipeline searches for repositories, reconstructs their runtimes, and synthesizes task specifications from repository evidence. The Environment Evolution Loop jointly revises the oracle implementation, task specification, and tests to maximize Q=A·C·S within a fixed construction budget. All construction agents use Qwen3.8-Max.

Results

  • Training Qwen3.5-35B-A3B on RepoFactory environments yields gains of 22.6 percentage points on NL2Repo-Bench and 8.5 points on average across five benchmarks, compared with 17.5 and 6.4 points without environment evolution. §Abstract
  • On NL2Repo, training raises the score from 23.8 to 46.4, a gain of 22.6 points; RepoHorizen also surpasses GPT-5.5, Gemini-3.1 Pro, DeepSeek-V4-Pro, and MiniMax-M3. §5.2
  • NL2Repo performance rises from 23.8% without RepoFactory environments to 46.4% with 5,577 environments, and adding the remaining 2,577 beyond 3,000 raises performance from 36.5% to 46.4%. §5.3
  • In the evolution recovery test on 500 sampled repositories, allowing up to three repair steps increases validated environments from 169 to 347 and yield from 33.8% to 69.4%. §5.6
  • RepoFactory reaches 46.4 on NL2Repo and leads all six open-data baselines; its advantage over the strongest baseline, OpenSWE, is 21.2 points, and the highest published NL2Repo score is 28.9. §5.5
  • Optimizing implementation scope S raises NL2Repo accuracy from 30.2% at Level 1 to 32.9% at Level 4, while optimizing structural coupling C reaches 32.5% at Level 4 versus 30.2% at Level 1. §5.6

Limitations

  • The paper states that RepoFactory currently focuses on Python projects, with relatively limited coverage of other programming languages (§7).
  • The paper states that its proxy metrics characterize task content at a broad structural level and do not yet explicitly distinguish the capabilities required by individual tasks (§7).
  • Environment scaling is tested up to 5,577 environments, and the paper reports no evidence of saturation there (§5.3); behavior at larger scale is left open.
  • Training experiments cover Qwen3.5 models at 9B, 27B, and 35B-A3B (§5.4), leaving transfer to other model families open.

Key points

  • RepoFactory produces 10,159 verifiable full-repository generation environments across 17 software domains. §1
  • Environments are full repository generation tasks: an agent must build a complete, functioning repository from scratch given a language specification. §3
  • The multiplicative objective is Q=A·C·S, where validity A requires V(O)=1 and V(P0)=0, structural coupling is C=R/N^2, and implementation scope is S=log10(LOC)+log10(1+D)-2. §3.1
  • The Environment Evolution Loop jointly revises the oracle implementation, task specification, and tests within a fixed construction budget. §3.1
  • To collect SFT data, Qwen3.8-Max is run five times on each environment, low-reward trajectories are filtered out, and 10,947 samples spanning 5,577 environments are retained. §4
  • NL2Repo gains range from 12.2 to 22.6 percentage points across the 9B, 27B, and 35B-A3B models, with the 35B-A3B model gaining the most despite the 27B model’s higher baseline. §5.4
  • Each open-data baseline contains 11,000 training trajectories, slightly more than RepoFactory. §5.5
  • Inline Python execution appears in 88.2% of trajectories, assertion or diff checks in 78.0%, and test-suite execution in 33.2%. §B.2

Mind map

RepoFactory
Problem
Linear pipelines end at validation
Fixed reference implementations discard repos
Feedback targets reliability not training value
Rollout feedback costly on long-horizon tasks
Method
Real repositories to verifiable environments
Full repository generation from spec
Search reconstruct runtime synthesize spec
10,159 environments across 17 domains
10,947 SFT samples from 5,577 environments
Objective
Q equals A times C times S
A validity oracle 1 unchanged workspace 0
C equals R over N squared
S equals log10 LOC plus log10 1+D minus 2
Evolution Loop
Joint revision of oracle spec tests
Fixed construction budget
Validated environments 169 to 347
Yield 33.8 percent to 69.4 percent
Optimizing S raises NL2Repo 30.2 to 32.9
Optimizing C reaches 32.5 at Level 4
Results
NL2Repo 23.8 to 46.4
Gain 22.6 vs 17.5 without evolution
Average gain 8.5 vs 6.4
Evolution adds 5.1 NL2Repo and 2.1 average
Data source 46.4 vs OpenSWE 25.2
Model-size gains 12.2 to 22.6
Limitations
Python only
Proxies are broad structural measures
No individual capability distinction
Scaling beyond 5,577 untested
Transfer to other model families open