MiniCPM5-1B has a built-in <think>...</think> chat template. The same checkpoint can act as a fast assistant or a deliberate chain-of-thought reasoner — controlled by a single flag:
python
1# Fast mode — recommended for tool calling (thinking OFF)2prompt = tokenizer.apply_chat_template(3 messages, tools=tools, add_generation_prompt=True,4 enable_thinking=False,5 tokenize=False,6)78# Reasoning mode (thinking ON — NOT recommended for tool calling)9prompt = tokenizer.apply_chat_template(10 messages, tools=tools, add_generation_prompt=True,11 enable_thinking=True,12 tokenize=False,13)
Important: always use enable_thinking=False for tool/function calling. With thinking ON the model spends its token budget inside <think>...</think> and may not reach a completed function call. All benchmark numbers in this card use thinking OFF.
Citation
If you use this model, please cite the base model paper:
bibtex
1@article{minicpm4,
2 title = {MiniCPM4: Ultra-Efficient LLMs on End Devices},
3 author = {MiniCPM Team},
4 journal = {arXiv preprint arXiv:2506.07900},
5 year = {2025}
6}
And the ToolACE dataset used for fine-tuning:
bibtex
1@article{toolace,
2 title = {ToolACE: Winning the Points of LLM Function Calling},
3 author = {Liu, Ying and others},
4 journal = {arXiv preprint arXiv:2409.00920},
5 year = {2024}
6}
ModelScope
The base model is also available on ModelScope (for users in China and East Asia):
The current model weights are one indexed checkpoint:
model-00001-of-00002.safetensors
model-00002-of-00002.safetensors
model.safetensors.index.json
The repository also includes the matching tokenizer, chat_template.jinja, model configuration, generation configuration and external evaluation artifacts. The previous single-file model remains recoverable from Hub history but is not part of the current branch.
Remove token_type_ids from inputs if the installed Transformers/tokenizer combination returns them, because this Llama model does not consume that argument.
vLLM
The merged safetensors checkpoint is the preferred format for vLLM:
Parser availability depends on the installed vLLM release. Use SGLang's official minicpm5 parser path when OpenAI-compatible tool-call extraction is required and the vLLM build does not provide an equivalent parser.
External Evaluation
The final adapter and this merged checkpoint have identical weights for evaluation purposes. Evaluation used 300 examples derived from the external
Team-ACE/ToolACE
dataset, deterministic decoding, and the same cases for both models. This is not an official ToolACE or BFCL leaderboard submission.
Metric
Base MiniCPM5-1B
Repaired model
Delta
Parseable tool call
0.0133
0.9933
+0.9800
Valid available-tool name
0.0133
0.9700
+0.9567
Expected tool name
0.0133
0.9267
+0.9133
Exact arguments
0.1500
0.6533
+0.5033
Argument-key overlap
0.0033
0.7517
+0.7484
No schema copying
1.0000
1.0000
+0.0000
No repetition
0.9967
1.0000
+0.0033
Natural clean termination
0.0000
0.1500
+0.1500
The full rows and metrics are published in:
external_toolace_base_vs_nemotron_dpo_eval.json
EVAL_RESULTS.md
Understanding the 15% Termination Metric
stopped_cleanly_rate=0.15 is a strict natural-termination metric. It measures whether the model naturally ended immediately after a completed function call without runtime intervention.
It does not mean that only 15% of cases produced usable calls. In the same evaluation, 99.33% were parseable, 97% used an available tool name, and 92.67% selected the expected tool.
MiniCPM5's deployment contract uses a parser to extract the completed XML function block. Production should treat the first completed </function> as the action boundary and prevent generated synthetic tool responses or later dialogue from being interpreted as additional actions.
Training Lineage
The current adapter was produced by:
Earlier xLAM/Glaive SFT and preference-repair stages.
Targeted Nemotron SFT continuation from the previous DPO adapter.
DPO preference optimization over valid versus corrupted tool calls.
The data pipeline inspected physical dataset files, skipped one malformed JSONL row in the SFT tool-calling file, removed oversized policy text where needed, preserved tool schemas and recent context, and rejected unknown arguments, schema-copy placeholders and invalid expected tools.
Measured Improvements and Scope
This merged checkpoint contains the same repaired adapter behavior and improved every reported task-quality metric over base MiniCPM5-1B:
Parseable calls: 1.33% -> 99.33%
Valid available-tool names: 1.33% -> 97.00%
Expected-tool selection: 1.33% -> 92.67%
Exact arguments: 15.00% -> 65.33%
Argument-key overlap: 0.33% -> 75.17%
No repetition: 99.67% -> 100.00%
Natural clean termination: 0.00% -> 15.00%
The remaining gap to 100% is residual error after a large improvement, not evidence that merging or fine-tuning degraded the base model.
Deployment Notes
Schema validation, permission checks and confirmation for sensitive actions are standard requirements for every tool-calling model.
Exact-argument accuracy improved by 50.33 percentage points; applications should still validate generated values before execution.
Valid-name accuracy improved by 95.67 percentage points; rare near misses can remain on unseen tool libraries.
Natural termination improved from 0% to 15%. MiniCPM5's parser-based serving contract extracts the completed call, so this metric is separate from the 99.33% parseable-call rate.
The external evaluation is custom rather than an official ToolACE/BFCL leaderboard submission.
GGUF quantizations may differ slightly from FP16 and are published separately.