> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-zh/yu-yan-mo-xing/mimo-v2-flash.md).

# MiMo-V2-Flash

在 Clore.ai 上使用投机解码部署 MiMo-V2-Flash（309B MoE）——超快推理，速度达 150+ tok/s

> MiMo-V2-Flash 是一个 **3090亿参数的专家混合（MoE）** 每个 token 激活 150 亿参数的语言模型。它采用先进的推测解码（EAGLE/MTP）构建，可提供 **每秒 150+ 个 token** 在 8×H100 上，同时保持前沿级性能。采用 **MIT 许可证**授权发布，它代表了高效大规模推理的前沿。

## 一览

* **模型大小**: 总参数 309B / 激活参数 15B（MoE）
* **许可证**: MIT（可完全商用）
* **上下文**: 32K tokens
* **性能**: 推理基准上的 SOTA
* **显存**: \~320GB FP16（至少需要 4×A100 80GB）
* **速度**: 采用推测解码，在 8×H100 上可达 150+ tok/s

## 为什么选择 MiMo-V2-Flash？

**突破性速度**: MiMo-V2-Flash 通过 EAGLE（用于提升语言模型效率的外推算法）和 MTP（多 token 预测）实现了前所未有的推理速度。传统模型一次生成一个 token，而 MiMo-V2 会并行预测并验证多个 token。

**可直接生产部署的规模**: 在 309B 参数规模下，MiMo-V2-Flash 可与最大型的前沿模型竞争，同时仍可部署在现实可行的硬件配置上。15B 的激活参数确保了在庞大参数量下仍能高效推理。

**先进架构**: 除了标准 MoE 外，MiMo-V2-Flash 还将推测解码原生集成到模型架构中。这不是训练后的优化——它被构建在基础之中，从而带来有保障的速度提升。

**企业级品质**: MIT 许可证，无使用限制。可大规模部署、微调，或集成到商业产品中，无需担心许可问题。

## GPU 推荐

