Caldalis commited on
Commit
ed717d8
·
verified ·
1 Parent(s): bf4a740

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. LICENSE +202 -0
  2. README-cn.md +149 -0
  3. README.md +181 -0
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
README-cn.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p align="center">
2
+ <a href="https://github.com/Caldalis/MiniCPM-Math-harness" target="_blank">MiniCPM-Math harness</a> |
3
+ <a href="https://huggingface.co/Caldalis/MiniCPM5-2B-Math-GGUF" target="_blank">GGUF</a> |
4
+ <a href="https://huggingface.co/openbmb/MiniCPM5-2B" target="_blank">MiniCPM5-2B</a> |
5
+ <a href="https://github.com/OpenBMB/MiniCPM" target="_blank">MiniCPM GitHub</a>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://huggingface.co/Caldalis/MiniCPM5-2B-Math" target="_blank">English</a> |
10
+ 中文
11
+ </p>
12
+
13
+
14
+ ## 亮点
15
+
16
+ **MiniCPM5-2B-Math** 是一个基于 MiniCPM5 的数学与证明专项模型:基于
17
+ [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) 针对长链数学推理和证明写作做了后训练的
18
+ 2.5B 稠密模型。单张消费级显卡或一台笔记本就能运行,保留原生 128k 上下文。
19
+
20
+ - **同尺寸下很强。** 作为最多思考 128K token 的普通单次调用,AIME 2025 92.3、AIME 2026 89.8、HMMT 2026 年 2 月赛 81.8
21
+ (avg@16),16 样本投票为 100 / 93.3 / 90.9。官方通用模型 MiniCPM5-2B 在同一协议下为 87.1 / 89.8 / 68.4。
22
+ - **能写出可核查的证明。** 在 IMO-ProofBench Basic 上,一次最多 128K token 的普通调用平均能为 30 题中的 21 题写出完整证明,
23
+ 证明蜂群为 23 题(AI 评审盲评)。
24
+ - **自带"证明蜂群"。** 开源的 [MiniCPM-Math harness](https://github.com/Caldalis/MiniCPM-Math-harness) 可以在任意兼容
25
+ OpenAI 协议的服务上,围绕本模型运行并行证明、对抗式审稿、暴力验算和迭代修补。它针对实测到的失败模式设计。
26
+ - **小到可以自己拥有。** BF16 权重 5.0 GB,GGUF Q4_K_M 仅 1.6 GB。标准 `LlamaForCausalLM` 架构,无需自定义代码。
27
+
28
+ ## 测评
29
+
30
+ ### AIME 与 HMMT
31
+
32
+ | 测试 | 指标 | MiniCPM5-2B | MiniCPM5-2B-Math |
33
+ |---|---|---:|---:|
34
+ | AIME 2025 | avg@16 | 87.1 | **92.3** |
35
+ | | 投票(maj@16) | 93.3 | **100.0** |
36
+ | AIME 2026 | avg@16 | 89.8 | 89.8 |
37
+ | | 投票(maj@16) | 93.3 | 93.3 |
38
+ | HMMT Feb 2026 | avg@16 | 68.4 | **81.8** |
39
+ | | 投票(maj@16) | 75.8 | **90.9** |
40
+
41
+ *avg@16* 是单个样本的平均正确率,也就是一次普通 API 调用的正确率;*投票*是 16 个样本的多数答案(用
42
+ [harness](https://github.com/Caldalis/MiniCPM-Math-harness) 复现:`minicpm-math solve -n 16 --max-tokens 131072 --no-early-stop --no-force-finish`)。
43
+
44
+ ### 证明题:IMO-ProofBench Basic
45
+
46
+ 全部 30 题。*单次调用*:每题 16 次独立调用,每次最多 128K token,不做 forced finish(该行为平均一次调用的水平)。
47
+ *证明蜂群*:harness 的 `standard` 档位,prover 和 refiner 每次可用 128K token(8 个 prover,3 个 verifier,最多 2 轮修补)。
48
+ 全部 505 份写出的证明由单个 AI 评审(Claude Opus 5.5)对照官方参考解和评分标准盲评,未经人工复核;另有 5 次单次调用
49
+ 达到 128K 上限、没有写出证明,记为 0 分。所有证明和评分均已
50
+ [公开](https://github.com/Caldalis/MiniCPM-Math-harness/tree/main/docs/results/proofbench-basic)。
51
+
52
+ | | 完整证明 | 平均分(0–7) |
53
+ |---|---:|---:|
54
+ | 单次调用(avg@16) | 21.0 / 30 | 5.48 |
55
+ | 证明蜂群 | **23 / 30** | **5.83** |
56
+
57
+ ## 搭配证明蜂群使用
58
+
59
+ ```bash
60
+ pip install "minicpm-math[math] @ git+https://github.com/Caldalis/MiniCPM-Math-harness"
61
+ vllm serve Caldalis/MiniCPM5-2B-Math --max-model-len 131072 --port 8000
62
+ minicpm-math prove "证明:对任意整数 n,n^5 - n 能被 30 整除。" --base-url http://127.0.0.1:8000/v1
63
+ ```
64
+
65
+ 上面的蜂群成绩使用了 `--max-tokens 131072`;默认档位每次调用 32K token,速度更快,但没有做过测评。
66
+
67
+ 蜂群会返回最佳证明以及它的评审情况(只有全部 verifier 都打 ≥ 6/7 才标记为 `accepted`),并保留每一次调用的完整记录。
68
+ 配置档位、答案投票模式和 benchmark 用法见 [harness README](https://github.com/Caldalis/MiniCPM-Math-harness)。
69
+
70
+ ## 快速开始
71
+
72
+ > [!Tip]
73
+ > 推荐采样参数:`temperature=0.9, top_p=0.95, min_p=0.0`,开启思考模式。难题的证明可能需要 64K–120K 的输出
74
+ > token,请给服务足够的上下文(`--max-model-len 131072`),并为请求设置较大的 `max_tokens`。
75
+
76
+ ### vLLM
77
+
78
+ ```bash
79
+ pip install "vllm>=0.21"
80
+ vllm serve Caldalis/MiniCPM5-2B-Math --max-model-len 131072 --port 8000
81
+ ```
82
+
83
+ ```bash
84
+ curl http://localhost:8000/v1/chat/completions \
85
+ -H "Content-Type: application/json" \
86
+ -d '{
87
+ "model": "Caldalis/MiniCPM5-2B-Math",
88
+ "messages": [{"role": "user", "content": "证明根号 2 是无理数。"}],
89
+ "max_tokens": 16384, "temperature": 0.9, "top_p": 0.95,
90
+ "chat_template_kwargs": {"enable_thinking": true}
91
+ }'
92
+ ```
93
+
94
+ vLLM 0.24.0 + RTX 4090 实测:单卡、短输入时单流解码约 155 tok/s(保持 CUDA Graph 开启,不要加 `--enforce-eager`,
95
+ eager 模式只有约 48 tok/s)。在五张 4090、最多 10 路并发的长证明任务中,单请求解码速度中位数约 118 tok/s,总吞吐约 900 tok/s。
96
+
97
+ ### SGLang
98
+
99
+ ```bash
100
+ pip install "sglang[srt]>=0.5.16"
101
+ python -m sglang.launch_server --model-path Caldalis/MiniCPM5-2B-Math --context-length 131072 --port 30000
102
+ ```
103
+
104
+ ### llama.cpp
105
+
106
+ ```bash
107
+ llama-server -hf Caldalis/MiniCPM5-2B-Math-GGUF:Q8_0 --jinja -ngl 99 -c 98304 -np 4 -kvu --port 8000
108
+ ```
109
+
110
+ 8000 是 harness 默认连接的端口(不加 `--port` 时 llama-server 监听 8080);配合这个服务运行 harness 时请用 `--profile quick`。
111
+ 请使用 llama.cpp b9833 或更新版本:b9354 加入了 MiniCPM5 分词器,更早的版本加载不了这个 GGUF;b9833 加入了把推理和答案分开的
112
+ chat parser。Apple M5 笔记本(16 GB)+ Q8_0 实测:单流约 46 tok/s,4 个 slot 并发总计约 125 tok/s。llama.cpp 默认的
113
+ `min_p=0.05` 容易引发复读,请在请求中设置 `min_p=0.0`(harness 会自动设置)。
114
+
115
+ ### Transformers
116
+
117
+ ```bash
118
+ pip install -U "transformers>=5.6" accelerate torch
119
+ ```
120
+
121
+ ```python
122
+ from transformers import AutoModelForCausalLM, AutoTokenizer
123
+
124
+ model_id = "Caldalis/MiniCPM5-2B-Math"
125
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
126
+ # 在 Apple Silicon(MPS)上请额外传入 attn_implementation="eager":PyTorch 的 MPS SDPA 内核(torch 2.11 下验证)
127
+ # 处理本模型的分组查询注意力时会出错,导致输出质量下降。CUDA 和 CPU 不受影响。
128
+ model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")
129
+
130
+ messages = [{"role": "user", "content": "求所有使 n^2 - 19n + 99 为完全平方数的正整数 n。"}]
131
+ inputs = tokenizer.apply_chat_template(
132
+ messages, tokenize=True, add_generation_prompt=True, enable_thinking=True,
133
+ return_dict=True, return_tensors="pt",
134
+ ).to(model.device)
135
+ outputs = model.generate(**inputs, max_new_tokens=8192, do_sample=True, temperature=0.9, top_p=0.95)
136
+ print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
137
+ ```
138
+
139
+ ### 提示词建议
140
+
141
+ - 有最终答案的题目,在末尾加上 *"Please reason step by step, and put your final answer within \boxed{}."*
142
+ - 证明题请明确要求"完整、严谨的证明";遇到"求所有""确定"类问题,要求双向论证。
143
+ - 开启思考时,推理以 `</think>` 结束,后面是最终答案。带 reasoning parser 的服务会分开返回两部分,否则按 `</think>` 切分即可。
144
+
145
+ ## 许可证
146
+
147
+ 模型权重采用 [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) 许可证发布(见 `LICENSE`),与基座模型
148
+ [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) 的许可证相同。
149
+
README.md ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - zh
6
+ library_name: transformers
7
+ pipeline_tag: text-generation
8
+ base_model: openbmb/MiniCPM5-2B
9
+ base_model_relation: finetune
10
+ tags:
11
+ - minicpm
12
+ - minicpm5
13
+ - llama
14
+ - math
15
+ - reasoning
16
+ - theorem-proving
17
+ - long-context
18
+ - on-device
19
+ ---
20
+
21
+ <p align="center">
22
+ <a href="https://github.com/Caldalis/MiniCPM-Math-harness" target="_blank">MiniCPM-Math Harness</a> |
23
+ <a href="https://huggingface.co/Caldalis/MiniCPM5-2B-Math-GGUF" target="_blank">GGUF</a> |
24
+ <a href="https://huggingface.co/openbmb/MiniCPM5-2B" target="_blank">MiniCPM5-2B</a> |
25
+ <a href="https://github.com/OpenBMB/MiniCPM" target="_blank">MiniCPM GitHub</a>
26
+ </p>
27
+
28
+ <p align="center">
29
+ English |
30
+ <a href="https://huggingface.co/Caldalis/MiniCPM5-2B-Math/blob/main/README-cn.md" target="_blank">中文</a>
31
+ </p>
32
+
33
+ ## Highlights
34
+
35
+ **MiniCPM5-2B-Math** is a math and proof model built on MiniCPM5: a dense 2.5B model based on
36
+ [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) and post-trained for long-form mathematical reasoning and proof
37
+ writing. It runs on a single consumer GPU or a laptop and keeps the native 128K context.
38
+
39
+ - **Strong for its size.** As a plain single call with up to 128K tokens of thinking, 92.3 on AIME 2025, 89.8 on
40
+ AIME 2026 and 81.8 on HMMT February 2026 (avg@16), and 100 / 93.3 / 90.9 with a 16-sample vote. The official
41
+ general-purpose MiniCPM5-2B scores 87.1 / 89.8 / 68.4 under the same protocol.
42
+ - **Writes checkable proofs.** On IMO-ProofBench Basic, an average single call with up to 128K tokens writes a
43
+ complete proof for 21 of the 30 problems, and the proof swarm for 23, as graded blind by an AI grader.
44
+ - **Comes with a proof swarm.** The open-source [MiniCPM-Math Harness](https://github.com/Caldalis/MiniCPM-Math-harness) runs
45
+ parallel provers, adversarial verifiers, brute-force checks and repair loops around this model on any
46
+ OpenAI-compatible server. It is designed around the failure modes we measured.
47
+ - **Small enough to own.** BF16 weights are 5.0 GB; GGUF Q4_K_M is 1.6 GB. Standard `LlamaForCausalLM`
48
+ architecture, so no custom code is needed.
49
+
50
+ ## Evaluation
51
+
52
+ ### AIME and HMMT
53
+
54
+ | Benchmark | Metric | MiniCPM5-2B | MiniCPM5-2B-Math |
55
+ |---|---|---:|---:|
56
+ | AIME 2025 | avg@16 | 87.1 | **92.3** |
57
+ | | vote (maj@16) | 93.3 | **100.0** |
58
+ | AIME 2026 | avg@16 | 89.8 | 89.8 |
59
+ | | vote (maj@16) | 93.3 | 93.3 |
60
+ | HMMT Feb 2026 | avg@16 | 68.4 | **81.8** |
61
+ | | vote (maj@16) | 75.8 | **90.9** |
62
+
63
+ *avg@16* is the mean accuracy of single samples, i.e. of one plain API call; *vote* is the majority answer of the 16
64
+ samples (reproduce with the [harness](https://github.com/Caldalis/MiniCPM-Math-harness):
65
+ `minicpm-math solve -n 16 --max-tokens 131072 --no-early-stop --no-force-finish`).
66
+
67
+ ### Proofs: IMO-ProofBench Basic
68
+
69
+ All 30 problems. *Single call*: 16 independent calls per problem with up to 128K tokens each and no forced finish
70
+ (the row is the average call). *Proof swarm*: the harness' `standard` profile with 128K-token provers and refiners
71
+ (8 provers, 3 verifiers, up to 2 repair rounds). All 505 written proofs were graded blind by one AI grader (Claude
72
+ Opus 5.5) against the official reference solutions and grading guidelines, not by people; the 5 single calls that
73
+ reached the 128K limit without a proof count as 0. Every proof and grade is
74
+ [published](https://github.com/Caldalis/MiniCPM-Math-harness/tree/main/docs/results/proofbench-basic).
75
+
76
+ | | Complete proofs | Mean score (0–7) |
77
+ |---|---:|---:|
78
+ | single call (avg@16) | 21.0 / 30 | 5.48 |
79
+ | proof swarm | **23 / 30** | **5.83** |
80
+
81
+ ## Use it with the proof swarm
82
+
83
+ ```bash
84
+ pip install "minicpm-math[math] @ git+https://github.com/Caldalis/MiniCPM-Math-harness"
85
+ vllm serve Caldalis/MiniCPM5-2B-Math --max-model-len 131072 --port 8000
86
+ minicpm-math prove "Prove that for every integer n, n^5 - n is divisible by 30." --base-url http://127.0.0.1:8000/v1
87
+ ```
88
+
89
+ The proof-swarm numbers above used `--max-tokens 131072`; the default profile gives each call 32K tokens, which is
90
+ faster but was not benchmarked.
91
+
92
+ The swarm returns the best proof together with how it was graded (`accepted` only if every verifier gives at
93
+ least 6/7), and keeps a full trace of every call. See the [harness README](https://github.com/Caldalis/MiniCPM-Math-harness)
94
+ for profiles, answer-mode voting, and benchmarking.
95
+
96
+ ## Quickstart
97
+
98
+ > [!Tip]
99
+ > Recommended sampling: `temperature=0.9, top_p=0.95, min_p=0.0`, with thinking enabled. Proofs for hard
100
+ > problems can need 64K–120K output tokens. Give the server enough context (`--max-model-len 131072`) and the
101
+ > request a large `max_tokens`.
102
+
103
+ ### vLLM
104
+
105
+ ```bash
106
+ pip install "vllm>=0.21"
107
+ vllm serve Caldalis/MiniCPM5-2B-Math --max-model-len 131072 --port 8000
108
+ ```
109
+
110
+ ```bash
111
+ curl http://localhost:8000/v1/chat/completions \
112
+ -H "Content-Type: application/json" \
113
+ -d '{
114
+ "model": "Caldalis/MiniCPM5-2B-Math",
115
+ "messages": [{"role": "user", "content": "Prove that the square root of 2 is irrational."}],
116
+ "max_tokens": 16384, "temperature": 0.9, "top_p": 0.95,
117
+ "chat_template_kwargs": {"enable_thinking": true}
118
+ }'
119
+ ```
120
+
121
+ Measured with vLLM 0.24.0 on RTX 4090s: about 155 tok/s single-stream decode on one GPU with short inputs (keep
122
+ CUDA graphs on; do not use `--enforce-eager`, which measured about 48 tok/s). On long proof runs across five 4090s
123
+ with up to 10 concurrent requests, the median request decoded at about 118 tok/s, about 900 tok/s in total.
124
+
125
+ ### SGLang
126
+
127
+ ```bash
128
+ pip install "sglang[srt]>=0.5.16"
129
+ python -m sglang.launch_server --model-path Caldalis/MiniCPM5-2B-Math --context-length 131072 --port 30000
130
+ ```
131
+
132
+ ### llama.cpp
133
+
134
+ ```bash
135
+ llama-server -hf Caldalis/MiniCPM5-2B-Math-GGUF:Q8_0 --jinja -ngl 99 -c 98304 -np 4 -kvu --port 8000
136
+ ```
137
+
138
+ Port 8000 is where the harness looks by default (`llama-server` alone listens on 8080); with this server, run the
139
+ harness with `--profile quick`. Use llama.cpp b9833 or newer: b9354 added the MiniCPM5 tokenizer, so older builds
140
+ cannot load the GGUF, and b9833 added the chat parser that separates the reasoning from the answer. On an Apple M5
141
+ laptop (16 GB) with Q8_0: about 46 tok/s for one stream, about 125 tok/s total with 4 slots. llama.cpp's default
142
+ `min_p=0.05` can encourage repetition, so send `min_p=0.0` (the harness does this for you).
143
+
144
+ ### Transformers
145
+
146
+ ```bash
147
+ pip install -U "transformers>=5.6" accelerate torch
148
+ ```
149
+
150
+ ```python
151
+ from transformers import AutoModelForCausalLM, AutoTokenizer
152
+
153
+ model_id = "Caldalis/MiniCPM5-2B-Math"
154
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
155
+ # On Apple Silicon (MPS), also pass attn_implementation="eager": PyTorch's MPS SDPA kernel (checked with
156
+ # torch 2.11) mishandles this model's grouped-query attention and degrades the output. CUDA and CPU are fine.
157
+ model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")
158
+
159
+ messages = [{"role": "user", "content": "Find all positive integers n such that n^2 - 19n + 99 is a perfect square."}]
160
+ inputs = tokenizer.apply_chat_template(
161
+ messages, tokenize=True, add_generation_prompt=True, enable_thinking=True,
162
+ return_dict=True, return_tensors="pt",
163
+ ).to(model.device)
164
+ outputs = model.generate(**inputs, max_new_tokens=8192, do_sample=True, temperature=0.9, top_p=0.95)
165
+ print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
166
+ ```
167
+
168
+ ### Prompting tips
169
+
170
+ - For problems with a final answer, end the prompt with *"Please reason step by step, and put your final answer
171
+ within \boxed{}."*
172
+ - For proofs, ask explicitly for a complete and rigorous proof, and to prove both directions when the problem asks
173
+ you to "find all" or "determine".
174
+ - With thinking enabled, the reasoning ends with `</think>`, followed by the final answer. Servers with a reasoning
175
+ parser return the two parts separately; otherwise split on `</think>`.
176
+
177
+ ## License
178
+
179
+ The model weights are released under the [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) license (see
180
+ `LICENSE`), the same license as the base model,
181
+ [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B).