Source-linked AI summary

daVinci-Agency: Unlocking Long-Horizon Agency Data-Efficiently

Mohan Jiang, Dayuan Fu, Junhao Shi, Ji Zeng, Weiye Si, Keyu Li, Xuefeng Li, Yang Xiao, Wenjie Li, Dequan Wang, Pengfei Liu

arXiv:2602.02619v2cs.LGcs.AIcs.SE

TL;DR

Long-horizon agents lack scalable supervision capturing authentic dependencies, evolution, and refinement. daVinci-Agency mines semantically linked PR chains into verifiable multi-stage trajectories, and fine-tuning GLM-4.6 on 239 samples yields broad benchmark improvements, including a 47% relative Toolathlon gain. The method supports long-horizon behaviors while remaining bounded by a current maximum of five linked PRs.

  • Problem

    Long-horizon agent learning lacks scalable training data that captures authentic cross-stage dependencies, evolutionary dynamics, and iterative refinement.

  • Method

    daVinci-Agency mines real-world PR evolution into semantically dependent chains that turn isolated coding tasks into coherent, verifiable multi-stage workflows.

  • Results

    Fine-tuning GLM-4.6 on 239 daVinci-Agency samples yields broad benchmark improvements, including a 47% relative gain on Toolathlon.

  • Takeaways & Limitations

    The results support using structurally rich PR-based trajectories to train long-horizon behaviors including planning, consistency, refinement, and error correction.

  • Takeaways & Limitations

    Task chains are currently limited to a maximum of five PRs because of success-rate constraints.

Abstract

from arXiv · show

While Large Language Models (LLMs) excel at short-term tasks, scaling them to long-horizon agentic workflows remains challenging. The core bottleneck lies in the scarcity of training data that captures authentic long-dependency structures and cross-stage evolutionary dynamics--existing synthesis methods either confine to single-feature scenarios constrained by model distribution, or incur prohibitive human annotation costs, failing to provide scalable, high-quality supervision. We address this by reconceptualizing data synthesis through the lens of real-world software evolution. Our key insight: Pull Request (PR) sequences naturally embody the supervision signals for long-horizon learning. They decompose complex objectives into verifiable submission units, maintain functional coherence across iterations, and encode authentic refinement patterns through bug-fix histories. Building on this, we propose daVinci-Agency, which systematically mines structured supervision from chain-of-PRs through three interlocking mechanisms: (1) progressive task decomposition via continuous commits, (2) long-term consistency enforcement through unified functional objectives, and (3) verifiable refinement from authentic bug-fix trajectories. Unlike synthetic trajectories that treat each step independently, daVinci-Agency's PR-grounded structure inherently preserves the causal dependencies and iterative refinements essential for teaching persistent goal-directed behavior and enables natural alignment with project-level, full-cycle task modeling. The resulting trajectories are substantial--averaging 85k tokens and 116 tool calls--yet remarkably data-efficient: fine-tuning GLM-4.6 on 239 daVinci-Agency samples yields broad improvements across benchmarks, notably achieving a 47% relative gain on Toolathlon. Beyond benchmark performance, our analysis confirms...

1. Introduction

Long-horizon agency requires supervision for cross-stage dependencies, error accumulation, and iterative refinement, which isolated or costly existing data-construction methods do not adequately provide. daVinci-Agency uses PR evolution to create scalable trajectories and reports broad benchmark gains with stronger planning, consistency, and refinement.

  • Motivation: Long-horizon tasks require task decomposition, long-term consistency, and refinement under cross-stage dependencies and accumulating errors.Single-feature tasks often do not expose these difficulties, motivating explicit supervision from cross-stage evolution.
  • Motivation: Existing construction methods rely on synthetic interaction trajectories or manual annotation, but often lack realistic cross-stage failure and refinement paths.These limitations constrain coverage or increase the cost of obtaining high-quality supervision.
  • Approach: PR sequences provide linked, externally verified iterations in which multiple submissions advance a common goal and later changes address defects or feedback.This makes PR chains a foundation for modeling long-cycle interactions.
  • Approach: daVinci-Agency chains up to five PRs into interdependent workflows averaging 85k tokens and 116 tool callings.The trajectories support training and evaluation of long-term planning, consistency, and iterative improvement.
  • Results: 47% relative gain on Toolathlon was obtained by fine-tuning GLM-4.6 on 239 daVinci-Agency samples, alongside broad benchmark improvements.The experiments report effectiveness on long-horizon tasks with a small training set.
  • Results: Case studies report stronger task decomposition, long-term consistency, and refinement, enabling more stable stage planning, global alignment, and error correction.The analysis also examines performance as interaction horizons and reasoning budgets increase.

