> 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/mistral-large-4.md).

# Mistral Large 4（Le Chonk）：本地运行

使用 Unsloth 和 llama.cpp 在本地运行 Mistral Large 4 GGUF 的指南。

Mistral Large 4（Le Chonk）是 Mistral 的 **1 万亿参数** MoE 模型，拥有 **520 亿活跃参数** （包括嵌入层和输出层）。Mistral Large 4 是 **迄今最强的西方开源** 模型，支持文本和图像输入，拥有 **100 万上下文** 窗口、160+ 种语言以及推理能力。你可以通过 Unsloth 或 llama.cpp 使用 Unsloth Dynamic GGUFs 在本地运行 Le Chonk。GGUF： [Mistral-Large-4-1T-A52B-GGUF](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF)

动态 1bit 保留 **91% 的 top-1 准确率** ，覆盖编程、智能体任务、数学和其他领域，同时体积缩小 80%（**223GB** 对比 **1.1TB** FP8）。动态 2bit 保留 95% 的 top-1 准确率，同时体积缩小 66%（378GB）。感谢 Mistral 在首日提供访问权限。

<a href="/docs/zh/mo-xing/mistral-large-4.md#run-mistral-large-4-tutorials" class="button primary">运行 Mistral Large 4 教程</a><a href="/docs/zh/mo-xing/mistral-large-4.md#quantization-analysis" class="button secondary">量化分析</a>

### **⚙️ 使用指南**

最小的动态 1-bit 量化， `UD-IQ1_S`，大约使用 **233GB** 磁盘空间，应可装入 256GB RAM，包括 Mac Studio 或 2 台 NVIDIA DGX Spark。

**表：硬件需求** （单位 = 总内存：RAM + VRAM，或统一内存）

| 1-bit     | 2-bit     | 3-bit     | 4-bit | 8-bit |
| --------- | --------- | --------- | ----- | ----- |
| 256–270GB | 310–390GB | 435–500GB | 630GB | 1.2TB |

为了获得最佳性能，你可用的总 **RAM + VRAM**，或统一内存，应大于量化文件大小，并为操作系统、KV 缓存和运行时缓冲区留出空间。更长的上下文需要更多内存。

#### 推荐设置

Mistral 对所有推理场景都推荐相同的采样设置：

| 温度    | Top-p  |
| ----- | ------ |
| `1.0` | `0.95` |

* 推理努力 = 低、中、高
* 最大 **上下文窗口** 为 `1,048,576` 个 token。

