AI guides

RepoFactory uses low-cost proxy metrics to recursively improve long-horizon coding environments

By 机器之心0 viewsSource: 机器之心
RepoFactory uses low-cost proxy metrics to improve long-horizon coding environments

Researchers from Beihang, Shanghai Jiao Tong and IQuest propose RepoFactory, using sanity, implementation scope and structural coupling to improve coding environments. A fine-tuned 35B-A3B model rises from 23.8 to 46.4 on NL2Repo-Bench. The first release contains 200 unevolved environments.

Improving environments during their construction

Software development is a core application for coding agents. Expectations are expanding from fixing bugs and implementing individual features to longer and more complex development tasks. Training solely on short tasks centered on local changes cannot cover that full process, creating a need for long-horizon training environments for complete project development.

Real software repositories provide rich material for such tasks. Existing environment-construction pipelines, however, often stop at execution and validation, without further optimizing how much training value a task offers or how it could improve. Being runnable and scorable is the foundation of a usable environment; tasks also need to provide substantial experience in implementation and component collaboration.

Methods for continually increasing a task environment's training value during construction often rely on model rollouts, or downstream evaluations after model training, to judge whether modifications help. In long-horizon coding, a complete solution already entails extensive implementation and debugging, increasing the computational cost and wait for feedback. Researchers from Beihang University, Shanghai Jiao Tong University and IQuest propose RepoFactory to bring the feedback-driven iteration of recursive self-improvement, or RSI, into environment construction. Their question is whether reliable, low-cost, immediate proxy metrics can replace expensive, slow downstream feedback to guide continual environment improvement.

Article illustration

  • Paper: From Repositories to Training Environments: Scaling Long-Horizon Coding Agents with Environment Evolution Loop
  • Project: https://github.com/IQuestLab/RepoFactory
  • Dataset: https://huggingface.co/datasets/IQuestLab/RepoFactory

RepoFactory divides the objectives of environment evolution into three parts:

  • Sanity requires the reference implementation to receive full marks and the unmodified initial workspace to receive zero, allowing evaluation to distinguish a completed task from one not yet implemented.
  • Implementation scope combines code size with direct runtime dependencies to reflect the implementation work required by the task.
  • Structural coupling uses function-call reachability to reflect structural connections between implementations.

The construction agent first meets sanity requirements, then jointly modifies the reference implementation, task description and tests using feedback on implementation scope and structural coupling. Scope encourages more substantial development work, while coupling encourages more connections between implementations. Together, these proxies for training value guide improvements to task content.

After each round of modifications, validation runs and code analysis produce fresh results to guide the next iteration. The loop does not wait for a solver model's complete rollout or depend on downstream training evaluations after every modification, enabling recursive environment improvement with relatively inexpensive feedback.

Article illustration

Figure 1. The RepoFactory pipeline and environment evolution loop

Training gains come from both the environments and their evolution

The team supervised-fine-tunes Qwen3.5-35B-A3B on RepoFactory environments to produce RepoHorizen-35B-A3B. Its NL2Repo-Bench score rises from 23.8 to 46.4, an increase of 22.6 percentage points. Across five evaluations—NL2Repo-Bench, three SWE-bench benchmarks and Terminal-Bench 2.1—the average gain is 8.5 percentage points. Gains span complete repository generation, repository issue resolution and long-horizon terminal tasks, indicating that this development experience can transfer across different software engineering tasks.

Environment evolution provides additional benefits. Compared with a model trained on unevolved environments, evolved environments improve NL2Repo-Bench by 5.1 percentage points and the five-benchmark average by 2.1 percentage points, with improvements on every benchmark. These proxy-guided modifications ultimately yield downstream training gains, providing experimental support for using inexpensive, immediate feedback to increase environments' training value.

Article illustration

Article illustration

Figure 2. Complete evaluation results on five benchmarks

How proxy metrics contribute to environment improvement

Beyond the overall training results, the study examines sanity, implementation scope and structural coupling separately, testing whether these objectives help expand the supply of environments and guide improvements to task content.

Expanding the supply of usable environments through sanity feedback

In an experiment with 500 candidate repositories, environment evolution increases the number passing validation from 169 to 347 while retaining the same sanity requirements. Yield rises from 33.8% to 69.4%. Fixing construction defects through feedback retains candidates that would otherwise be discarded, producing more usable environments from the same repository pool and supporting scale-up.

Article illustration

Article illustration

Figure 3. The effect of environment evolution on valid-environment yield

Controlled experiments: optimizing S and C separately

To test the training-value proxies further, the study starts from the same randomly sampled set of 1,000 environments and optimizes either implementation scope S or structural coupling C alone, retaining sanity checks. Both groups are sampled at rounds 3, 6, 9 and 12 to form four evolution stages, collecting 2,000 training trajectories per stage. Downstream performance is compared using the same base model and training setup.

Ablation tests for implementation scope and structural coupling

Implementation scope S: more substantial implementation and debugging

After optimizing S, interaction rounds, context length and supervised token count increase with the evolution stage, while NL2Repo accuracy rises steadily from 30.2% in stage one to 32.9% in stage four. With the same number of trajectories, broader implementation scope gives the model more substantial implementation and debugging experience and improves repository reconstruction.

Structural coupling C: more connections between implementations

Optimizing C produces a different pattern. Accuracy fluctuates in intermediate stages before ultimately rising from 30.2% to 32.5%; interaction rounds decline, while context length and supervised token count decrease only slightly. Performance improves without longer trajectories or more supervised tokens, supporting structural coupling as a signal for task-content improvement. Compared with expanding implementation scope, it offers a different direction for environment evolution, focusing on connections between implementations and the collaboration they require.

Article illustration

Article illustration

Figure 4. Ablation experiments optimizing implementation scope and structural coupling separately

An initial release of 200 unevolved environments

RepoFactory's full collection contains 10,159 environments across 17 software domains, currently focused primarily on Python projects. The figure below shows the statistical distributions of the full environment collection and training data.

Article illustration

Figure 5. Statistics for RepoFactory environments and training data

The project's initial release includes 200 environments that have not yet undergone environment evolution and their corresponding prebuilt Docker images, using the Harbor task format. Each task includes requirements, runtime configuration, a reference implementation and a verifier. They can be used to collect long-horizon coding trajectories, train coding agents, and study environment evolution and training-data value.

This article comes from Synced; author: Synced.

Related topics

After reading

Join the AINRK community

Read how to join the community and connect with people working in AI.

Community information (opens in a new tab)