2. Related Works

Related work frames agentic language models as systems that combine reasoning with external action, while newer long-horizon benchmarks raise requirements for extended execution. These developments motivate studying agents beyond short-horizon interaction.

  • Agentic Language Models: Agentic language-model research moved from passive generation toward autonomous decision-making with external tool use and interleaved reasoning and action.Toolformer and ReAct are presented as foundational examples.
  • Long-Horizon Agency: Long-horizon agency research increasingly evaluates sustained execution through benchmarks including SWE-bench, Toolathlon, UltraHorizon, and SWE-bench Pro.These benchmarks intensify requirements for agentic models beyond short interactions.

3 Preliminary

The preliminary formulation represents software engineering as sequential agent-environment interaction over evolving repositories and semantically linked PR chains. Rollouts are evaluated against ground-truth patches and retained as training data when they meet a quality threshold.

  • Task Formulation: The task is modeled as a sequential decision-making process between an agent and a software environment through an execution scaffold.The formulation adopts a Markov Decision Process perspective.
  • Interaction Protocol: At each step, the agent observes the environment and produces reasoning messages or tool executions such as editing files, running tests, and performing git operations.These two action modalities distinguish internal planning from environmental changes.
  • Interaction Protocol: A trajectory interleaves observations, reasoning messages, and tool executions across a horizon N to transform an initial repository state into a target state satisfying query q.The formal trajectory is represented as τ = (o0, m0, t0), (o1, m1, t1), . . . , (oN, mN, tN).
  • Software Evolution: The repository is treated as evolving through Pull Requests, each pairing natural-language context with a ground-truth code patch.This representation captures software development as a sequence of changes rather than a static snapshot.
  • Software Evolution: A PR Chain C is an ordered sequence of semantically linked PRs whose later members iterate upon, fix, or extend earlier changes.Successful implementation depends on maintaining context and state across the evolving codebase.
  • Data Construction: Rollouts condition reasoning and tool actions on the PR chain, query, and interaction history, then retain trajectories whose evaluation score s reaches at least 0.8.The resulting filtered dataset supports policy optimization through a negative log-likelihood objective.
  • Data Construction: daVinci-Agency is introduced as a long-horizon data-synthesis paradigm that extracts supervision from cross-stage evolution.Its sequential queries and alignment with evolving ground-truth states target task recomposition, consistency, and refinement.

4 daVinci-Agency: A Long-Horizon Data Synthesis Paradigm

daVinci-Agency constructs long-horizon training data from dependency-linked Pull Request chains and sequential rollouts over evolving code states. It filters trajectories for semantic fidelity to retain structured, multi-stage supervision.

  • Query Construction: Query construction uses natural-language context and a ground-truth patch to generate sub-queries that explain each PR’s problem and reasoning while withholding implementation details.The withheld details require agents to perform code navigation and localization during rollout.
  • PR-Chain Combination: The pipeline constructs PR chains from GitHub metadata and dependency citations, capturing non-contiguous feature evolution across ordered development stages.These chains model state management and long-term consistency rather than isolated problem solving.
  • Environment for Rollout: Sequential rollout carries previous agent patches onto each new base codebase, forcing later tasks to build on the agent’s evolved state.This transition mechanism targets long-term consistency and refinement after accumulated errors.
  • Evaluator for Rejection Sampling: Rejection sampling evaluates semantic alignment between generated and ground-truth patches, retaining trajectories that meet s ≥0.8 after up to three refinement iterations.Trajectories below the threshold are discarded.
  • Rollout Scaffold: The dataset logs complete trajectories across SII-CLI and miniswe-agent scaffolds, including observations, reasoning, and tool execution.The resulting interaction scales reflect the need for long-context coherence in software evolution.

