> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/zh/mo-xing/tutorials/minimax-m25.md).

# MiniMax-M2.5：运行指南

在你自己的设备上本地运行 MiniMax-M2.5！

MiniMax-M2.5 是一款全新的开源 LLM，在编程、智能体式工具使用、搜索和办公工作方面达到 SOTA，在以下项目中得分 80.2%： [SWE-Bench](#benchmarks) Verified，在 Multi-SWE-Bench 中为 51.3%，在 BrowseComp 中为 76.3%。

“ **230B 参数** （10B 激活）模型有一个 **200K 上下文** 上下文窗口，且未量化的 bf16 需要 **457GB**. Unsloth 动态 **3 位** GGUF 将大小缩减至 **101GB** **(-62%):** [**MiniMax-M2.5 GGUF**](https://huggingface.co/unsloth/MiniMax-M2.5-GGUF)

所有上传都使用 Unsloth [Dynamic 2.0](/docs/zh/ji-chu-zhi-shi/dynamic-3.0-ggufs.md) 以获得 SOTA 量化性能——因此 3-bit 会将重要层提升为 8 位或 16 位。你也可以通过 Unsloth 使用多 GPU 对模型进行微调。

{% hint style="success" %}
**2月26日：** 看看我们的 GGUF 量化版本 [在基准测试中的表现](#unsloth-gguf-benchmarks).
{% endhint %}

### :gear: 使用指南

3-bit 动态量化 UD-Q3\_K\_XL 使用 **101GB** 的磁盘空间——这非常适合放在一台 **128GB 统一内存的 Mac** 可达到约 20+ tokens/s，并且在配合以下设备时速度也更快： **1×16GB GPU 和 96GB RAM** 可达到 25+ tokens/s。 **2 位** 量化版本，或者最大的 2-bit 版本，可以放在 96GB 设备上。

对于接近 **满精度**，请使用 `Q8_0` （8-bit），其占用 243GB，可放在 256GB RAM 设备 / Mac 上，实现 10+ tokens/s。

{% hint style="success" %}
为了获得最佳性能，请确保你的可用总内存（VRAM + 系统内存）大于你正在下载的量化模型文件大小。如果不足，llama.cpp 仍可通过 SSD/HDD 卸载运行，但推理会更慢。
{% endhint %}

### 推荐设置

MiniMax 建议使用以下参数以获得最佳性能： `temperature=1.0`, `top_p = 0.95`, `top_k = 40`.

{% columns %}
{% column %}

| 默认设置（大多数任务）                |
| -------------------------- |
| `temperature = 1.0`        |
| `top_p = 0.95`             |
| `top_k = 40`               |
| `repeat penalty = 1.0` 或禁用 |
| {% endcolumn %}            |

{% column %}

* **最大上下文窗口：** `196,608`
* `Min_P = 0.01` （默认值可能为 0.05）
* 默认系统提示：

{% code overflow="wrap" %}

```
你是一位乐于助人的助手。你的名字是 MiniMax-M2.5，由 MiniMax 构建。
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}

## 运行 MiniMax-M2.5 教程：

在这些教程中，我们将使用 3-bit [UD-Q3\_K\_XL](https://huggingface.co/unsloth/MiniMax-M2.5-GGUF?show_file_info=UD-Q3_K_XL%2FMiniMax-M2.5-UD-Q3_K_XL-00001-of-00004.gguf) 量化版本，它可放入 128GB RAM 设备中。

#### ✨ 在 llama.cpp 中运行

{% stepper %}
{% step %}
获取最新的 `llama.cpp` 在 [GitHub 上获取](https://github.com/ggml-org/llama.cpp)。你也可以按照下面的构建说明进行操作。将 `-DGGML_CUDA=ON` 改为 `-DGGML_CUDA=OFF` 如果你没有 GPU，或者只想使用 CPU 推理。 **对于 Apple Mac / Metal 设备**，设置 `-DGGML_CUDA=OFF` 然后按常规继续——Metal 支持默认开启。

{% code overflow="wrap" %}

```bash
apt-get update
apt-get install pciutils build-essential cmake curl libcurl4-openssl-dev -y
git clone https://github.com/ggml-org/llama.cpp
cmake llama.cpp -B llama.cpp/build \\
    -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON
cmake --build llama.cpp/build --config Release -j --clean-first --target llama-cli llama-mtmd-cli llama-server llama-gguf-split
cp llama.cpp/build/bin/llama-* llama.cpp
```

{% endcode %}
{% endstep %}

{% step %}
如果你想使用 `llama.cpp` 直接加载模型，你可以按下面操作：(:Q3\_K\_XL) 是量化类型。你也可以通过 Hugging Face 下载（见第 3 点）。这类似于 `ollama run` 。使用 `export LLAMA_CACHE="folder"` 来强制 `llama.cpp` 保存到指定位置。请记住，该模型的最大上下文长度只有 200K。

按照以下内容进行 **大多数默认** 场景：

```bash
export LLAMA_CACHE="unsloth/MiniMax-M2.5-GGUF"
./llama.cpp/llama-cli \\
    -hf unsloth/MiniMax-M2.5-GGUF:UD-Q3_K_XL \\
    --ctx-size 16384 \
    --flash-attn on \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --min-p 0.01 \
    --top-k 40
```

{% endstep %}

{% step %}
通过以下方式下载模型（在安装 `pip install huggingface_hub hf_transfer` 之后）。你可以选择 `UD-Q3_K_XL` （动态 4-bit 量化）或其他量化版本，例如 `UD-Q6_K_XL` 。我们建议使用我们的 4bit 动态量化 `UD-Q3_K_XL` 以平衡大小和准确性。如果下载卡住，请参见 [Hugging Face Hub、XET 调试](/docs/zh/ji-chu-zhi-shi/troubleshooting-and-faqs/hugging-face-hub-xet-debugging.md)

```bash
hf download unsloth/MiniMax-M2.5-GGUF \\
    --local-dir unsloth/MiniMax-M2.5-GGUF \\
    --include "*UD-Q3_K_XL*" # 8-bit 使用 "*Q8_0*"
```

{% endstep %}

{% step %}
你可以修改 `--threads 32` CPU 线程数， `--ctx-size 16384` 用于上下文长度， `--n-gpu-layers 2` 用于 GPU 卸载的层数。如果你的 GPU 显存不足，请尝试调整它。如果你只使用 CPU 推理，也请将其移除。

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \\
    --model unsloth/MiniMax-M2.5-GGUF/UD-Q3_K_XL/MiniMax-M2.5-UD-Q3_K_XL-00001-of-00004.gguf \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --min-p 0.01 \
    --top-k 40 \
    --ctx-size 16384 \
    --seed 3407
```

{% endcode %}
{% endstep %}
{% endstepper %}

### 🦙 Llama-server 与 OpenAI 的补全库

要将 MiniMax-M2.5 部署到生产环境，我们使用 `llama-server` 或 OpenAI API。在新的终端中，例如通过 tmux，使用以下方式部署模型：

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-server \\
    --model unsloth/MiniMax-M2.5-GGUF/UD-Q3_K_XL/MiniMax-M2.5-UD-Q3_K_XL-00001-of-00004.gguf \\
    --alias "unsloth/MiniMax-M2.5" \\
    --prio 3 \
    --temp 1.0 \\
    --top-p 0.95 \\
    --min-p 0.01 \
    --top-k 40 \
    --ctx-size 16384 \
    --port 8001
```

{% endcode %}

然后在新的终端中，在完成以下操作后 `pip install openai`，执行：

{% code overflow="wrap" %}

```python
from openai import OpenAI
import json
openai_client = OpenAI(
    base_url = "http://127.0.0.1:8001/v1",
    api_key = "sk-no-key-required",
)
completion = openai_client.chat.completions.create(
    model = "unsloth/MiniMax-M2.5",
    messages = [{"role": "user", "content": "创建一个贪吃蛇游戏。"},],
)
print(completion.choices[0].message.content)
```

{% endcode %}

## 📊 基准测试

### Unsloth GGUF 基准测试

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FhfO2gsbz2lWrZXg3ojyE%2FHCGBTzgboAASv_A.png?alt=media&amp;token=7d6334ca-4f3c-4946-aacd-d55527375fce" alt=""><figcaption></figcaption></figure>

[Benjamin Marie（第三方）对](https://x.com/bnjmn_marie/status/2027043753484021810/photo/1) **MiniMax-M2.5** 使用 **Unsloth GGUF 量化版本** 在一个 **750 提示混合套件** （LiveCodeBench v6、MMLU Pro、GPQA、Math500）进行了基准测试，并报告了 **整体准确率** 和 **相对错误增长** （量化模型与原始模型相比，出错频率增加了多少）。

无论精度如何，Unsloth 量化版本在准确率和相对误差方面都远胜于非 Unsloth 对应版本（尽管它们小 8GB）。

**关键结果：**

* **这里最佳的质量/大小权衡： `unsloth UD-Q4_K_XL`.**\
  它最接近原版：仅 **6.0 分** 下降，而且“仅仅” **+22.8%** 比基线多出更多错误。
* **其他 Unsloth Q4 量化版本表现非常接近（准确率约 64.5–64.9）。**\
  `IQ4_NL`, `MXFP4_MOE`，以及 `UD-IQ2_XXS` 在这个基准上质量基本相同，其中 **约 33–35%** 比原版多出更多错误。
* Unsloth GGUF 的表现明显优于其他非 Unsloth GGUF，例如参见 `lmstudio-community - Q4_K_M` （尽管小 8GB），以及 `AesSedai - IQ3_S`.

### 官方基准

你可以在下方以表格形式查看更多基准测试：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FHtuBCFNe7qeVG538VVQV%2F97f76950-2c60-4a9b-bb96-228454afabe9.png?alt=media&amp;token=a16edc7e-db1a-4052-aa99-1b516539b896" alt="" width="563"><figcaption></figcaption></figure>

<table data-full-width="true"><thead><tr><th>基准</th><th>MiniMax-M2.5</th><th>MiniMax-M2.1</th><th>Claude Opus 4.5</th><th>Claude Opus 4.6</th><th>Gemini 3 Pro</th><th>GPT-5.2（思考模式）</th></tr></thead><tbody><tr><td>AIME25</td><td>86.3</td><td>83.0</td><td>91.0</td><td>95.6</td><td>96.0</td><td>98.0</td></tr><tr><td>GPQA-D</td><td>85.2</td><td>83.0</td><td>87.0</td><td>90.0</td><td>91.0</td><td>90.0</td></tr><tr><td>SciCode</td><td>44.4</td><td>41.0</td><td>50.0</td><td>52.0</td><td>56.0</td><td>52.0</td></tr><tr><td>IFBench</td><td>70.0</td><td>70.0</td><td>58.0</td><td>53.0</td><td>70.0</td><td>75.0</td></tr><tr><td>AA-LCR</td><td>69.5</td><td>62.0</td><td>74.0</td><td>71.0</td><td>71.0</td><td>73.0</td></tr><tr><td>SWE-Bench 已验证</td><td>80.2</td><td>74.0</td><td>80.9</td><td>80.8</td><td>78.0</td><td>80.0</td></tr><tr><td>SWE-Bench Pro</td><td>55.4</td><td>49.7</td><td>56.9</td><td>55.4</td><td>54.1</td><td>55.6</td></tr><tr><td>Terminal Bench 2</td><td>51.7</td><td>47.9</td><td>53.4</td><td>55.1</td><td>54.0</td><td>54.0</td></tr><tr><td>无工具 HLE</td><td>19.4</td><td>22.2</td><td>28.4</td><td>30.7</td><td>37.2</td><td>31.4</td></tr><tr><td>Multi-SWE-Bench</td><td>51.3</td><td>47.2</td><td>50.0</td><td>50.3</td><td>42.7</td><td>—</td></tr><tr><td>SWE-Bench 多语言</td><td>74.1</td><td>71.9</td><td>77.5</td><td>77.8</td><td>65.0</td><td>72.0</td></tr><tr><td>VIBE-Pro (AVG)</td><td>54.2</td><td>42.4</td><td>55.2</td><td>55.6</td><td>36.9</td><td>—</td></tr><tr><td>BrowseComp（含上下文）</td><td>76.3</td><td>62.0</td><td>67.8</td><td>84.0</td><td>59.2</td><td>65.8</td></tr><tr><td>广泛搜索</td><td>70.3</td><td>63.2</td><td>76.2</td><td>79.4</td><td>57.0</td><td>—</td></tr><tr><td>RISE</td><td>50.2</td><td>34.0</td><td>50.5</td><td>62.5</td><td>36.8</td><td>50.0</td></tr><tr><td>BFCL 多轮</td><td>76.8</td><td>37.4</td><td>68.0</td><td>63.3</td><td>61.0</td><td>—</td></tr><tr><td>τ² Telecom</td><td>97.8</td><td>87.0</td><td>98.2</td><td>99.3</td><td>98.0</td><td>98.7</td></tr><tr><td>MEWC</td><td>74.4</td><td>55.6</td><td>82.1</td><td>89.8</td><td>78.7</td><td>41.3</td></tr><tr><td>GDPval-MM</td><td>59.0</td><td>24.6</td><td>61.1</td><td>73.5</td><td>28.1</td><td>54.5</td></tr><tr><td>金融建模</td><td>21.6</td><td>17.3</td><td>30.1</td><td>33.2</td><td>15.0</td><td>20.0</td></tr></tbody></table>

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FfHyJbhPs4k10iiauD3zo%2F1f5a4e78-1a5c-4263-8a65-36c6fe703041.png?alt=media&amp;token=346519a3-5dee-4ea1-b395-c7de12b6f6cd" alt="" width="563"><figcaption><p>核心编程基准分数</p></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FhJmbCVK6CNZPw2FSJLPT%2F2003295c-001c-4381-af89-8859c197b5a0.png?alt=media&amp;token=aaa9968d-f694-4b1e-b734-086c2cf8988b" alt="" width="563"><figcaption><p>搜索与工具使用</p></figcaption></figure></div>

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FaG1VqXpVwoCWG3RxMWDL%2F91c4825c-1813-4cad-9e36-4b69c6cd0272.png?alt=media&amp;token=ae956a3f-a25e-4ebc-80cb-97733573e654" alt=""><figcaption><p>每 100 个任务完成数</p></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fj2PwoDid8zWRyYnXA6of%2F8c25f392-275d-4730-aa92-e9ea27315d83.png?alt=media&amp;token=a59cf4d3-ff63-4383-90c8-2d089db19b50" alt=""><figcaption><p>办公能力</p></figcaption></figure></div>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/zh/mo-xing/tutorials/minimax-m25.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
