arXiv(opens in a new tab)cs.CLOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.22019

Priming Base Models for Agentic Post-Training: An Open Midtraining Recipe

Soumye Singhal, Joseph Jennings, Ka Shun Shum, Alexander Bukharin, Khushi Bhardwaj, Zirui Liu, Venkat Srinivasan, Jonathan Li, Yash Jain, Kezhi Kong, Markus Kliegl, Olivier Delalleau, Sanjeev Satheesh, Mostofa Patwary

ABSTRACT

Frontier models, general-purpose and domain-specific alike, now include a mid-training stage between pretraining and post-training, but little has been published about how this stage is built. We present an open midtraining recipe that primes base models for agentic post-training, and we show its effectiveness on two Nemotron models of different sizes. Pretraining typically runs at short context and sees almost no agent interactions, while SFT data is mostly synthetic, and very long SFT stages can hurt the model's later RL trainability. Our midtraining stage sits between the two. It trains at 256K context for hundreds of billions of tokens on a diverse mixture of natural software-engineering data like packed repositories, pull requests, commit histories, and build logs together with a small share of agentic traces. On Nemotron 3.5 Lightning, 500B midtraining tokens improve SWE-bench Verified from 60.7 to 64.5, SWE-bench Multilingual from 55.8 to 62.8, and SWE-bench Pro from 32.0 to 35.5 after identical full SFT. On the larger Nemotron 3.5 Super, 280B midtraining tokens improve DeepSWE, a harder benchmark of long-horizon tasks, from 11.7 to 15.7 and SWE-bench Verified from 72.9 to 74.3 after identical full SFT. Midtraining also improves robustness across agent harnesses on both models. We report the ablations behind the recipe and an evaluation protocol built on short fixed SFT runs, since base-model proxy metrics did not correlate reliably with post-training results.

1 INTRODUCTION

Between pretraining and post-training, frontier coding models such as Qwen3-Coder-Next (Cao et al., 2026), GLM-5 (GLM-5 Team, 2026), Kimi-Dev (Yang et al., 2026), and Composer 2 (Cursor Research, 2026) include a midtraining stage of hundreds of billions of tokens of agentic, long-context data on top of a converged base model. Technical reports describe this stage at a high level, but rarely explain how its data is constructed, filtered, and weighted, or measure the impact of each design choice. Following Qwen-Coder (Hui et al., 2024; Cao et al., 2026), we present an open midtraining recipe for agentic coding, developed and demonstrated on Nemotron base models. We describe how each data source is built, and we report the ablations that guided our training choices.

Base models are usually pretrained at short sequence lengths, typically 4K to 8K tokens for compute efficiency (DeepSeek-AI, 2024; Qwen Team, 2025), and then extended to long context in a short final stage before SFT. Nemotron models, for example, are pretrained at 8K and extended to 1M. The data that matters most for software-engineering agents does not fit this pipeline. Pretraining corpora usually contain almost no agent interactions, as in the Nemotron pretraining corpus (NVIDIA, 2025), and the natural data around software engineering, such as whole repositories, code evolution through commit histories, pull requests, and build logs, often runs to tens or hundreds of thousands of tokens, too long for pretraining and too large for a short long-context stage. Adding agent traces to pretraining is also not straightforward, since pretraining typically applies no loss masking, and it is unclear how the tool responses (environment outputs) in those traces should be handled. SFT in turn consists mostly of synthetic chat data. Recent work has documented that very long SFT stages

*Core contributors. Correspondence: {jjennings, soumyes, abukharin}@nvidia.com

†Work done during an internship at NVIDIA.

can reduce how much the model later gains from RL (Liu et al., 2026b; Kang et al., 2025; Zhang et al., 2026), and we have observed this in our own training as well.

Midtraining fills this gap. Before the final long-context stage, it trains for hundreds of billions of tokens at 256K, long enough to hold whole repositories, commit histories, and long agent traces ( §5.1§5.1). The data is mostly natural software-engineering data, with a bounded share of agent traces whose tool responses are masked from the loss. Much of this learning can therefore move out of SFT, so SFT can stay short and preserve the model's later RL trainability (Liu et al., 2026b; Kang et al., 2025; Zhang et al., 2026).

We develop the recipe on Nemotron 3.5 Lightning-30B-A3B and then scale it to the larger Nemotron 3.5 Super-120B-A12B (NVIDIA, 2026a). On N-3.5 Lightning, 500B midtraining tokens improve SWE-bench Verified, Multilingual, and Pro by 3.8, 7.0, and 3.5 points over the same model without midtraining after identical full SFT, with the most sustained gains on SWE-bench Multilingual ( §4.3§4.3). On N-3.5 Super, 280B midtraining tokens improve DeepSWE from 11.7 to 15.7 and SWE-bench Verified from 72.9 to 74.3 after identical full SFT ( §4.4§4.4). Midtraining also improves robustness to the agent harness, which matters for open models that are used with many different harnesses. Both models improve on every harness we tested, and on N-3.5 Super after 65B tokens and short SFT, the average gain across harnesses is 8.6 points on SWE-bench Verified and 6.8 on Terminal-Bench ( §4.5§4.5).

We make the following contributions.

• A fully documented midtraining data recipe, showing that a small share of agentic traces adds clear gains on top of natural data ( §3§3 and §4.2§4.2).

• An evaluation protocol based on identical SFT runs, since base-model proxy metrics such as bits-per-byte and LoCoDiff did not reliably predict post-training results ( §4.1§4.1).

• We show that gains hold as we scale both model size and midtraining tokens up to 500B, across benchmarks and agent harnesses ( §4§4).

• Ablations of modeling choices, such as the learning rate, the share of replayed pretraining data, tool-response masking, and midtraining’s effect on long-context ability ( §5§5).

References (76)