5 Experiments

Experiments compare daVinci-Agency with external datasets, internal ablations, and multiple model architectures across long-horizon benchmarks. The results show broad gains, with benefits linked to authentic cross-stage PR evolution and extending across MoE and dense models.

  • Experimental Setup: daVinci-Agency is evaluated against open-source model baselines, external agentic datasets, and single-PR or chronological-chain variants across five long-horizon benchmarks.The benchmarks cover software engineering, tool use, interaction, file-level coding, and scientific coding.
  • Performance against Agent Datasets: Despite its smaller sample size, daVinci-Agency consistently outperforms the compared agent datasets across all benchmarks, with notable gains on Toolathlon and robustness on SWE-bench.The authors attribute this advantage to structured supervision from PR evolution rather than surface-level environment distillation.
  • Impact of Data Curation: The chain-of-PR ablation shows that isolated PRs reduce performance, chronological chains provide limited long-horizon benefits, and authentic logical dependencies yield the strongest data efficiency.The comparison links task decomposition, consistency, and refinement supervision to the full chain structure.
  • Main Results: 0.475 overall average score is reported for daVinci-Agency, alongside a 15.9 AgencyBench Code score and higher Toolathlon and τ 2-bench stability than Kimi-K2-Thinking.The model also leads competitors on SWE-bench according to the reported experiments.
  • Main Results: Training trajectories generated exclusively by GLM-4.6 align the fine-tuning setup with on-policy self-distillation rather than knowledge distillation from a superior teacher.The reported gains are attributed to GLM-4.6 self-exploration on curated multi-PR tasks.
  • Model Generalization Analysis: daVinci-Agency improves Qwen3-30B-A3B’s average score to 0.307 and SWE-bench from 0.242 to 0.262, while also improving dense Qwen3-32B and Qwen3-8B models.The results support effectiveness across MoE and dense architectures at different scales.

6 Long Horizon Analysis

daVinci-Agency improves long-horizon agents by internalizing structured planning, consistency, and refinement behaviors, while reducing token and tool use. Longer PR-chain trajectories and larger inference budgets further improve performance.

  • Meta-Skills Performance Comparison: The daVinci-Agency model decomposes validation into staged tests and catches an infinite-recursion error before execution, then fixes it with super().This contrasts with baseline goal drift and demonstrates structured refinement during multi-round interaction.
  • Execution Efficiency: Models trained on daVinci-Agency achieve higher success rates while consuming fewer tokens and tool calls on long-horizon tasks.The analysis attributes this efficiency to pruning redundant actions and more precise planning.
  • Execution Efficiency: 113.6K tokens are saved by GLM-4.6 and 288.8K by Qwen3-32B on SWE-bench after daVinci-Agency fine-tuning.Tool usage also falls by up to 25.8% on SWE-bench and 13.3% on Toolathlon.
  • Long Horizon Data Scaling: Extending average trajectory length from 59.39K to 84.82K tokens through additional PRs significantly enhances performance across long-horizon benchmarks.The longer data expansion completes previously unfinished PR chains and improves sequential training coverage.
  • Long Horizon Data Scaling: Up to 8% relative gains on SWE-bench and τ 2-bench follow the extension of successful trajectories with additional PRs.The reported gains support trajectory length as an effective scaling dimension for problem-solving proficiency.
  • Inference Budget Scaling: On SWE-bench, the performance gap between daVinci-Agency models and baselines widens as the allowed tool-call limit increases.This sensitivity analysis evaluates how the models use additional inference-time compute.

7. Conclusion

The paper presents daVinci-Agency as a scalable, verifiable way to train agents on coherent PR-chain workflows rather than isolated coding tasks. Its findings support longer evolutionary chains as a route to stronger long-horizon behavior, although current construction is limited to five PRs.

  • Conclusion: Extending training trajectories from 59.39K to 84.82K tokens significantly enhances performance across long-horizon benchmarks.Figure 7 presents this training-horizon scaling analysis alongside inference-budget scaling.
  • Conclusion: daVinci-Agency reconstructs semantically dependent PR chains, transforming isolated coding tasks into coherent multi-stage workflows.The approach mines real-world software evolution without relying on prohibitively expensive human annotation or teacher-bounded distillation.
  • Conclusion: The resulting structure targets task decomposition, long-term consistency, and iterative refinement that standard distillation methods fail to capture.These behaviors are presented as central to mastering complex engineering workflows.
  • Limitations and Future Work: The implementation currently connects a maximum of 5 PRs per task chain because of success-rate constraints.The paper identifies longer chains as future work for continued improvement.

