Introduction: The Distribution Mismatch
Traditional Large Language Models (LLMs) are trained on static snapshots of code—essentially the "finished product" of software development. However, an autonomous software engineering agent does not simply output a final file. It must navigate a repository, localize bugs, read context, apply iterative edits, and run tests to verify fixes.
The authors of daVinci-Dev identify a critical "distribution mismatch" in current AI development: pre-training data demonstrates what was produced, but deployment requires agents to know how to construct solutions through a messy, dynamic process. Existing post-training (fine-tuning) methods often lack the scale and diversity to instill these foundational agentic behaviors, particularly when the base models are not specialized for coding. To address this, the paper introduces agent-native mid-training, a scalable complementary approach that bridges the gap between static code knowledge and dynamic problem-solving.
The Solution: Agent-Native Mid-Training
The core innovation of daVinci-Dev is an intermediate training stage situated between general pre-training and final fine-tuning. To simulate the authentic "agent experience," the researchers curated two complementary types of agent-native data:
1. Contextually-Native Trajectories ($D^{ctx}$)
Instead of treating code changes as isolated snippets, the authors reconstructed the complete "story" of millions of GitHub Pull Requests (PRs). This dataset (comprising 68.6B tokens) bundles the initial issue description, the specific files the developer examined, and the final edits into a single training sample. This teaches the model the causal link between a bug report and a specific code change, preserving the complete information flow an agent experiences.
2. Environmentally-Native Trajectories ($D^{env}$)
These trajectories consist of 74,000 real "rollouts" (3.1B tokens) where an agent interacts with a Dockerized environment. It records actual tool invocations, such as pytest failures or runtime errors, and the subsequent attempts to fix them. This exposes the model to the authentic feedback loop of real-world development.
Training is staged progressively: the model is first trained on a general multi-language PR dataset, followed by a Python-focused dataset to align with common software engineering benchmarks.
Key Insights
- Bundling is Better than Factoring: Previous methods often trained "localization" and "editing" as separate tasks. daVinci-Dev argues that keeping them bundled preserves the causal flow, helping the model understand why it is looking at a specific file before attempting a fix.
- Authenticity over Simulation: Rather than relying solely on synthetic Chain-of-Thought reasoning, daVinci-Dev prioritizes authentic observations—real error messages from real compilers. This builds robustness for production environments.
- The "Double-Dipping" Effect: Training on the same environment trajectories during both mid-training and post-training (Supervised Fine-Tuning) provides a significant performance boost. Mid-training helps the model internalize environment dynamics at a knowledge level, while SFT refines the specific behavior.
- Cross-Domain Gains: Software engineering is fundamentally a high-level logic task. The authors found that agentic mid-training improved the model's performance on unrelated scientific reasoning tasks (like GPQA and SciBench), suggesting that this approach fosters fundamental reasoning skills.
State-of-the-Art Results
The daVinci-Dev recipe yields impressive results, particularly on SWE-Bench Verified, the gold standard for software engineering agents:
- SOTA Performance: The daVinci-Dev-72B model achieved a 58.5% resolution rate, the highest among open recipes using agentic scaffolds.
- High Efficiency: The models outperformed the previous open software engineering mid-training leader, Kimi-Dev, while using fewer than half the mid-training tokens (73.1B vs. ~150B).
- Small Model Power: The 32B model reached a 56.1% resolution rate, outperforming many larger models and specialized coder variants, despite starting from a non-coder Qwen2.5 base model.
- Generalization: On general code generation (HumanEval), the 32B model saw a massive +23.26 point jump in performance compared to its base version.
Limitations and Future Directions
While highly effective, the approach has limitations. Because $D^{ctx}$ relies on public GitHub PRs, there is a persistent risk of benchmark contamination. The authors implemented strict decontamination filters, but verbatim overlap in large-scale codebases remains a challenge. Additionally, while contextually-native data is easy to scale, environmentally-native data ($D^{env}$) is computationally expensive to generate due to the need for Dockerized execution. Future work will likely focus on automating and scaling this environment-native data pipeline.
Finally, the authors emphasize safety: while these agents drastically increase productivity, they carry the risk of generating insecure code and should currently be deployed within "human-in-the-loop" workflows. To facilitate further research, a significant portion of the datasets, recipes, and model checkpoints have been open-sourced.
Summary updated