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, tau2-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.
Figures & tables
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.
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.
Figure 2: Overview of MidTool pipeline. Stage 1 collects four complementary source families, including web pages, PDFs, code repositories, and structured tool artifacts. Stage 2 applies source-specific preprocessing, quality control, and deduplication. Stage 3 converts the refined corpus into executable supervision through two branches: context-grounded trajectory augmentation from web/PDF/code documents, and native agentic trajectory synthesis from real APIs and MCP skills.
Figure 4
Model Setting
Single Turn
Multi-Turn
Hallu.
Overall
Non-live
Live
Base
MF
MP
LC
Avg.
Qwen3-4B
39.58%
24.35%
10.50%
9.00%
6.00%
10.00%
8.88%
9.05%
24.27%
Qwen3-4B-Base + SFT
59.94%
43.75%
21.50%
14.00%
10.00%
16.50%
15.50%
60.46%
39.73%
Qwen3-4B-Base + SFT + RL
59.65%
39.90%
27.00%
18.00%
13.00%
18.00%
19.00%
55.19%
39.51%
Qwen3-4B-Base + MidTool-Mix + SFT
66.38%
57.74%
36.00%
23.00%
19.50%
28.00%
26.63%
56.95%
50.25%
Qwen3-4B-Base + MidTool-Mix + SFT + RL
76.44%
58.48%
34.50%
24.50%
20.50%
31.00%
27.63%
60.10%
54.18%
Table 3: BFCLv3 results for Qwen3-4B and Qwen3-8B base models. For each scale, we compare SFT and SFT+RL with and without prior mid-training on MidTool-Mix ; released Qwen3 models are included as references. We report single-turn, multi-turn (MF = Missing Function, MP = Missing Parameters, LC = Long Context), hallucination (Hallu.), and overall performance. All values are percentages and higher is better.
Model Setting
Airline
Retail
Telecom
Overall
Pass@1
Pass@4
Pass@1
Pass@4
Pass@1
Pass@4
Pass@1
Pass@4
Qwen3-4B
21.00%
32.00%
16.23%
35.09%
3.51%
5.26%
11.87%
22.30%
Qwen3-4B-Base + SFT
17.50%
34.00%
9.43%
24.56%
3.73%
10.53%
8.54%
20.50%
Qwen3-4B-Base + SFT + RL
31.00%
52.00%
18.20%
39.47%
0.00%
0.00%
13.04%
25.54%
Qwen3-4B-Base + MidTool-Mix + SFT
17.00%
38.00%
20.83%
47.37%
1.54%
4.39%
12.23%
28.06%
Qwen3-4B-Base + MidTool-Mix + SFT + RL
20.00%
40.00%
33.55%
57.89%
6.36%
18.42%
19.96%
38.49%
Table 4: τ2 -Bench results for Qwen3-4B and Qwen3-8B base models. For each scale, we compare SFT and SFT+RL with and without prior mid-training on MidTool-Mix ; released Qwen3 models are included as references. We report Pass@1 and Pass@4 for airline, retail, telecom, and overall; higher score is stronger interactive capacity.
Model Setting
Browser Auto.
Financial
Location
Multi-server
Web Search
Overall
Score
Pass
Score
Pass
Score
Pass
Score
Pass
Score
Pass
Score
Pass
Qwen3-4B
19.42
5.88%
9.17
7.50%
43.51
2.86%
16.17
0.00%
0.00
0.00%
16.05
3.35%
Qwen3-4B-Base + SFT
15.44
2.94%
5.00
5.00%
38.98
0.00%
13.67
0.00%
0.00
0.00%
13.20
1.68%
Qwen3-4B-Base + SFT + RL
17.65
5.88%
6.67
5.00%
39.69
0.00%
17.00
0.00%
0.00
0.00%
14.50
2.23%
Qwen3-4B-Base + MidTool-Mix + SFT
21.81
8.82%
14.27
12.50%
46.81
2.86%
19.50
0.00%
0.00
0.00%
18.66
5.03%
Qwen3-4B-Base + MidTool-Mix + SFT + RL
19.73
8.82%
38.33
37.50%
49.50
0.00%
16.17
0.00%
0.00
0.00%
23.80
10.06%
Table 5: MCP-Universe results for Qwen3-4B and Qwen3-8B base models. For each scale, we compare SFT and SFT+RL with and without prior mid-training on MidTool-Mix ; released Qwen3 models are included as references. We report score and pass rate; higher is better.
Mid-training Data
BFCLv3
τ2 -Bench
MCP-Universe
Non-live
Live
Multi-turn
Overall
Pass@1
Pass@4
Score
Pass
No Mid-training
59.94% +0.0
43.75% +0.0
15.50% +0.0
39.73% +0.0
8.54% +0.0
20.50% +0.0
13.20 +0.0
1.68% +0.0
Dolmino-20BT
61.44% +1.5
51.74% +8.0
16.13% +0.6
43.10% +3.4
7.37% -1.2
21.22% +0.7
5.41 -7.8
0.00% -1.68
MidTool
Processed data w/o traj.
60.40% +0.5
52.60% +8.9
13.90% -1.6
42.30% +2.6
7.30% -1.2
21.90% +1.4
12.20 -1.0
3.03% +1.4
+ native agentic traj.
68.21% +8.3
55.81% +12.1
18.75% +3.3
47.59% +7.9
4.23% -4.3
12.95% -7.6
6.80 -6.4
1.12% -0.6
Table 6: Ablation across BFCLv3, τ2 -Bench, and MCP-Universe under the Qwen3-4B-Base + SFT setting, where the downstream post-training recipe is fixed and only the mid-training corpus is changed. Rows under MidTool are additive over the filtered raw sources: Processed data w/o traj. mid-trains on the processed raw data only, with no synthesized trajectories; the next two rows each add a single synthesis branch on top of it, and are therefore alternatives rather than successive steps; MidTool-Mix is the complete mixture combining all. Dolmino-20BT is a matched-budget generic mid-training baseline.
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
Slice
source-only
+ QA
+ QA + traj.
web (6.86M)
36.4%
52.2%
11.3%
pdf (1.34M)
30.8%
13.4%
55.7%
code (2.60M)
68.9%
4.2%
26.8%
Appendix
Table 7: Augmentation type per source slice, as a fraction of samples within that slice. Sample counts match the Samples column of Table 2 .
Metric
Stat
web
pdf
code
native
Turns
mean
2.8
3.0
3.1
4.0
median
3
3
3
4
max
15
17
8
69
Steps
mean
5.3
7.1
6.0
3.8
median
5
6
5
4
max
54
77
58
21
Appendix
Table 8: Per-document trajectory statistics among samples containing agentic trajectories. A turn is a user message, a step is an assistant message, and a tool call is a single tool invocation.
Category
Calls
Share
Examples
Code execution / Shell / DevOps
862K
10.9%
run_command , kubectl_get
List / Get (generic)
811K
10.2%
list_tools , get_*
File / Filesystem
380K
4.8%
read_file , list_dir
Set / Update / Modify
354K
4.5%
set_* , configure
Add / Create
348K
4.4%
create_* , register_*
Search / Lookup
335K
4.2%
search , lookup
Appendix
Table 9: Functional categories of tool calls in MidTool-Mix , obtained by keyword mapping over tool names.
Hyperparameter
Value
Epochs
1
Max Sequence length
8192
Optimizer
AdamW
Learning rate
3×10−5
Betas
(0.9,0.999)
Weight decay
0.01
Appendix
Table 10: Mid-training hyperparameters for Qwen3-4B-Base and Qwen3-8B-Base .
Hyperparameter
Value
Max Sequence length
32768
Optimizer
AdamW
Learning rate
2×10−5
Betas
(0.9,0.95)
Weight decay
0.01
LR schedule
cosine, warmup ratio 0.001
Appendix
Table 11: Supervised fine-tuning hyperparameters.
Hyperparameter
Value
RL algorithm
GRPO
Total training steps
64
Learning rate
4B: 1×10−6 ; 8B: 5×10−7
Data Batch size
32
PPO Mini-batch size
32
Rollouts per prompt
16
Appendix
Table 12: Reinforcement-learning hyperparameters.
Figure 4: SFT loss trajectories on the same downstream tool-use corpus for three Qwen3-4B initializations. MidTool-Mix starts from a lower loss, converges faster, and maintains the best loss throughout training compared with both the raw base model and the Dolmino mid-trained baseline.
Figure 5: Average RL reward during training for 4B (left) and 8B (right) models. In both scales, MidTool-Mix starts from a stronger point and improves more quickly in the early stage of RL, while the non-mid-trained baseline gradually catches up later within the same training environment.
Model
Tool Succ.
Overall
STEM
Med
Fin
Sprt
Gen
Llama4-Maverick ∗
-
0.1545
0.1875
0.1581
0.1182
0.1562
0.1524
Gemma3-4B-pt + SFT
0.5863
0.0567
0.0655
0.0600
0.0573
0.0564
0.0448
Gemma3-4B-pt + MidTool-Mix + SFT
0.7231
0.0661
0.0733
0.0765
0.0640
0.0563
0.0606
Appendix
Table 13: Exploratory results on the single-turn subset of VisualToolBench. We fine-tune the base model on a FineVision subset and then on the same text-only tool-use SFT dataset as in our main setting. We report tool success rate and average rubric score; higher is better. Llama4-Maverick score is reported from the original benchmark paper for reference.