A Repositories in daVinci-Agency

daVinci-Agency draws source data from nine repositories selected to cover diverse technology stacks, programming paradigms, domains, and development scales. The accompanying table reports processed PR counts and constructed query counts.

  • Repository Coverage: Table 4 lists nine source repositories used in daVinci-Agency, including each repository’s PR Num and Query Num.The table is described as the detailed statistical breakdown of the selected repositories.
  • Repository Coverage: The repository selection spans a wide spectrum of programming paradigms and domains.The stated goal is comprehensive coverage of diverse technology stacks and development scales.
  • Repository Coverage: numpy/numpy and scipy/scipy represent scientific computing and the Python ecosystem, covering mathematical logic and algorithm optimization.These repositories provide data on complex mathematical and optimization scenarios.
  • Repository Coverage: apache/pulsar and cloudquery/cloudquery represent distributed systems in Java and Go, including concurrency and system architecture scenarios.The examples emphasize high-complexity distributed-system development.
  • Repository Coverage: astral-sh/ruff and tursodatabase/libsql represent modern tooling and Rust/C high-performance systems programming.These repositories capture the stated shift toward high-performance systems programming.

B Efficacy of Rejection Sampling

Rejection sampling is presented as essential for filtering low-quality trajectories before fine-tuning. Unfiltered self-generated data severely degrades performance, whereas filtered supervision recovers and improves the model across benchmarks.

  • Rejection Sampling Ablation: Raw, unfiltered trajectories reduce the average score from 0.405 for the base model to 0.205 after fine-tuning.The ablation attributes this degradation to indiscriminate ingestion of noisy self-generated data.
  • Rejection Sampling Ablation: Rejection sampling raises the fine-tuned model’s average score to 0.421, recovering baseline capability while improving beyond it.The mechanism filters for high-fidelity supervision and valid reasoning paths.
  • Rejection Sampling Ablation: SciCode-MP performance rises from 0.062 for the base model to 0.169 with rejection sampling.The paper reports that this result more than doubles performance on the domain-specific benchmark.
  • Evaluation Prompt: The evaluator prompt is designed to judge whether an AI-generated patch achieves the reference PR’s functional effect while accepting functionally equivalent implementations.It distinguishes critical bugs and deviations from harmless differences in style, organization, or logic structure.

E. Training Parameters SII-GAIR

The training procedure requires structured patch evaluation and a strict JSON verdict. The output reports a bounded score and concise comment without additional narrative.

  • The patch is checked for syntax, runtime, logic, and resource errors.
  • The evaluator must return a strict JSON object containing score and comment fields.
  • The comment concisely states the overall verdict and highlights blocking issues or alignment with ground truth.
  • The response must not include Markdown fences or narrative outside the JSON object.

E Training Parameters

The training configuration uses supervised fine-tuning with shuffled rollouts and explicit loss settings, alongside extensive model-parallel and memory-management parameters.

  • Supervised fine-tuning uses rollout-generated prompt data with message and tool fields, shuffling, two epochs, and batch size 64.
  • The loss configuration uses SFT loss with per-token loss calculation and disables advantage and return computation.
  • The model uses tensor, pipeline, context, and expert parallelism with sizes 8, 4, 2, and 16 respectively.
  • Training enables full uniform recomputation, dynamic batch sizing, and a maximum of 65536 tokens per GPU.

E. Training Parameters SII-GAIR

The optimizer configuration uses Adam with cosine learning-rate decay, warmup, weight decay, and precision-aware CPU offloading.

  • Adam optimization is used with a learning rate of 2e-6.
  • The learning rate follows cosine decay to a minimum of 1e-7 after a warmup fraction of 0.1.
  • The optimizer applies weight decay 0.1, beta values 0.9 and 0.98, CPU offloading, and precision-aware optimization.
Loading 2602.02619v2…