我们还为所有量化版本运行了 KLD 基准测试——更多细节见 [#quantization-analysis](#quantization-analysis "mention")

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FAtJWJHFOCP7cu7IQKiGt%2Fsize_vs_top1_unsloth.png?alt=media&amp;token=27d694b8-db6f-4661-a8c8-c354823ca2c6" alt="" width="563"><figcaption></figcaption></figure>

## 运行 Mistral Large 4 教程：

下面的示例使用 [`UD-Q2_K_XL`](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-Q2_K_XL) 进行文本推理。你可以将量化类型更改为 [GGUF 仓库](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF).

### 🦥 在 Unsloth 中运行 Mistral Large 4

[Unsloth Desktop](https://unsloth.ai/docs/desktop) 在本地运行 GGUF，支持 **macOS、Windows 和 Linux**，可自动卸载到 RAM，并检测多 GPU 设置。

{% stepper %}
{% step %}

#### 安装 Unsloth

最简单的开始方式是下载 [Unsloth Desktop 应用](/docs/zh/desktop.md)。适用于 [macOS](/docs/zh/kuai-su-kai-shi/install/mac.md), [Windows](/docs/zh/kuai-su-kai-shi/install/windows-installation.md)，以及 [Linux](/docs/zh/kuai-su-kai-shi/install/linux.md).

<a href="https://unsloth.ai/download" class="button primary" data-icon="down-to-bracket">下载 Unsloth</a>

* <i class="fa-apple">:apple:</i> [下载 macOS 版本](https://unsloth.ai/download/mac)
* <i class="fa-windows">:windows:</i> [下载 Windows 版本](https://unsloth.ai/download/windows)
* <i class="fa-linux">:linux:</i> [下载 Linux 版本](https://unsloth.ai/download/linux)

或者，如果你更喜欢手动安装：

**MacOS、Linux、WSL：**

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

**Windows PowerShell：**

```powershell
irm https://unsloth.ai/install.ps1 | iex
```

{% endstep %}

{% step %}

#### 搜索并下载 Mistral Large 4

前往 [Unsloth Chat](https://unsloth.ai/docs/new/studio/chat) 或 Model hub，搜索 **Mistral-Large-4-1T-A52B** 并选择 [unsloth/Mistral-Large-4-1T-A52B-GGUF](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF)。使用上面的大小和内存需求下载你想要的量化版本。
{% endstep %}

{% step %}

#### 运行 Mistral Large 4

Mistral Large 4 默认使用 `高` 推理努力。使用 `低` 用于快速聊天， `中` 用于日常任务，或使用 `高` 用于复杂提示词和智能体编程。Unsloth 会自动为你选择最佳配置，但你仍然可以手动调整。

更多信息请查看我们的 [Unsloth 推理指南](/docs/zh/xin/studio/chat.md).
{% endstep %}

{% step %}

#### 使用 Unsloth API 提供 Mistral Large 4 服务

你可以使用 `unsloth run` 命令，通过 API 提供 Mistral Large 4 服务，使用 `llama-server` 运行时标志，包括上下文大小、GPU 层数、线程和采样。更多信息见我们的 [API 文档](https://unsloth.ai/docs/basics/api) 或 [unsloth start](https://unsloth.ai/docs/integrations/unsloth-start).

{% code overflow="wrap" %}

```bash
unsloth run --model unsloth/Mistral-Large-4-1T-A52B-GGUF:UD-Q2_K_XL \
    --temp 1.0 \
    --top-p 0.95 \
    --top-k 0 \
    --min-p 0.0 \
    --chat-template-kwargs '{"reasoning_effort":"high"}'
```

{% endcode %}

请使用支持 Mistral Large 4 的运行时。
{% endstep %}

{% step %}

#### Unsloth 已就绪

你可以通过 Unsloth Desktop 将 Mistral Large 4 连接到你的工具。Unsloth 还支持以下工作流：

* **连接工具：** [Claude Code](/docs/zh/ji-chu-zhi-shi/claude-code.md), [Codex](/docs/zh/ji-chu-zhi-shi/codex.md), [网页搜索](/docs/zh/xin/studio/chat.md#advanced-web-search), [MCP](/docs/zh/ji-chu-zhi-shi/mcp.md) 等等
* **训练模型：** 微调其他受支持的文本、扩散、 [嵌入](/docs/zh/ji-chu-zhi-shi/embedding-finetuning.md)等模型
* **生成媒体：** 创建并训练 [图像](/docs/zh/ji-chu-zhi-shi/diffusion-image.md)、视频、 [TTS](/docs/zh/ji-chu-zhi-shi/text-to-speech-tts-fine-tuning.md) 本地

<div align="center"><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FYShiiub5gs5pCQLX6d4U%2FScreenshot%202026-08-15%20at%2012.18.24%E2%80%AFAM.png?alt=media&amp;token=d6996797-a144-4113-b4c3-155cca6c39a0" alt="Unsloth Desktop Agents settings interface example" width="563"><figcaption><p>Unsloth Desktop 的 Agents 设置（界面示例）。连接工具时，选择 Mistral Large 4 和你下载的量化版本。</p></figcaption></figure></div>
{% endstep %}
{% endstepper %}

### 量化分析

我们在工具调用、编程和长链智能体轨迹等多个领域运行了 KLD 和 top-1% 基准测试，结果表明 Unsloth 动态量化（UD3）在显著缩小模型体积的同时，仍能保留大量准确率。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F57miJQhlcpxXmZ1XuYc1%2Fsize_vs_top1_per_axis.png?alt=media&amp;token=6e121fc8-6f9a-43df-bea8-d317cbe5448e" alt=""><figcaption></figcaption></figure>

我们还运行了 KLD，并按语料库分别提供如下结果：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FeclA1iBNKp9D2Gk2TzyL%2Fsize_vs_kld_per_axis.png?alt=media&amp;token=88cfa583-370a-4e1b-bf44-e9b797df8a9d" alt=""><figcaption></figcaption></figure>

| 量化版本                                                                                             | 大小      | 平均 KLD（7 类） | Top-1 一致率 |
| ------------------------------------------------------------------------------------------------ | ------- | ----------- | --------- |
| [UD-IQ1\_S](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-IQ1_S)      | 233 GB  | 0.1263      | 90.6%     |
| [UD-IQ1\_M](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-IQ1_M)      | 260 GB  | 0.0919      | 92.3%     |
| [UD-IQ2\_XXS](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-IQ2_XXS)  | 302 GB  | 0.0566      | 93.9%     |
| [UD-Q2\_K\_XL](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-Q2_K_XL) | 378 GB  | 0.0298      | 95.6%     |
| [UD-IQ3\_XXS](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-IQ3_XXS)  | 424 GB  | 0.0217      | 96.2%     |
| [UD-Q3\_K\_XL](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-Q3_K_XL) | 493 GB  | 0.0162      | 96.6%     |
| [UD-Q4\_K\_XL](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-Q4_K_XL) | 605 GB  | 0.0071      | 97.8%     |
| [UD-Q5\_K\_XL](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-Q5_K_XL) | 784 GB  | 0.0038      | 98.5%     |
| [UD-Q6\_K\_XL](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-Q6_K_XL) | 890 GB  | 0.0032      | 98.6%     |
| [UD-Q8\_K\_XL](https://huggingface.co/unsloth/Mistral-Large-4-1T-A52B-GGUF/tree/main/UD-Q8_K_XL) | 1115 GB |             |           |

### 🦙 在 llama.cpp 中运行 Mistral Large 4

使用带有 **Mistral Large 4 支持**的 llama.cpp 构建版本。下面的命令使用 `UD-Q2_K_XL` 量化版本（大约 **378GB**).

{% stepper %}
{% step %}

#### 安装 llama.cpp

获取 [GitHub 上的 llama.cpp](https://github.com/ggml-org/llama.cpp)，或按下方构建。在带有 NVIDIA GPU 的 Linux 上，先安装 CUDA 工具包和构建依赖：

```bash
sudo apt-get update
sudo apt-get install -y build-essential cmake curl libcurl4-openssl-dev
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 --target llama-cli llama-server
```

对于 **CPU 或 Apple Metal**，使用 `-DGGML_CUDA=OFF`。macOS 默认启用 Metal 支持。对于 Windows 和其他 GPU 后端，请遵循仓库中的构建说明。
{% endstep %}

{% step %}

#### 下载并运行 Mistral Large 4

此命令会下载量化版本并启动本地聊天服务器：

```bash
./llama.cpp/build/bin/llama-server \
    -hf unsloth/Mistral-Large-4-1T-A52B-GGUF:UD-Q2_K_XL \
    --ctx-size 32768 \
    --temp 1.0 \
    --top-p 0.95 \
    --top-k 0 \
    --min-p 0.0 \
    --chat-template-kwargs '{"reasoning_effort":"high"}' \
    --host 127.0.0.1 --port 8080
```

打开 [http://127.0.0.1:8080](http://127.0.0.1:8080/) 在浏览器中开始聊天。API 位于 `http://127.0.0.1:8080/v1`.

示例使用了 **32K 上下文** 以限制 KV 缓存内存。 `--top-k 0` 和 `--min-p 0.0` 会禁用额外的采样过滤器，从而使推荐的 temperature 和 top-p 设置生效。如果内存不足，请降低 `--ctx-size` 或选择更小的量化版本。
{% endstep %}

{% step %}

#### 可选：手动下载

安装 Hugging Face CLI，并只下载你想要的量化版本：

```bash
pip install -U huggingface_hub
hf download unsloth/Mistral-Large-4-1T-A52B-GGUF \
    --local-dir unsloth/Mistral-Large-4-1T-A52B-GGUF \
    --include "UD-Q2_K_XL/*"
```

保留 **全部 9 个分片** 在同一目录中。在上面的服务器命令里，将 `-hf unsloth/Mistral-Large-4-1T-A52B-GGUF:UD-Q2_K_XL` 替换为：

```bash
--model unsloth/Mistral-Large-4-1T-A52B-GGUF/UD-Q2_K_XL/Mistral-Large-4-1T-A52B-UD-Q2_K_XL-00001-of-00009.gguf
```

llama.cpp 会自动加载其余分片。若要使用动态 1-bit，请下载 `UD-IQ1_S/*` 并将 `--model` 指向 `Mistral-Large-4-1T-A52B-UD-IQ1_S-00001-of-00006.gguf` 在该文件夹中。
{% endstep %}
{% endstepper %}

### 基准测试

更多基准测试列在 Mistral 的 [官方博客](https://mistral.ai/news/mistral-large-4-oss/).

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FrTfj0eor2jVXeH9huZQf%2Fartificial-analysis-coding-agent-index-terminal-bench-4-0.png?alt=media&amp;token=a08947b8-0048-4c41-bc9d-1e5f3daed76f" alt=""><figcaption></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FQSsBf7oTXp1DgRkktb3a%2Fartificial-analysis-cyber-index.png?alt=media&amp;token=1d81038d-082e-4784-93d4-24ebfdcb8eea" alt=""><figcaption></figcaption></figure></div>

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FvL6PLiJRKH6fuE5PIkY8%2Fweb-browsing-browsecomp.png?alt=media&amp;token=df26f6fa-e8ad-42f1-b29f-8284e9b27323" alt=""><figcaption></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FwlEZNXmsndI26kr6zLZP%2Fartificial-analysis-coding-agent-index-vs-token-efficiency.png?alt=media&amp;token=ec0e687d-1165-4602-8e5d-b5ccb395eb85" alt=""><figcaption></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/mistral-large-4.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.
