File size: 7,650 Bytes
ed717d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9dd62de
 
 
 
ed717d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e6b20e
 
ed717d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c9f24a9
 
ed717d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c5c6ad
ed717d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e6b20e
 
 
ed717d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e6b20e
 
 
ed717d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
---
license: apache-2.0
language:
  - en
  - zh
library_name: transformers
pipeline_tag: text-generation
base_model: openbmb/MiniCPM5-2B
base_model_relation: finetune
tags:
  - minicpm
  - minicpm5
  - llama
  - math
  - reasoning
  - theorem-proving
  - long-context
  - on-device
---

<div align="center">
<img src="https://huggingface.co/Caldalis/MiniCPM5-2B-Math/resolve/main/assets/banner.png" alt="MiniCPM5-2B-Math: a 2.5B model for math and proofs, with a proof swarm you can run yourself" width="100%" />
</div>

<p align="center">
<a href="https://github.com/Caldalis/MiniCPM-Math-harness" target="_blank">MiniCPM-Math Harness</a> |
<a href="https://huggingface.co/Caldalis/MiniCPM5-2B-Math-GGUF" target="_blank">GGUF</a> |
<a href="https://huggingface.co/openbmb/MiniCPM5-2B" target="_blank">MiniCPM5-2B</a> |
<a href="https://github.com/OpenBMB/MiniCPM" target="_blank">MiniCPM GitHub</a>
</p>

<p align="center">
English |
<a href="https://huggingface.co/Caldalis/MiniCPM5-2B-Math/blob/main/README-cn.md" target="_blank">中文</a>
</p>

## Highlights

**MiniCPM5-2B-Math** is a math and proof model built on MiniCPM5: a dense 2.5B model based on
[MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) and post-trained for long-form mathematical reasoning and proof
writing. It runs on a single consumer GPU or a laptop and keeps the native 128K context.

- **Strong for its size.** As a plain single call with up to 128K tokens of thinking, 92.3 on AIME 2025, 89.8 on
  AIME 2026 and 81.8 on HMMT February 2026 (avg@16), and 100 / 93.3 / 90.9 with a 16-sample vote. Overall, it
  outperforms the original general-purpose MiniCPM5-2B on AIME and HMMT.
- **Writes checkable proofs.** On IMO-ProofBench Basic, an average single call with up to 128K tokens writes a
  complete proof for 21 of the 30 problems, and the proof swarm for 23, as graded blind by an AI grader.
