Summary
This paper introduces MidTool, the first open pipeline and mid-training dataset specifically designed for general tool use in large language models (LLMs). The authors construct MidTool-Mix, a 20.3B-token corpus that combines web, PDF, code, and structured tool artifacts with two complementary synthesis branches: context-grounded trajectory augmentation and native agentic trajectory synthesis. Through extensive experiments on 4B and 8B base models, they demonstrate that dedicated tool-use mid-training consistently improves downstream performance across three benchmarks (BFCL, τ²-Bench, and MCP-Universe) under both supervised fine-tuning (SFT) and reinforcement learning (RL) settings.
1. Introduction and Theoretical Foundation
Background
Tool use is emerging as a defining capability of LLM agents. Effective tool-use systems must:
- Decide when external tools are needed
- Ground calls in tool schemas
- Extract arguments from long and noisy contexts
- Compose multiple tools into workflows
- Recover when information is incomplete
Key Insight
The authors observe that most progress in tool use has come from post-training approaches (SFT and RL on curated traces). However, these approaches place a heavy burden on post-training, as the model must simultaneously acquire multiple atomic capabilities from comparatively narrow supervision. The knowledge underlying successful tool use is distributed across developer documentation, manuals, PDFs, code repositories, API specifications, and structured tool definitions—most of which never appear as clean agent demonstrations.
Research Question
Can general tool-use ability be shaped earlier through dedicated mid-training, rather than being left almost entirely to post-training?
Mid-training is positioned as a distinct stage in multi-stage pre-training, bridging the gap between general pre-training and post-training. Prior work has shown mid-training benefits for reasoning-intensive capabilities (math, science), deep research, and software engineering—but general tool use remained underexplored.
Tool-Use vs. Other Domains
Tool-use data requires covering a broader and more heterogeneous capability surface than math or SWE tasks, including:
- Natural-language documentation
- Executable code patterns
- Structured schemas
- Multi-tool workflows
- Failure cases caused by missing information
2. Methodology: The MidTool Pipeline
The pipeline consists of three stages, as illustrated in Figure 2 of the paper.
2.1 Stage 1: Data Source Collection
Four complementary source families are collected:
| Source Family | Description | Purpose |
|---|---|---|
| Web data | Processed Common Crawl dumps from FineWeb (2020–2025) | Broad coverage of tool-related concepts, terminology, workflow descriptions |
| PDF data | FinePDFs English subset | Longer-form procedural content, manuals, product handbooks |
| Code data | Two GitHub slices (agent/MCP-related + high-quality public repos) | Concrete tool interfaces, orchestration patterns, executable patterns |
| Tool data | REST APIs and MCP skills | Explicit schemas, parameter structures, tool boundaries for trajectory synthesis |
Key filtering for code data: Known benchmark and evaluation repositories are explicitly excluded through an actively maintained blacklist to prevent leakage.
2.2 Stage 2: Data Preprocessing
Code: Multi-phase filtering adapted from StarCoder, including:
- Extension-based filtering (exclude binaries, model weights, logs)
- Content-based heuristics (line count, line length, alpha ratio)
- Jupyter Notebook conversion to Python
- Deduplication via SHA-256 hashing + MinHash LSH
- Documentation-only directory filtering (docs, examples, tutorials, guides, samples, cookbook)
Web and PDF: Four-phase pipeline:
- High-recall keyword/URL prescreening
- Lightweight fastText classifier trained on LLM-labeled seed data
- Document-level quality filtering
- MinHash LSH deduplication
2.3 Stage 3: Agentic Trajectory Synthesizing
The synthesis stage addresses two complementary deficits:
Branch A: Context-Grounded Trajectory Augmentation
Target: Grounding deficit—models fail to infer tool boundaries, required arguments, and workflow structure from messy real-world artifacts.
Process:
- Lightweight keyword-based prefilter
- Qwen3-235B-A22B-Instruct-2507 annotation with quality score + structured affordance profile
- Rule-based planner converts extracted affordances into synthesizing plans
- Budget allocation tied to document quality
Supervision types:
- Regular QA: tool selection, schema-grounded parameter extraction, format-constrained calls, workflow recognition, multiple/parallel use
- Trajectory samples: sequential execution, parameter clarification, tool switching, long-context reasoning
Branch B: Native Agentic Trajectory Synthesis
Target: Execution deficit—models struggle to plan across turns, request missing information, sequence calls, and recover from incomplete interactions.
Process:
- Build tool inventory by grouping related endpoints/skills
- GPT-5 assigns quality scores + feasibility profiles
- Schema refinement for underspecified arguments
- Deterministic quality-adaptive budget controller (prefers multi-turn trajectories)
- Category-specific generators (GPT-5, GPT-5.1, GPT-5.2)
- Strict validation: turn ordering, schema grounding, required arguments, tool-response consistency
- Mix in rollout trajectories from Agentic World Model (AWM) synthesized environments
- Incorporate filtered traces from Nemotron Agentic dataset
2.4 MidTool-Mix Composition
Table 2 | Data mixture statistics (tokens in billions):
| Source | Tokens (B) | Samples | Ratio |
|---|---|---|---|
| Web | 4.4 / 4.1 | 6.86M | 42% |
| 2.6 / 2.1 | 1.34M | 23% | |
| Code | 3.8 / 1.5 | 2.60M | 26% |
| Native Agentic Trajectory | 1.8 | 0.42M | 9% |
| Total | 20.3 | 11.22M | 100% |
Slash-separated values denote source corpus / context-grounded augmentation.
All trajectories are normalized into a plain chat-style template without special control tokens (following Olmo et al., 2025).
t-SNE analysis shows MidTool-Mix occupies distinct regions not covered by FineWeb or Dolmino, shifting the distribution toward documentation-heavy, workflow-oriented, and agentic tool-use content. No evidence of benchmark leakage was found.
3. Experimental Setup
3.1 Models and Training Recipes
Base models: Qwen3-4B-Base and Qwen3-8B-Base
Four training recipes per scale:
- Base + SFT (on 100K TOUCAN tool-use subset)
- Base + SFT + RL
- Base + MidTool-Mix + SFT
- Base + MidTool-Mix + SFT + RL
Infrastructure:
- Mid-training and SFT: ArcticTraining on 32 H200 GPUs
- RL: AWM setup with 526 synthetic tool-use environments on 8 B200 GPUs
Benchmarks:
- BFCLv3: Function-calling quality (single-turn and multi-turn)
- τ²-Bench: Interactive task completion (airline, retail, telecom)
- MCP-Universe: Execution over real MCP servers (browser automation, finance, location, web search)
4. Key Results
4.1 Main Findings
BFCLv3 Results (Table 3)
| Setting | Single-Turn Non-live | Single-Turn Live | Multi-Turn Avg. | Overall |
|---|---|---|---|---|
| 4B + SFT | 59.94% | 43.75% | 15.50% | 39.73% |
| 4B + MidTool + SFT | 66.38% | 57.74% | 26.63% | 50.25% |
| 4B + MidTool + SFT + RL | 76.44% | 58.48% | 27.63% | 54.18% |
| 8B + SFT | 66.40% | 51.22% | 25.25% | 47.62% |
| 8B + MidTool + SFT + RL | 72.58% | 55.14% | 37.63% | 55.12% |
Key observation: At 4B scale, multi-turn average rises by more than 10 points over SFT-only, indicating mid-training contributes capabilities not reliably induced by post-training alone.
τ²-Bench Results (Table 4)
| Setting | Overall Pass@1 | Overall Pass@4 |
|---|---|---|
| 4B + SFT | 8.54% | 20.50% |
| 4B + MidTool + SFT + RL | 19.96% | 38.49% |
| 8B + SFT | 10.43% | 28.06% |
| 8B + MidTool + SFT + RL | 21.31% | 39.57% |
MidTool-Mix nearly doubles overall Pass@1 at 4B scale, with strongest gains on airline and retail.
MCP-Universe Results (Table 5)
| Setting | Overall Score | Overall Pass |
|---|---|---|
| 4B + SFT | 13.20 | 1.68% |
| 4B + MidTool + SFT + RL | 23.80 | 10.06% |
| 8B + SFT | 15.18 | 3.35% |
| 8B + MidTool + SFT + RL | 25.16 | 9.50% |
4.2 Capability Boundary Discovery
Critical finding: Despite substantial improvements on browser automation, financial, and location domains, the web search subset remains at 0.00% across all configurations.
This reveals a meaningful capability boundary:
- General tool-use supervision teaches reusable priors for schema grounding, tool selection, and interaction with unfamiliar APIs
- Highly exploratory domains (deep-search-style tasks) require dedicated trajectory data and training objectives
4.3 Ablation Study (Table 6)
Under fixed 4B SFT recipe, varying only mid-training corpus:
| Mid-training Data | BFCL Overall | τ²-Bench Pass@1 | MCP Score | MCP Pass |
|---|---|---|---|---|
| No Mid-training | 39.73% | 8.54% | 13.20 | 1.68% |
| Dolmino-20BT | 43.10% | 7.37% | 5.41 | 0.00% |
| Processed data w/o traj. | 42.30% | 7.30% | 12.20 | 3.03% |
| + native agentic traj. only | 47.59% | 4.23% | 6.80 | 1.12% |
| + context grounded traj. only | 44.66% | 8.99% | 8.46 | 1.12% |
| MidTool-Mix (complete) | 50.25% | 12.23% | 18.66 | 5.03% |
Key insights:
- Asymmetric contributions: Native agentic trajectories give larger BFCL gains (+7.9 vs. +4.9 overall); context-grounded augmentation is stronger on τ²-Bench and MCP-Universe (transfer)
- Complementarity: Both single-branch variants fall below no mid-training on MCP-Universe, but the complete mixture improves on all eight metrics
- Not solely proprietary-driven: The native trajectory branch uses an open-weight teacher; filtered raw data alone still provides positive signal
5. Implications
Theoretical Implications
- Mid-training provides a stronger and more stable substrate for subsequent post-training
- General tool-use mid-training and post-training are complementary axes that should advance together
- Capability structure of agentic behavior is non-uniform: broad tool-use priors vs. specialized exploratory behaviors are distinct
Practical Implications
- Dedicated tool-use mid-training can nearly double interactive task completion performance at smaller model scales
- Open-source pipeline enables reproducible research on agentic mid-training
- Provides concrete guidance for future work: search-heavy domains require specialized mid-training data beyond general tool-use mixtures
6. Conclusion and Future Directions
Main Takeaways
- MidTool is the first open pipeline and mid-training dataset for general tool use
- Dedicated tool-use mid-training consistently improves downstream performance across benchmarks and training recipes
- Grounding-oriented and execution-oriented supervision are complementary
- General tool-use mid-training reveals a capability boundary: broad transfer improves, but deep-search-style behaviors remain distinct
Future Work
- Scaling native trajectory collection
- Broadening tool ecosystem coverage
- Constructing specialized mid-training mixtures for domain-specific agentic behaviors (especially search-heavy domains)
Key Contributions
- First open pipeline and mid-training dataset for general tool use (MidTool + MidTool-Mix, 20.3B tokens)
- Demonstrated consistent improvements across 4B/8B models, three benchmarks, and both SFT and RL settings
- Revealed a meaningful capability boundary between general tool use and specialized exploratory behaviors, providing guidance for future agentic mid-training research
Related papers
- OasisKV: Scaling In-Decode KV Cache Beyond HBM with Lookahead Sparse Prefetching
OasisKV uses speculative decoding's draft tokens to predict future KV-cache access, enabling asynchronous prefetching that boosts LLM inference throughput up to 2.1x with negligible accuracy loss.
- Training Transformers for KV Cache Compressibility (KV-CAT)
KV-CAT trains transformers with learned routers to produce inherently compressible KV caches, improving compression quality up to 3.21x without sacrificing dense performance.
- RestoreKV: Recovering Full-Cache Behavior Under Aggressive Query-Agnostic KV Cache Eviction
RestoreKV generates a small, context-conditioned restore cache via LoRA-adapted tokens to complement evicted KV pairs, boosting RULER accuracy by up to 35 points at 5% budget with negligible overhead.