{% hint style="warning" %}
**Clore.ai 市场上未列出多 GPU 的 80GB 级机型。** 目前列出的最大配置是 4× RTX PRO 6000 Blackwell（每张 96GB，共 380GB）以及 8–11× RTX 5090（每张 32GB）。A100 / H200 / B200 容量可按 [裸机](https://clore.ai/bare-metal) 需求提供。部署前请查看 [GPU 价格与可用性](/guides/guides_v2-zh/ru-men-zhi-nan/pricing.md) 。
{% endhint %}

| 配置              | 显存    | 性能             | 每日成本\*   |
| --------------- | ----- | -------------- | -------- |
| **4×A100 80GB** | 320GB | \~80 个 token/秒 | \~$16.00 |
| **8×A100 40GB** | 320GB | \~70 tok/s     | \~$28.00 |
| **2×H100**      | 160GB | \~90 tok/s     | \~$12.00 |
| **8×H100**      | 640GB | **150+ tok/s** | \~$48.00 |
| 4×H200          | 564GB | \~120 tok/s    | \~$32.00 |

**最佳性价比**: 4×A100 80GB 具有极佳的单价性能比，可作为 [裸机](https://clore.ai/bare-metal)。在市场上，对应的是一套 4× RTX PRO 6000 Blackwell 配置（380GB）。 **最高性能**: 8×H100 可释放推测解码的全部潜力。

\*Clore.ai 市场预估价格

## 使用 SGLang 部署（推荐）

SGLang 对 MiMo-V2-Flash 的推测解码特性支持最好：

### 安装 SGLang

```bash
pip install "sglang[all]>=0.3.0"
# 或最新版本
pip install git+https://github.com/sgl-project/sglang.git
```

### 使用 MTP 的多 GPU 配置

```bash
python -m sglang.launch_server \\
  --model-path mimo-ai/MiMo-V2-Flash \\
  --tp-size 8 \\
  --enable-mtp \\
  --mtp-max-draft-tokens 8 \\
  --mtp-acceptance-rate 0.8 \\
  --mem-fraction-static 0.85 \\
  --dtype float16 \\
  --context-length 32768 \\
  --served-model-name mimo-v2-flash
```

### 使用 OpenAI API 查询

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1", 
    api_key="EMPTY"
)

response = client.chat.completions.create(
    model="mimo-v2-flash",
    messages=[
        {"role": "system", "content": "你是一名 AI 研究专家。"},
        {"role": "user", "content": "请用恰好 500 个词详细解释量子计算"}
    ],
    max_tokens=1024,
    temperature=0.7,
    stream=True  # 推荐以获得最佳延迟
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end='', flush=True)
```

## 使用 vLLM 部署

vLLM 也支持带推测解码的 MiMo-V2-Flash：

```bash
pip install vllm>=0.6.0

vllm serve mimo-ai/MiMo-V2-Flash \\
  --tensor-parallel-size 8 \\
  --speculative-model mimo-ai/MiMo-V2-Flash-Draft \\
  --speculative-max-model-len 32768 \\
  --speculative-draft-tensor-parallel-size 2 \\
  --use-v2-block-manager \\
  --dtype float16 \\
  --served-model-name mimo-v2-flash \\
  --trust-remote-code
```

## Docker 模板

```dockerfile
FROM nvidia/cuda:12.8.1-devel-ubuntu22.04

# 安装依赖
RUN apt-get update && \\
    apt-get install -y python3.10 python3-pip git && \\
    rm -rf /var/lib/apt/lists/*

# 安装支持 MTP 的 SGLang
RUN pip install "sglang[all]>=0.3.0" transformers

# 设置环境变量
ENV PYTHONUNBUFFERED=1
ENV CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7

# 预下载模型（可选，可节省启动时间）
# RUN python3 -c "from transformers import AutoModel; AutoModel.from_pretrained('mimo-ai/MiMo-V2-Flash', trust_remote_code=True)"

EXPOSE 30000

CMD ["python", "-m", "sglang.launch_server", \\
     "--model-path", "mimo-ai/MiMo-V2-Flash", \\
     "--host", "0.0.0.0", \\
     "--port", "30000", \\
     "--tp-size", "8", \\
     "--enable-mtp", \\
     "--mtp-max-draft-tokens", "8", \\
     "--dtype", "float16"]
```

使用全部 GPU 运行：

```bash
docker build -t mimo-v2-flash .
docker run --gpus all -p 30000:30000 \\
  --shm-size=64g \\
  --ulimit memlock=-1 \\
  --ulimit stack=67108864 \\
  mimo-v2-flash
```

## 高级配置

### 优化推测解码

根据你的工作负载微调推测参数：

```bash
# 用于代码生成（更高接受率）
python -m sglang.launch_server \\
  --model-path mimo-ai/MiMo-V2-Flash \\
  --tp-size 8 \\
  --enable-mtp \\
  --mtp-max-draft-tokens 12 \\
  --mtp-acceptance-rate 0.9 \\
  --temperature 0.1

# 用于创意写作（更低接受率）
python -m sglang.launch_server \\
  --model-path mimo-ai/MiMo-V2-Flash \\
  --tp-size 8 \\
  --enable-mtp \\
  --mtp-max-draft-tokens 6 \\
  --mtp-acceptance-rate 0.7 \\
  --temperature 0.8
```

### 内存优化

对于内存受限的配置：

```bash
# 降低内存使用（更慢，但可适配 4×A100）
python -m sglang.launch_server \\
  --model-path mimo-ai/MiMo-V2-Flash \\
  --tp-size 4 \\
  --mem-fraction-static 0.75 \\
  --context-length 16384 \\
  --dtype float16 \\
  --disable-cuda-graph  # 节省显存
```

## 基准测试示例

测试 MiMo-V2-Flash 的速度优势：

```python
import time
from openai import OpenAI

client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")

def benchmark_generation():
    start_time = time.time()
    
    response = client.chat.completions.create(
        model="mimo-v2-flash",
        messages=[
            {"role": "user", "content": "请用恰好 500 个词详细解释量子计算"}
        ],
        max_tokens=600,
        temperature=0.1,
        stream=False
    )
    
    end_time = time.time()
    content = response.choices[0].message.content
    
    tokens = len(content.split())  # 粗略估计 token 数
    duration = end_time - start_time
    tokens_per_second = tokens / duration
    
    print(f"在 {duration:.2f}s 内生成了 {tokens} 个 token")
    print(f"速度：{tokens_per_second:.1f} tokens/秒")
    
    return tokens_per_second

# 运行基准测试
speed = benchmark_generation()
print(f"\nMiMo-V2-Flash 达到了 {speed:.1f} tok/s")
```

## 给 Clore.ai 用户的建议

* **多 GPU 必需**: MiMo-V2-Flash 至少需要 4×A100 80GB。单 GPU 部署不可行。
* **NVLink 优势**: 选择 GPU 之间具备 NVLink 的 Clore.ai 主机，以获得最佳多 GPU 通信。
* **内存要求**: 确保系统内存 256GB 以上，以便 8 张 GPU 平稳运行。
* **推测参数调优**: 调整 `mtp-max-draft-tokens` ，根据你的使用场景进行设置——重复性任务可设高些，创意工作可设低些。
* **上下文长度**: 32K 上下文最优。更长的上下文会降低推测解码效果。

## 故障排查

| 问题                     | 解决方案                                                  |
| ---------------------- | ----------------------------------------------------- |
| `OutOfMemoryError` 启动时 | 减少 `mem-fraction-static` 或 `tp-size`                  |
| GPU 间通信较慢              | 检查 NVLink： `nvidia-ml-py3` 或 `nvidia-smi topo -m`     |
| MTP 未加速                | 查看 `mtp-acceptance-rate` —— 值过高会禁用推测                  |
| 模型加载超时                 | 预下载： `huggingface-cli download mimo-ai/MiMo-V2-Flash` |
| token 接受率差             | 检查 temperature 设置——过低/过高的 temperature 会降低接受率          |

## 性能对比

| 模型                | 大小       | 速度（8×H100）     | 质量    |
| ----------------- | -------- | -------------- | ----- |
| GPT-4 Turbo       | \~1.7T   | \~15-25 tok/s  | ★★★★★ |
| Claude Sonnet 3.5 | \~200B   | \~25-35 tok/s  | ★★★★★ |
| **MiMo-V2-Flash** | **309B** | **150+ tok/s** | ★★★★☆ |
| Llama 3.1 405B    | 405B     | \~30-45 tok/s  | ★★★★☆ |

MiMo-V2-Flash 在保持有竞争力质量的同时，相比同类模型实现了 3-5 倍加速。

## 资源

* [Hugging Face 上的 MiMo-V2-Flash](https://huggingface.co/mimo-ai/MiMo-V2-Flash)
* [EAGLE 论文](https://arxiv.org/abs/2401.15077)
* [SGLang 文档](https://sgl-project.github.io/start/install.html)
* [多 Token 预测](https://arxiv.org/abs/2404.19737)
* [推测解码指南](https://huggingface.co/blog/assisted-generation)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-zh/yu-yan-mo-xing/mimo-v2-flash.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
