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

Manuscript Offprint

arXiv:2608.20314

MidTool: Mid-training Data Synthesis for Agentic Tool Use

Fengqing Jiang, Yite Wang, Boyi Liu, Zhaoyang Wang, Canwen Xu, Zhewei Yao, Radha Poovendran, Yuxiong He

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Mid-training is increasingly recognized as a critical stage for shaping the capabilities of large language models. Recent work has shown that targeted mid-training can strengthen reasoning-intensive abilities such as math and science, and can also improve agentic capabilities in software-engineering settings. In this work, we study the parallel but less explored agentic capability: general tool use. We present MidTool, an open corpus construction pipeline for agentic tool-use mid-training that combines large-scale web, PDF, and code data with synthesized supervision from real-world tool APIs, MCP skills, and document-grounded workflows. MidTool is designed to teach models how to recognize tool affordances, ground arguments from context, compose tool call workflow, and recover from incomplete information. We mid-train Qwen3-4B-Base and Qwen3-8B-Base on MidTool-Mix, and then apply follow-up post-training with both supervised fine-tuning and reinforcement learning. Compared with baselines, MidTool-Mix consistently improves downstream performance under both SFT and RL on BFCL, τ2\tau^{2}-Bench, and MCP Universe. These results suggest that general tool use, like other important LLM capabilities, benefits from dedicated mid-training rather than being left entirely to post-training. Contact: yite.wang@snowflake.com Data & Model: https://hf.co/collections/MidTool/midtool-release

Figure

Figure 1: Left: MidTool-Mix is a 20.3B-token mid-training corpus built from web, PDF, code, and tool sources with synthesized agentic trajectories. Middle: Training pipeline from base model. Right: On MCP-Universe, our mid-trained 4B and 8B models outperform Qwen3 official models, showing that dedicated mid-training yields stronger agentic capability than scaling alone.

1 Introduction

Tool use is becoming a defining capability of large language model (LLM) agents. Strong systems must decide when external tools are needed, ground calls in tool schema, extract arguments from long and noisy context, compose multiple tools into workflows, and recover when information is incomplete. These behaviors now matter across function calling, API orchestration, interactive agent benchmarks, and emerging Model Context Protocol (MCP) ecosystems (Schick et al., 2023; Liu et al., 2024; Patil et al., 2025; Luo et al., 2025).

Most recent progress on tool use, however, has come from post-training. Supervised fine-tuning (SFT) and reinforcement learning (RL) on curated traces have substantially improved function calling and agent behavior (Song et al., 2024; Liu et al., 2025; Prabhakar et al., 2025; Xu et al., 2025), but they also place a heavy burden on post-training. The model must simultaneously acquire a set of atomic agentic capabilities, including tool recognition, schema-grounded argument construction, clarification under missing information, and multi-step execution, from comparatively narrow supervision. More fundamentally, the knowledge that underlies successful tool use does not live only in explicit trajectories. It is distributed across developer documentation, manuals, PDFs, code repositories, API specifications, and structured tool definitions, most of which never appear as clean agent demonstrations (Qin et al., 2023; Liu et al., 2024; Xu et al., 2025).

This raises a natural 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 a distinct stage of multi-stage pre-training, bridging the gap between general pre-training and post-training stages (Tu et al., 2025). Recent work has shown that targeted mid-training can materially improve reasoning-intensive capabilities (Wang et al., 2025; Team et al., 2025a), and emerging efforts have begun to explore agentic mid-training for deep research (Su et al., 2025; Team et al., 2025b), coding (Zeng et al., 2025; Z.ai, 2026; Xiao et al., 2026), and software engineering (SWE) (Yang et al., 2025; Zeng et al., 2026). Yet general tool use remains underexplored as a mid-training target. Compared with math or SWE tasks, tool use data requires covering a broader and more heterogeneous capability surface, including natural-language documentation, executable code patterns, structured schemas, multi-tool workflows, and failure cases caused by missing information.

In this paper, we introduce MidTool, a scalable pipeline for constructing agentic mid-training data of general tool use, together with MidTool-Mix, the resulting 20.3B-token mixture. Our pipeline begins from four complementary source families: web pages, PDFs, code repositories, and structured tool artifacts such as APIs and MCP skills. It then converts these sources into training supervision through two synthesis branches that target the two core deficits of tool use: grounding and execution. The first branch, context-grounded trajectory augmentation, addresses grounding by turning documentation and code into supervision for recognizing tool boundaries, inferring parameters, and recovering workflow structure from messy real-world artifacts. The second branch, native agentic trajectory synthesis, addresses execution by constructing executable trajectories directly from real APIs, MCP skills, and collected rollout traces, teaching multi-turn planning, clarification, and recovery with explicit validation of schema grounding, turn order, required arguments, and tool-response consistency. The resulting mixture is designed to teach models not only what tools exist, but also the atomic agentic capabilities needed to recognize their affordances, compose them into workflows, and recover when information is incomplete. Table 1 situates our work among representative open corpora and mid-training efforts. Relative to prior open efforts, our goal is neither a general-domain mixture nor a domain-specific corpus for math, deep research, or software engineering, but a dedicated agentic corpus for general tool use.

Work Domain Data Size Train Data Sources Tool Div. Agent Traj. Public Access FineWeb (Penedo et al., 2024) General 15T PT Web ✗ ✓ Dolmino (Olmo et al., 2025) General 100B MT Crawl sourced + Synthesized ✗ ✓ MegaMath-Web-Pro (Wang et al., 2025) Math 100B MT Math, QA, Instruction + Synthesized ✗ ✓ AgentFounder (Su et al., 2025) Deep Research 300B MT Web + Synthesized ✓ ✗ daVinci-Dev (Zeng et al., 2026) SWE 73.1B MT Github PR + Synthesized ✓ ✓ MidTool-Mix (ours) Tool Use 20.3B MT Web, PDF, Code, Tool + Synthesized ✓ ✓

Note: low/none, partial, and high; ✓ and ✗ denote yes and no, respectively.

Table 1: Comparison of representative work on pre-training (PT) and mid-training (MT) corpora. Tool Div. = tool diversity and Agent Traj. = (include) agentic trajectories.

We evaluate whether such mid-training provides value beyond standard post-training by mid-training Qwen3-4B-Base and Qwen3-8B-Base on MidTool-Mix, followed by the same downstream SFT and optional RL recipes. Across BFCL (Patil et al., 2025), τ2\tau^{2}-Bench (Barres et al., 2025), and MCP-Universe (Luo et al., 2025), we observe a consistent pattern: MidTool-Mix improves downstream tool-use performance over SFT-only baselines, and RL usually compounds these gains. The gains are especially pronounced on harder multi-turn and interactive settings.

Contributions. Our main contributions are threefold: (1) To our knowledge, we introduce MidTool, the first open pipeline and mid-training dataset designed for general tool use, and construct MidTool-Mix, a 20.3B-token mixture that combines web, PDF, code, and tool artifacts with both context-grounded augmentation and native agentic trajectories. (2) We show that dedicated tool-use mid-training consistently improves downstream general tool-use performance for 4B and 8B models across three benchmarks under both SFT and RL, suggesting that mid-training provides a stronger and more stable substrate for subsequent post-training. (3) We show that MidTool-Mix helps reveal a meaningful capability boundary: its benefits are strongest for broad tool-use capability and transfer, while more specialized exploratory behaviors remain distinct. This suggests that capabilities such as deep search likely require dedicated mid-training data beyond a purely general tool-use mixture, providing concrete guidance for future agentic mid-training study.

References (31)