> 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/deepseek-v4.md).

# DeepSeek-V4：如何本地运行

在你自己的设备上本地运行 DeepSeek-V4-Pro-0813 和 DeepSeek-V4-Flash-0731！

DeepSeek-V4、DeepSeek-V4-Flash-Vision-Exp、V4-**Pro-0813**，以及 V4-**Flash-0731** 是新的开放权重模型——Flash 变体拥有 284B 个参数（13B 活跃），而 V4-Pro 拥有 1.6T 个参数（49B 活跃）。 **V4-Pro-0813**，发布于 **8 月 13 日**，性能与 Claude-4.8-Opus 相当，而 **V4-Flash-0731**，发布于 **7 月 31 日**，在同尺寸类别中提供最佳性能，并且 **优于 V4-Pro** （预览版）。专为编程、智能体和聊天工作流打造，具有 **100 万上下文窗口**，本指南展示如何使用 Unsloth Dynamic GGUF 和 [Unsloth Desktop](/docs/zh/desktop.md).

对于 **无损** DeepSeek，请使用 Q8（`UD-Q8_K_XL`），它仅比 **大 7GB** Q4（`UD-Q4_K_XL`）大。该 无损 8 位 GGUF 为 **162 GB** ，而 3 位版本为 **103GB** ，可在一台具有 **110GB RAM** 的设备上运&#x884C;**.** DeepSeek-V4-Flash-0731 在 Terminal Bench 2.1 上得分为 82.7%，在 DeepSWE 上为 54.4%，在 NL2Repo 上为 54.2%。 [DSpark](#dspark-speculative-decoding) 也已为 GGUF 启用，可实现最高 **2 倍更快的解码速度**!

{% hint style="success" %}
**8 月 31 日：** DeepSeek-Flash-Vision-Exp 现已推出！