- **Comes with a proof swarm.** The open-source [MiniCPM-Math Harness](https://github.com/Caldalis/MiniCPM-Math-harness) runs
  parallel provers, adversarial verifiers, brute-force checks and repair loops around this model on any
  OpenAI-compatible server. It is designed around the failure modes we measured.
- **Small enough to own.** BF16 weights are 5.0 GB; GGUF Q4_K_M is 1.6 GB. Standard `LlamaForCausalLM`
  architecture, so no custom code is needed.

## Evaluation

### AIME and HMMT

| Benchmark | Metric | MiniCPM5-2B | MiniCPM5-2B-Math |
|---|---|---:|---:|
| AIME 2025 | avg@16 | 87.1 | **92.3** |
| | vote (maj@16) | 93.3 | **100.0** |
| AIME 2026 | avg@16 | 89.8 | 89.8 |
| | vote (maj@16) | 93.3 | 93.3 |
| HMMT Feb 2026 | avg@16 | 68.4 | **81.8** |
| | vote (maj@16) | 75.8 | **90.9** |

*avg@16* is the mean accuracy of single samples, i.e. of one plain API call; *vote* is the majority answer of the 16
samples (reproduce with the [harness](https://github.com/Caldalis/MiniCPM-Math-harness):
`minicpm-math solve -n 16 --max-tokens 131072 --no-early-stop --no-force-finish`).

### Proofs: IMO-ProofBench Basic

All 30 problems. *Single call*: 16 independent calls per problem with up to 128K tokens each. *Proof swarm*: the
harness' `standard` profile with 128K-token provers and refiners. Every proof and grade is
[published](https://github.com/Caldalis/MiniCPM-Math-harness/tree/main/docs/results/proofbench-basic).

| | Complete proofs | Mean score (0–7) |
|---|---:|---:|
| single call (avg@16) | 21.0 / 30 | 5.48 |
| proof swarm | **23 / 30** | **5.83** |

## Use it with the proof swarm

```bash
pip install "minicpm-math[math] @ git+https://github.com/Caldalis/MiniCPM-Math-harness"
vllm serve Caldalis/MiniCPM5-2B-Math --max-model-len 131072 --port 8000
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
```

The proof-swarm numbers above used `--max-tokens 131072`; the default profile gives each call 32K tokens, which is
faster.

The swarm returns the best proof together with how it was graded (`accepted` only if every verifier gives at
least 6/7), and keeps a full trace of every call. See the [harness README](https://github.com/Caldalis/MiniCPM-Math-harness)
for profiles, answer-mode voting, and benchmarking.

## Quickstart

> [!Tip]
> Recommended sampling: `temperature=0.9, top_p=0.95, min_p=0.0`, with thinking enabled. Proofs for hard
> problems can need 64K–120K output tokens. Give the server enough context (`--max-model-len 131072`) and the
> request a large `max_tokens`.

### vLLM

```bash
pip install "vllm>=0.21"
vllm serve Caldalis/MiniCPM5-2B-Math --max-model-len 131072 --port 8000
```

```bash
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Caldalis/MiniCPM5-2B-Math",
    "messages": [{"role": "user", "content": "Prove that the square root of 2 is irrational."}],
    "max_tokens": 16384, "temperature": 0.9, "top_p": 0.95,
    "chat_template_kwargs": {"enable_thinking": true}
  }'
```

Measured with vLLM 0.24.0 on RTX 4090s: about 155 tok/s single-stream decode on one GPU with short inputs. On
long proof runs across five 4090s with up to 10 concurrent requests, the median request decoded at about 118 tok/s,
about 900 tok/s in total.

### SGLang

```bash
pip install "sglang[srt]>=0.5.16"
python -m sglang.launch_server --model-path Caldalis/MiniCPM5-2B-Math --context-length 131072 --port 30000
```

### llama.cpp

```bash
llama-server -hf Caldalis/MiniCPM5-2B-Math-GGUF:Q8_0 --jinja -ngl 99 -c 98304 -np 4 -kvu --port 8000
```

Port 8000 is where the harness looks by default (`llama-server` alone listens on 8080); with this server, run the
harness with `--profile quick`. On an Apple M5 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 `min_p=0.05` can encourage repetition, so send `min_p=0.0` (the
harness does this for you).

### Transformers

```bash
pip install -U "transformers>=5.6" accelerate torch
```

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Caldalis/MiniCPM5-2B-Math"
tokenizer = AutoTokenizer.from_pretrained(model_id)
# On Apple Silicon (MPS), also pass attn_implementation="eager": PyTorch's MPS SDPA kernel (checked with
# torch 2.11) mishandles this model's grouped-query attention and degrades the output. CUDA and CPU are fine.
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")

messages = [{"role": "user", "content": "Find all positive integers n such that n^2 - 19n + 99 is a perfect square."}]
inputs = tokenizer.apply_chat_template(
    messages, tokenize=True, add_generation_prompt=True, enable_thinking=True,
    return_dict=True, return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=8192, do_sample=True, temperature=0.9, top_p=0.95)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
```

### Prompting tips

- For problems with a final answer, end the prompt with *"Please reason step by step, and put your final answer
  within \boxed{}."*
- For proofs, ask explicitly for a complete and rigorous proof, and to prove both directions when the problem asks
  you to "find all" or "determine".
- With thinking enabled, the reasoning ends with `</think>`, followed by the final answer. Servers with a reasoning
  parser return the two parts separately; otherwise split on `</think>`.

## License

The model weights are released under the [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) license (see
`LICENSE`), the same license as the base model,
[MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B).