curli12 commited on
Commit
3a348bc
·
verified ·
1 Parent(s): cd7794c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +2 -315
README.md CHANGED
@@ -1,316 +1,3 @@
1
  ---
2
- license: mit
3
- library_name: transformers
4
- ---
5
-
6
- <br/><br/>
7
-
8
- <div align="center">
9
- <picture>
10
- <source srcset="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/Xiaomi_MiMo_darkmode.png?raw=true" media="(prefers-color-scheme: dark)">
11
- <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/Xiaomi_MiMo.png?raw=true" width="60%" alt="Xiaomi-MiMo" />
12
- </picture>
13
- </div>
14
-
15
- <br/>
16
-
17
- <div align="center" style="line-height: 1;">
18
- |
19
- <a href="https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash" target="_blank">🤗 HuggingFace</a>
20
- &nbsp;|
21
- <a href="https://github.com/XiaomiMiMo/MiMo-V2-Flash/blob/main/paper.pdf" target="_blank">📔 Technical Report </a>
22
- &nbsp;|
23
- <a href="https://mimo.xiaomi.com/blog/mimo-v2-flash" target="_blank">📰 Blog </a>
24
- &nbsp;|
25
- <br/><br/>
26
- <strong>Play around!</strong> &nbsp;
27
- <a href="https://aistudio.xiaomimimo.com" target="_blank">🗨️ Xiaomi MiMo Studio </a>
28
- &nbsp;
29
- <a href="https://platform.xiaomimimo.com/" target="_blank">🎨 Xiaomi MiMo API Platform </a>
30
- </div>
31
- <br/>
32
-
33
- # MiMo-V2-Flash
34
-
35
- **MiMo-V2-Flash** is a Mixture-of-Experts (MoE) language model with **309B total parameters** and **15B active parameters**. Designed for high-speed reasoning and agentic workflows, it utilizes a novel hybrid attention architecture and Multi-Token Prediction (MTP) to achieve state-of-the-art performance while significantly reducing inference costs.
36
-
37
- <p align="center">
38
- <img width="80%" src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/MiMo-v2-flash-performance.jpg?raw=true">
39
- </p>
40
-
41
- -----
42
-
43
- ## 1. Introduction
44
-
45
- MiMo-V2-Flash creates a new balance between long-context modeling capability and inference efficiency. Key features include:
46
-
47
- * **Hybrid Attention Architecture**: Interleaves Sliding Window Attention (SWA) and Global Attention (GA) with a 5:1 ratio and an aggressive 128-token window. This reduces KV-cache storage by nearly 6x while maintaining long-context performance via learnable **attention sink bias**.
48
- * **Multi-Token Prediction (MTP)**: Equipped with a lightweight MTP module (0.33B params/block) using dense FFNs. This triples output speed during inference and will be good to accelerates rollout in RL training.
49
- * **Efficient Pre-Training**: Trained on 27T tokens using FP8 mixed precision and native 32k seq length. The context window supports up to 256k length.
50
- * **Agentic Capabilities**: Post-training utilizes Multi-Teacher On-Policy Distillation (MOPD) and large-scale agentic RL, achieving superior performance on **SWE-Bench** and complex reasoning tasks.
51
-
52
- -----
53
-
54
- ## 2. Model Downloads
55
-
56
- | Model | Total Params | Active Params | Context Length | Download |
57
- | :--------------------- | :----------: | :-----------: | :------------: | :-------------------------------------------------------------------: |
58
- | **MiMo-V2-Flash-Base** | 309B | 15B | 256k | [🤗 HuggingFace](https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash-Base) |
59
- | **MiMo-V2-Flash** | 309B | 15B | 256k | [🤗 HuggingFace](https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash) |
60
-
61
- > [!IMPORTANT]
62
- > We also open-source the 3-layer MTP weights to foster community research.
63
-
64
- -----
65
-
66
- ## 3. Evaluation Results
67
-
68
- ### Base Model Evaluation
69
-
70
- MiMo-V2-Flash-Base demonstrates strong performance across standard benchmarks, surpassing models with significantly larger parameter counts.
71
-
72
- | Category | Benchmark | Setting/Length | MiMo-V2-Flash Base | Kimi-K2 Base | DeepSeek-V3.1 Base | DeepSeek-V3.2 Exp Base |
73
- | :--------------- | :---------------------- | :------------- | :----------------: | :-------------: | :----------------: | :--------------------: |
74
- | **Params** | **#Activated / #Total** | - | **15B / 309B** | **32B / 1043B** | **37B / 671B** | **37B / 671B** |
75
- | **General** | BBH | 3-shot | 88.5 | 88.7 | 88.2 | 88.7 |
76
- | | MMLU | 5-shot | 86.7 | 87.8 | 87.4 | 87.8 |
77
- | | MMLU-Redux | 5-shot | 90.6 | 90.2 | 90.0 | 90.4 |
78
- | | MMLU-Pro | 5-shot | 73.2 | 69.2 | 58.8 | 62.1 |
79
- | | DROP | 3-shot | 84.7 | 83.6 | 86.3 | 86.6 |
80
- | | ARC-Challenge | 25-shot | 95.9 | 96.2 | 95.6 | 95.5 |
81
- | | HellaSwag | 10-shot | 88.5 | 94.6 | 89.2 | 89.4 |
82
- | | WinoGrande | 5-shot | 83.8 | 85.3 | 85.9 | 85.6 |
83
- | | TriviaQA | 5-shot | 80.3 | 85.1 | 83.5 | 83.9 |
84
- | | GPQA-Diamond | 5-shot | 55.1 | 48.1 | 51.0 | 52.0 |
85
- | | SuperGPQA | 5-shot | 41.1 | 44.7 | 42.3 | 43.6 |
86
- | | SimpleQA | 5-shot | 20.6 | 35.3 | 26.3 | 27.0 |
87
- | **Math** | GSM8K | 8-shot | 92.3 | 92.1 | 91.4 | 91.1 |
88
- | | MATH | 4-shot | 71.0 | 70.2 | 62.6 | 62.5 |
89
- | | AIME 24&25 | 2-shot | 35.3 | 31.6 | 21.6 | 24.8 |
90
- | **Code** | HumanEval+ | 1-shot | 70.7 | 84.8 | 64.6 | 67.7 |
91
- | | MBPP+ | 3-shot | 71.4 | 73.8 | 72.2 | 69.8 |
92
- | | CRUXEval-I | 1-shot | 67.5 | 74.0 | 62.1 | 63.9 |
93
- | | CRUXEval-O | 1-shot | 79.1 | 83.5 | 76.4 | 74.9 |
94
- | | MultiPL-E HumanEval | 0-shot | 59.5 | 60.5 | 45.9 | 45.7 |
95
- | | MultiPL-E MBPP | 0-shot | 56.7 | 58.8 | 52.5 | 50.6 |
96
- | | BigCodeBench | 0-shot | 70.1 | 61.7 | 63.0 | 62.9 |
97
- | | LiveCodeBench v6 | 1-shot | 30.8 | 26.3 | 24.8 | 24.9 |
98
- | | SWE-Bench (AgentLess) | 3-shot | 30.8 | 28.2 | 24.8 | 9.4* |
99
- | **Chinese** | C-Eval | 5-shot | 87.9 | 92.5 | 90.0 | 91.0 |
100
- | | CMMLU | 5-shot | 87.4 | 90.9 | 88.8 | 88.9 |
101
- | | C-SimpleQA | 5-shot | 61.5 | 77.6 | 70.9 | 68.0 |
102
- | **Multilingual** | GlobalMMLU | 5-shot | 76.6 | 80.7 | 81.9 | 82.0 |
103
- | | INCLUDE | 5-shot | 71.4 | 75.3 | 77.2 | 77.2 |
104
- | **Long Context** | NIAH-Multi | 32K | 99.3 | 99.8 | 99.7 | 85.6* |
105
- | | | 64K | 99.9 | 100.0 | 98.6 | 85.9* |
106
- | | | 128K | 98.6 | 99.5 | 97.2 | 94.3* |
107
- | | | 256K | 96.7 | - | - | - |
108
- | | GSM-Infinite Hard | 16K | 37.7 | 34.6 | 41.5 | 50.4 |
109
- | | | 32K | 33.7 | 26.1 | 38.8 | 45.2 |
110
- | | | 64K | 31.5 | 16.0 | 34.7 | 32.6 |
111
- | | | 128K | 29.0 | 8.8 | 28.7 | 25.7 |
112
-
113
- > \* indicates the model may fail to follow the prompt or format.
114
-
115
- ### Post-training Model Evaluation
116
-
117
- Following our Post-Training Paradigm with MOPD and Agentic RL, the model achieves SOTA reasoning and agentic performance.
118
-
119
-
120
-
121
- | Benchmark | MiMo-V2 Flash | Kimi-K2 Thinking | DeepSeek-V3.2 Thinking | Gemini-3.0 Pro | Claude Sonnet 4.5 | GPT-5 High |
122
- | :----------------------------- | :-----------: | :--------------: | :--------------------: | :------------: | :---------------: | :--------: |
123
- | **Reasoning** | | | | | | |
124
- | MMLU-Pro | 84.9 | 84.6 | 85.0 | 90.1 | 88.2 | 87.5 |
125
- | GPQA-Diamond | 83.7 | 84.5 | 82.4 | 91.9 | 83.4 | 85.7 |
126
- | HLE (no tools) | 22.1 | 23.9 | 25.1 | 37.5 | 13.7 | 26.3 |
127
- | AIME 2025 | 94.1 | 94.5 | 93.1 | 95.0 | 87.0 | 94.6 |
128
- | HMMT Feb. 2025 | 84.4 | 89.4 | 92.5 | 97.5 | 79.2 | 88.3 |
129
- | LiveCodeBench-v6 | 80.6 | 83.1 | 83.3 | 90.7 | 64.0 | 84.5 |
130
- | **General Writing** | | | | | | |
131
- | Arena-Hard (Hard Prompt) | 54.1 | 71.9 | 53.4 | 72.6 | 63.3 | 71.9 |
132
- | Arena-Hard (Creative Writing) | 86.2 | 80.1 | 88.8 | 93.6 | 76.7 | 92.2 |
133
- | **Long Context** | | | | | | |
134
- | LongBench V2 | 60.6 | 45.1 | 58.4 | 65.6 | 61.8 | - |
135
- | MRCR | 45.7 | 44.2 | 55.5 | 89.7 | 55.4 | - |
136
- | **Code Agent** | | | | | | |
137
- | SWE-Bench Verified | 73.4 | 71.3 | 73.1 | 76.2 | 77.2 | 74.9 |
138
- | SWE-Bench Multilingual | 71.7 | 61.1 | 70.2 | - | 68.0 | 55.3 |
139
- | Terminal-Bench Hard | 30.5 | 30.6 | 35.4 | 39.0 | 33.3 | 30.5 |
140
- | Terminal-Bench 2.0 | 38.5 | 35.7 | 46.4 | 54.2 | 42.8 | 35.2 |
141
- | **General Agent** | | | | | | |
142
- | BrowseComp | 45.4 | - | 51.4 | - | 24.1 | 54.9 |
143
- | BrowseComp (w/ Context Manage) | 58.3 | 60.2 | 67.6 | 59.2 | - | - |
144
- | \\(\tau^2\\)-Bench | 80.3 | 74.3 | 80.3 | 85.4 | 84.7 | 80.2 |
145
-
146
- -----
147
-
148
- ## 4. Model Architecture
149
-
150
- <p align="center">
151
- <img width="80%" src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/MiMo-v2-flash-arch.png?raw=true">
152
- </p>
153
-
154
- ### Hybrid Sliding Window Attention
155
-
156
- MiMo-V2-Flash addresses the quadratic complexity of long contexts by interleaving Local Sliding Window Attention (SWA) and Global Attention (GA).
157
-
158
- * **Configuration**: Stacks of \\(M=8\\) hybrid blocks. Each block contains \\(N=5\\) SWA layers followed by 1 GA layer.
159
- * **Efficiency**: SWA layers use a window size of 128 tokens, reducing KV cache significantly.
160
- * **Sink Bias**: Learnable attention sink bias is applied to maintain performance despite the aggressive window size.
161
-
162
- ### Lightweight Multi-Token Prediction (MTP)
163
-
164
- Unlike traditional speculative decoding, our MTP module is natively integrated for training and inference.
165
-
166
- * **Structure**: Uses a dense FFN (instead of MoE) and SWA (instead of GA) to keep the parameter count low (0.33B per block).
167
- * **Performance**: Facilitates self-speculative decoding, tripling generation speed and mitigating GPU idleness during small-batch RL training.
168
-
169
- -----
170
-
171
- ## 5. Post-Training Technical Highlights
172
-
173
- MiMo-V2-Flash leverages a post-training pipeline designed to maximize reasoning and agentic capabilities through innovative distillation and reinforcement learning strategies.
174
-
175
- ### 5.1 Multi-Teacher On-Policy Distillation (MOPD)
176
-
177
- We introduce **Multi-Teacher On-Policy Distillation (MOPD)**, a new paradigm that formulates knowledge distillation as a reinforcement learning process.
178
- * **Dense Token-Level Guidance**: Unlike methods relying on sparse sequence-level feedback, MOPD utilizes domain-specific expert models (teachers) to provide supervision at every token position.
179
- * **On-Policy Optimization**: The student model learns from its own generated responses rather than a fixed dataset. This eliminates exposure bias and ensures smaller, more stable gradient updates.
180
- * **Inherent Reward Robustness**: Rewards are derived from the distribution divergence between student and teacher, making the process naturally resistant to reward hacking.
181
-
182
- ### 5.2 Scaling Agentic RL
183
-
184
- We significantly scale up the agentic training environments to improve intelligence and generalization.
185
- * **Massive Code Agent Environments**: We utilize real-world GitHub issues to create over 100,000 verifiable tasks. Our automated pipeline maintains a Kubernetes cluster capable of running over 10,000 concurrent pods with a 70% environment setup success rate.
186
- * **Multimodal Verifier for WebDev**: For web development tasks, we employ a vision-based verifier that evaluates code execution via recorded videos rather than static screenshots. This reduces visual hallucination and ensures functional correctness.
187
- * **Cross-Domain Generalization**: Our experiments show that large-scale RL training on code agents effectively generalizes to other domains, boosting performance in Math and General Agent tasks.
188
-
189
- ### 5.3 Advanced RL Infrastructure
190
-
191
- To support high-throughput RL training for large-scale MoE models, we implemented several infrastructure optimizations on top of SGLang and Megatron-LM.
192
- * **Rollout Routing Replay (R3)**: Addresses numerical precision inconsistencies in MoE routing between inference and training. R3 reuses the exact routed experts from rollout during the training pass, ensuring consistency with negligible overhead.
193
- * **Request-Level Prefix Cache**: In multi-turn agent training, this cache stores KV states and routed experts from prior turns. It avoids re-computation and ensures sampling consistency across turns.
194
- * **Fine-Grained Data Scheduler**: We extend the rollout engine to schedule fine-grained sequences instead of micro-batches. Combined with partial rollout, this significantly reduces GPU idleness caused by long-tail stragglers.
195
- * **Toolbox & Tool Manager**: A two-layer design using Ray actor pools to handle resource contention. It eliminates cold-start delays for tool execution and isolates task logic from system policies.
196
-
197
- -----
198
-
199
- ## 6. Inference & Deployment
200
-
201
- MiMo-V2-Flash supports FP8 mixed precision inference. We recommend using **SGLang** for optimal performance.
202
-
203
- ### Quick Start with SGLang
204
-
205
- ```bash
206
- pip install sglang
207
-
208
- # Launch server
209
- python3 -m sglang.launch_server \
210
- --model-path XiaomiMiMo/MiMo-V2-Flash \
211
- --served-model-name mimo-v2-flash \
212
- --pp-size 1 \
213
- --dp-size 2 \
214
- --enable-dp-attention \
215
- --tp-size 8 \
216
- --moe-a2a-backend deepep \
217
- --page-size 1 \
218
- --host 0.0.0.0 \
219
- --port 9001 \
220
- --trust-remote-code \
221
- --mem-fraction-static 0.75 \
222
- --max-running-requests 128 \
223
- --chunked-prefill-size 16384 \
224
- --reasoning-parser qwen3 \
225
- --tool-call-parser mimo \
226
- --context-length 262144 \
227
- --attention-backend fa3 \
228
- --speculative-algorithm EAGLE \
229
- --speculative-num-steps 3 \
230
- --speculative-eagle-topk 1 \
231
- --speculative-num-draft-tokens 4 \
232
- --enable-mtp
233
-
234
- # Send request
235
- curl -i http://localhost:9001/v1/chat/completions \
236
- -H 'Content-Type:application/json' \
237
- -d '{
238
- "messages" : [{
239
- "role": "user",
240
- "content": "Nice to meet you MiMo"
241
- }],
242
- "model": "mimo-v2-flash",
243
- "max_tokens": 4096,
244
- "temperature": 0.8,
245
- "top_p": 0.95,
246
- "stream": true,
247
- "chat_template_kwargs": {
248
- "enable_thinking": true
249
- }
250
- }'
251
- ```
252
-
253
- ### Notifications
254
-
255
- #### 1. System prompt
256
-
257
- > [!IMPORTANT]
258
- > The following system prompts are **HIGHLY** recommended, please choose from English and Chinese version.
259
-
260
- English
261
-
262
- ```plaintext
263
- You are MiMo, an AI assistant developed by Xiaomi.
264
-
265
- Today's date: {date} {week}. Your knowledge cutoff date is December 2024.
266
- ```
267
-
268
- Chinese
269
-
270
- ```plaintext
271
- 你是MiMo(中文名称也是MiMo),是小米公司研发的AI智能助手。
272
-
273
- 今天的日期:{date} {week},你的知识截止日期是2024年12月。
274
- ```
275
-
276
- #### 2. Sampling parameters
277
-
278
- > [!IMPORTANT]
279
- > Recommended sampling parameters:
280
- >
281
- > `top_p=0.95`
282
- >
283
- > `temperature=0.8` for math, writing, web-dev
284
- >
285
- > `temperature=0.3` for agentic taks (e.g., vibe-coding, tool-use)
286
-
287
- #### 3. Tool-use practice
288
-
289
- > [!IMPORTANT]
290
- > In the thinking mode with multi-turn tool calls, the model returns a `reasoning_content` field alongside `tool_calls`. To continue the conversation, the user must persist all history `reasoning_content` in the `messages` array of each subsequent request.
291
-
292
- -----
293
-
294
- ## 7. Citation
295
-
296
- If you find our work helpful, please cite our technical report:
297
-
298
- ```bibtex
299
- @misc{mimo2025flash,
300
- title={MiMo-V2-Flash Technical Report},
301
- author={LLM-Core Xiaomi},
302
- year={2025},
303
- url={https://github.com/XiaomiMiMo/MiMo-V2-Flash/paper.pdf}
304
- }
305
- ```
306
-
307
- ## 8. Contact
308
-
309
- Please contact us at [mimo@xiaomi.com](mailto:mimo@xiaomi.com), join our WeChat group below or open an issue if you have any questions.
310
-
311
- <p align="center">
312
- <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/wechat_group/wechat1.jpg?raw=true" width="20%" />
313
- <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/wechat_group/wechat2.jpg?raw=true" width="20%" />
314
- <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/wechat_group/wechat3.jpg?raw=true" width="20%" />
315
- <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/wechat_group/wechat4.jpg?raw=true" width="20%" />
316
- </p>
 
1
  ---
2
+ {}
3
+ ---