**8 月 13 日：** DeepSeek-**V4-Pro-0813** 已发布，且 [量化版本现已](https://huggingface.co/unsloth/DeepSeek-V4-Pro-0813-GGUF) 可供运行。
{% endhint %}

{% hint style="success" %}
**8 月 6 日：DSpark 已为 DeepSeek-V4-Flash-0731 启用——实现 1.5 倍至 1.9 倍更快的推理！DSpark 会在** [**Unsloth**](#unsloth-studio-guide)**.**

中自动启用。我们还改进了 [DeepSeek-V4 聊天 jinja 模板](#deepseek-v4-chat-template-improvements)，并测试了超过 4000 段对话，结果与官方基准等效。
{% endhint %}

| [DeepSeek-V4-Pro-0813-GGUF](https://huggingface.co/unsloth/DeepSeek-V4-Pro-0813-GGUF) | [DeepSeek-V4-Flash-**0731**-GGUF](https://huggingface.co/unsloth/DeepSeek-V4-Flash-0731-GGUF) | [DeepSeek-V4-Flash-GGUF](https://huggingface.co/unsloth/DeepSeek-V4-Flash-GGUF) |
| ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |

<a href="/docs/zh/mo-xing/deepseek-v4.md#usage-guide" class="button primary">使用指南</a><a href="/docs/zh/mo-xing/deepseek-v4.md#run-deepseek-v4-flash-tutorials" class="button primary">运行教程</a>

### 📊 量化分析

我们的 `UD-Q8_K_XL` 量化版本完全无损。DeepSeek-V4-Flash 是 [经过量化感知训练的](/docs/zh/bo-ke/quantization-aware-training-qat.md)：官方检查点将其路由专家（模型的 96%）原生存储为 MXFP4，其余部分则存储为 FP8 或 BF16。GGUF 的 MXFP4 正是该格式，因此我们按位重新打包专家，FP8 会反量化为 BF16 而不发生舍入。我们逐一对照官方 DeepSeek 权重检查了每个张量：全部 1,328 个都按位完全一致，并且在推理时保持无损（KL 散度约为 0，最高概率 token 一致率为 100%）。

**非**-Unsloth DeepSeek-V4-Flash GGUF 未通过这些路径转换，因此偏离了官方权重。 `UD-Q4_K_XL` 保留相同的按位精确专家，仅将非专家张量（模型的 4%）量化为 Q8\_0，因此其大小和质量都与 Q8 非常接近。

<div align="left"><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FXjXSVsiH2ZIKlJ7iZPDx%2Fkldddd.webp?alt=media&amp;token=e1db5fca-b2b4-411e-8956-29127ef6bfe0" alt="" width="563"><figcaption></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FHoYuIu6dNNuLrM4nmdbi%2Fpareto.png?alt=media&amp;token=1c7a44bb-13c3-4fc4-8d57-fb350ffe3c14" alt="" width="563"><figcaption></figcaption></figure></div>

相对于官方权重测量，两个 Unsloth 量化版本均处于质量/大小的帕累托前沿。UD-Q8\_K\_XL 是唯一的无损点。UD-Q4\_K\_XL 与其他社区 MXFP4 格式相当，并且比 Q4\_K-experts 转换更精确；后者体积更大，但 KLD 达到 0.029。

<div align="left"><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FxW5lIQID1dIRlVajHSWm%2Fper_layer.png?alt=media&amp;token=94dd4abc-e7ef-4aa8-8d2f-de8c98a69166" alt="" width="563"><figcaption></figcaption></figure></div>

按层划分的误差说明了原因。保留原生 MXFP4 专家意味着每层的权重误差均为 0%。将专家重新量化为 Q4\_K 或 IQ2\_XXS 的转换几乎会舍入每一个权重：Q4\_K 为 5%，IQ2\_XXS 超过 30%。

<div align="left"><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FINDS7DqyP9TUAs4Bj9rS%2Fwhy_lossless.png?alt=media&amp;token=efdb261b-f969-42b8-89ec-bc25e8bbdaf3" alt="" width="563"><figcaption><p>我们的 MXFP4 在全部 840 万个权重上的误差恰好为零，而 Q4_K 是不同的 4 位网格，必须舍入每一个权重（5.2% RMSE）。</p></figcaption></figure></div>

我们还发现，对某些张量使用 Q8\_0 和 F16 并非无损；由于 DeepSeek 应用了 QAT 以使 MXFP4 / FP8 良好工作，情况会更糟，因此我们必须直接将它们保留为 BF16。因此，请使用 UD-Q8\_K\_XL 获得真正无损的量化版本；UD-Q4\_K\_XL 则会将部分 BF16 项降转换为 Q8\_0。

如需查看完整的 [GGUF 基准测试表，请见此处](#gguf-benchmarks).

### :speech\_balloon: DeepSeek V4 聊天模板改进

我们还改进了 DeepSeek-V4 聊天 jinja 模板，并测试了超过 4000 段对话，结果与黄金基准（官方 DS4）等效

我们添加了 `reasoning_effort` ，您可以选择 `max、high` ，就像官方 DeepSeek-V4 一样。我们根据 DS4 在前面添加正确的系统提示词，并遵循 gpt-oss 的风格。

对于工具调用， `reasoning_content` 已为 DS4 保留，但 jinja 聊天模板会将其排除。我们将其重新添加回来。

#### **禁用思考、调整推理强度**

DeepSeek-V4 默认使用推理。它还支持推理强度，其中 `reasoning_effort` 可以为“high”、“max”或禁用。

要禁用思考，请使用 `--chat-template-kwargs '{"enable_thinking":false}'`。如果您使用的是 **Windows** PowerShell，请使用： `--chat-template-kwargs "{\"enable_thinking\":false}"`

您也可以使用 `--reasoning on` 或 `--reasoning off` ，现在 llama.cpp 中也可以使用！

若要自定义推理强度和/或禁用推理，请使用以下示例：

```bash
--chat-template-kwargs '{"reasoning_effort":"max"}'
--chat-template-kwargs '{"reasoning_effort":"high"}'
--chat-template-kwargs '{"enable_thinking":false}'
```

### ⚙️ 使用指南

DeepSeek-V4-Flash 比 DeepSeek-V4-Pro 更小、更快，拥有 **284B** 个参数（13B 活跃），以及一个 **100 万上下文窗口**。该模型有 3 种模式， **非思考**, **思考** **高** 和 **思考** **最高**.&#x20;

建议使用 `UD-IQ3_XXS` ，它是 **103GB** 以获得最佳结果。由于文件大小不包含 KV 缓存和上下文分配，请尽量至少拥有 **110GB RAM** 以运行模型。

该 `UD-Q8_K_XL` 量化版本是保持完整原始精度的 DeepSeek-V4-Flash。其大小为 162GB，最好至少有 169GB 可用 RAM/VRAM。

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

<table><thead><tr><th>格式</th><th width="129.8004150390625">1 位</th><th width="130.85650634765625">2 位</th><th width="140.26702880859375">3 位</th><th>4 位（接近无损）</th><th>Q8_K_XL（无损）</th></tr></thead><tbody><tr><td>标准</td><td>92 GB</td><td>102 GB</td><td>110-135 GB</td><td>162 GB</td><td>169 GB</td></tr><tr><td>DSpark</td><td>102 GB</td><td>112 GB</td><td>120-145 GB</td><td>172 GB</td><td>179 GB</td></tr></tbody></table>

{% hint style="info" %}
**DSpark 比标准版使用更多 VRAM**，因此请预留 **约 10 GB** 额外的 RAM/VRAM 余量。
{% endhint %}

{% hint style="success" %}
为了获得最佳性能，请确保您的总可用内存（包括 VRAM 和系统 RAM）比量化模型文件大小大出足够的余量。
{% endhint %}

### 推荐设置

DeepSeek 推荐以下参数以获得最佳性能： `temperature = 1.0`, `top-p = 1.0`。对于 **DeepSeek-V4-Flash-0731** 和智能体场景， `top-p = 0.95` 建议改用该设置，而 `top-p = 1.0` 则用于其他任务。

**默认启用 Think High。** 若已禁用，您可以通过以下方式启用： `--chat-template-kwargs '{"enable_thinking":true}'` ，或者通过其中的 UI 下拉菜单切换 [Unsloth](#unsloth-studio-guide)。另请参阅 [#deepseek-v4-chat-template-improvements](#deepseek-v4-chat-template-improvements "mention")

{% columns %}
{% column width="50%" %}

| DeepSeek-V4-Flash-0731 |
| ---------------------- |
| `temperature = 1.0`    |
| `top-p = 1.0`          |
| `top-p = 0.95` （仅限智能体） |
| {% endcolumn %}        |

{% column width="50%" %}

| 旧版 DeepSeek-V4-Flash 和 V4-Pro |
| ----------------------------- |
| `temperature = 1.0`           |
| `top-p = 1.0`                 |
| {% endcolumn %}               |
| {% endcolumns %}              |

* **最大上下文窗口：** `1,048,576`
* 对于 Think Max，请将上下文设置为至少 **384K 个 token**.

## 运行 DeepSeek-V4-Flash 教程：

在本教程中，我们将使用 3 位量化版本 `UD-IQ3_XXS`，因为它适合 128GB RAM 的设备。请替换 `UD-IQ3_XXS` 为 `UD-Q8_K_XL` （原始质量）或其他量化版本（如果您的机器有足够内存）。您现在可以在 [Unsloth Desktop](#run-in-unsloth-studio) . **中运行 DeepSeek-V4-Flash-0731。DSpark 会在** [**Unsloth**](#unsloth-studio-guide)**.**

<a href="/docs/zh/mo-xing/deepseek-v4.md#unsloth-studio-guide" class="button primary">🦥 Unsloth 指南</a><a href="/pages/8cefdd6ae681e7680f74c7b6a344fd7c21933ee8#llama.cpp-guide" class="button primary">🦙 Llama.cpp 指南</a><a href="/docs/zh/mo-xing/deepseek-v4.md#dspark-speculative-decoding" class="button secondary">⚡DSpark 指南</a>

### 🦥 Unsloth 指南

DeepSeek-V4-Flash-0731 现可在 [Unsloth](/docs/zh/xin/studio.md)中运行和训练，这是我们面向本地 AI 的新开源 UI。Unsloth Desktop 让您可以在本地运行模型，支持 **MacOS**, **Windows**、Linux 以及：

{% columns %}
{% column %}

* 搜索、下载、 [运行 GGUF](/docs/zh/xin/studio.md#run-models-locally) 和 safetensor 模型
* [**自愈式** 工具调用](/docs/zh/xin/studio.md#execute-code--heal-tool-calling) + **网络搜索**
* [**代码执行**](/docs/zh/xin/studio.md#run-models-locally) （Python、Bash）
* [自动推理](https://unsloth.ai/docs/desktop#feature-deep-dive) 参数调优（temp、top-p 等）
* 通过 llama.cpp 实现快速 CPU + GPU 推理
* [训练 LLM](/docs/zh/xin/studio.md#no-code-training) 速度提高 2 倍，VRAM 减少 70%
  {% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FCwcXvmLERJSUNF6iNTiY%2Fdeepseek-v4-flash-0731-unsloth-studio.png?alt=media&amp;token=6fdc0216-d21e-42e7-bb57-8e1abf6e7f4f" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% stepper %}
{% step %}

#### 安装 Unsloth

最简单的入门方式是下载 [Unsloth Desktop 应用](/docs/zh/desktop.md)。适用于 [macOS](/docs/zh/kai-shi-shi-yong/install/mac.md), [Windows](/docs/zh/kai-shi-shi-yong/install/windows-installation.md)和 [Linux](/docs/zh/kai-shi-shi-yong/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：

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

{% endstep %}

{% step %}

#### 搜索并下载 DeepSeek-V4-Flash

前往 [Unsloth Chat](/docs/zh/xin/studio/chat.md) 或模型中心，在搜索栏中搜索 DeepSeek-V4-Flash，并下载您想要的模型和量化版本。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FGEc90VxPAgTHulQe9zB0%2FScreenshot%202026-07-31%20at%208.01.35%E2%80%AFAM.png?alt=media&amp;token=2931411d-8f75-4bfe-918a-73fcafe918f9" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### 运行 DeepSeek-V4-Flash-0731

使用 Unsloth 时，推理参数应会自动设置，但您仍可手动更改。由于 **默认启用 Think High**，您可以前往右侧下拉菜单，将其切换为非思考或 Think Max。您也可以编辑上下文长度、聊天模板和其他设置。 **中运行 DeepSeek-V4-Flash-0731。DSpark 会在** [**Unsloth**](#unsloth-studio-guide)**.**

如需更多信息，您可以查看我们的 [Unsloth 推理指南](/docs/zh/xin/studio/chat.md).

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FlvJqDRKlWdAVkn3HXJZA%2F1000024247.png?alt=media&amp;token=e84fd31d-7720-40d5-aba1-ba65ac34ce97" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### 使用 Unsloth API 提供 DeepSeek-V4 服务

您可以使用 `unsloth run` 命令，并通过 API 使用 `llama-server` 运行时标志来提供 DeepSeek 服务，包括上下文大小、GPU 层数、线程、采样、网络和工具配置。有关更多信息，请参阅我们的 [API 文档](/docs/zh/ji-chu-zhi-shi/api.md) 或 [unsloth start](/docs/zh/ji-cheng/unsloth-start.md).

```bash
unsloth run --model unsloth/DeepSeek-V4-Flash-0731-GGUF:UD-IQ3_S
```

{% endstep %}

{% step %}

#### Unsloth 现已准备就绪

您还可以通过 Unsloth Desktop 使用 DeepSeek 完成许多其他事项，例如：

* **连接工具：** [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) 于本地
  {% endstep %}
  {% endstepper %}

### 🦙 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 支持。

```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
```

{% endstep %}

{% step %}
您现在可以直接使用 `llama.cpp` 来加载和下载模型，就像 `ollama run`一样。首先，选择您想要的量化类型，例如 `IQ3_XXS`。还可使用 `export LLAMA_CACHE="folder"` 来强制 `llama.cpp` 保存到特定位置。请注意，此下载过程可能非常缓慢，因此最好使用下一节中的手动下载流程。

```bash
export LLAMA_CACHE="unsloth/DeepSeek-V4-Flash-0731-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/DeepSeek-V4-Flash-0731-GGUF:UD-IQ3_S \
    --temp 1.0 \
    --top-p 1.0 \
    --min-p 0.01
```

{% endstep %}

{% step %}
如果您想手动下载模型，可以通过以下代码下载模型（安装 `pip install huggingface_hub`之后）。如果下载卡住，请参阅： [Hugging Face Hub、XET 调试](/docs/zh/ji-chu-zhi-shi/troubleshooting-and-faqs/hugging-face-hub-xet-debugging.md)

```bash
hf download unsloth/DeepSeek-V4-Flash-0731-GGUF \
    --local-dir unsloth/DeepSeek-V4-Flash-0731-GGUF \
    --include "*UD-IQ3_S*" # 4 位版本请使用 "*UD-IQ4_XS*"
```

{% endstep %}

{% step %}
您可以编辑 `--threads 32` 来设置 CPU 线程数， `--ctx-size 32768` 来设置上下文长度， `--n-gpu-layers 2` 来设置要卸载到 GPU 的层数。如果 GPU 内存不足，请尝试调整它。如果仅使用 CPU 推理，也请移除它。

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \
    --model unsloth/DeepSeek-V4-Flash-0731-GGUF/UD-IQ3_S/DeepSeek-V4-Flash-0731-UD-IQ3_S-00001-of-00004.gguf \
    --temp 1.0 \
    --top-p 1.0 \
    --min-p 0.01
```

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

## :zap:DSpark - 推测解码

DeepSeek-V4-Flash-0731 原生支持 DSpark，可实现最高 **2 倍更快的解码速度**！DSpark 是 DeepSeek 的一种新算法，优于朴素 MTP，并在这篇 [论文](https://arxiv.org/abs/2607.05147)中提出。DSpark 使 DeepSeek-V4-Flash 达到 **120 token/秒** ，在 B200 GPU 上相比原始 60 token/秒基准。 **DSpark 会在** [**Unsloth**](#unsloth-studio-guide) **本地 UI 中自动启用。**

Llama.cpp 将 DSpark 集成为 [PR 25784](https://github.com/ggml-org/llama.cpp/pull/25784) 的一部分，并进一步改进了多 GPU 等功能。我们展示使用 `--spec-draft-n-max 3` 作为一个良好的默认值，可实现 1.9 倍更快的推理速度。更大的值似乎反而更慢。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FRV0T1cVPpCnacNnywAsL%2Fimage.png?alt=media&amp;token=b570026f-4577-4a45-936f-98a650d644ac" alt=""><figcaption></figcaption></figure>

请同时下载草稿模型和 GGUF——我们提供了两个 Q8\_0 版本和无损 BF16 版本。请注意，DSpark 将额外需要约 10GB 内存，因此 128GB 的机器需要 IQ3\_XXS 和 Q8\_0

{% code overflow="wrap" %}

```bash
hf download unsloth/DeepSeek-V4-Flash-0731-GGUF \
    --local-dir unsloth/DeepSeek-V4-Flash-0731-GGUF \
    --include "*dspark-DeepSeek-V4-Flash-0731-Q8_0*" \
    --include "*UD-IQ3_XXS*" # 4 位版本请使用 "*UD-IQ4_XS*"
```

{% endcode %}

然后通过 llama-cli 或 llama-server 加载：

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \
    --model unsloth/DeepSeek-V4-Flash-0731-GGUF/UD-IQ3_XXS/DeepSeek-V4-Flash-0731-UD-IQ3_XXS-00001-of-00004.gguf \
    -md unsloth/DeepSeek-V4-Flash-0731-GGUF/dspark-DeepSeek-V4-Flash-0731-Q8_0.gguf \
    --temp 1.0 \
    --top-p 1.0 \
    --min-p 0.01 \
    --spec-type draft-dspark \
    --spec-draft-n-max 3 \
    -ngl 99 -ngld 99
```

{% endcode %}

原始 DSpark 论文中的基准，同时展示其与 MTP 的表现对比：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FNXmTkimQGD9JzAq4OtK9%2Fimage.png?alt=media&amp;token=bab3816c-e3cd-4bd8-a234-6226520f45f6" alt=""><figcaption></figcaption></figure>

## 📊 基准

### GGUF 基准

见下方表格，对比 Unsloth 和其他提供方的量化版本基准。参考值 = 官方权重。基于 wikitext-2，在 ctx 512、4x B200 上计算困惑度和 KL 散度。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FXjXSVsiH2ZIKlJ7iZPDx%2Fkldddd.webp?alt=media&amp;token=e1db5fca-b2b4-411e-8956-29127ef6bfe0" alt="" width="563"><figcaption></figcaption></figure>

| 量化                                | 大小（GB） | PPL    | 平均 KLD      | RMS delta-p | 相同的 top token | 位级完全一致的权重    |
| --------------------------------- | ------ | ------ | ----------- | ----------- | ------------- | ------------ |
| 官方（参考）                            | 156.4  | 4.5319 | 0           | 0%          | 100%          | 100%         |
| **Unsloth UD-Q8\_K\_XL**          | 161.9  | 4.5319 | **约 0（无损）** | 0.000%      | 100.000%      | **100.000%** |
| **Unsloth UD-Q4\_K\_XL**          | 155.1  | 4.5335 | 0.0102      | 3.40%       | 96.28%        | 97.46%       |
| bartowski MXFP4                   | 156.0  | 4.5351 | 0.0105      | 3.42%       | 96.18%        | 97.57%       |
| antirez Q4KExperts-F16（imatrix）   | 164.6  | 4.5743 | 0.0291      | 5.87%       | 93.95%        | 0.51%        |
| antirez Q4KExperts-F16            | 164.6  | 4.5726 | 0.0290      | 5.89%       | 93.94%        | 0.93%        |
| antirez mixed L37-42-Q4K（imatrix） | 97.6   | 5.8169 | 0.3605      | 21.15%      | 79.74%        | 0.41%        |
| antirez IQ2XXS（imatrix）           | 86.7   | 6.0808 | 0.4079      | 22.23%      | 78.15%        | 0.39%        |
| antirez IQ2XXS                    | 86.7   | 6.1518 | 0.4207      | 22.74%      | 77.92%        | 0.47%        |

### 官方基准

尽管使用的激活参数少得多，DeepSeek-V4-Flash-0731 在下方基准上优于 DeepSeek-V4-Pro（预览版），并且仍然能与领先的专有模型保持竞争力。

| 基准                     | DeepSeek-V4-Flash-0731 | DeepSeek-V4-Flash（预览版） | DeepSeek-V4-Pro（预览版） | GLM-5.2 | Opus-4.8 |
| ---------------------- | :--------------------: | :--------------------: | :------------------: | :-----: | :------: |
| Terminal Bench 2.1     |          82.7          |          61.8          |         72.1         |   81.0  |   85.0   |
| NL2Repo                |          54.2          |          39.4          |         38.5         |   48.9  |   69.7   |
| Cybergym               |          76.7          |          38.7          |         52.7         |    -    |   83.1   |
| DeepSWE                |          54.4          |           7.3          |         12.8         |   46.2  |   58.0   |
| Toolathlon-Verified    |          70.3          |          49.7          |         55.9         |   59.9  |   76.2   |
| Agents' Last Exam      |          25.2          |          15.8          |         16.5         |   23.8  |   25.7   |
| AutomationBench Public |          25.1          |          10.8          |         12.8         |   12.9  |   27.2   |
| DSBench-FullStack †    |          68.7          |          37.0          |         41.8         |   61.8  |   71.6   |
| DSBench-Hard †         |          59.6          |          25.8          |         31.1         |   54.5  |   71.7   |


---

# 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://unsloth.ai/docs/zh/mo-xing/deepseek-v4.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.
