> 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 和本地运行 DeepSeek-V4-Flash-0731 [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** 设备&#x4E0A;**.** 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，top-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 位网格，必须对每个权重进行舍入（RMSE 为 5.2%）。</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 cache 和上下文分配，请尽量至少拥有 **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-bit</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 tokens**.

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

在本教程中，我们将使用 3 位量化版本 `UD-IQ3_XXS`，因为它可以运行在 128GB RAM 设备上。将 `UD-IQ3_XXS` 替换为 `UD-Q8_K_XL` （原始质量）或其他量化版本，如果你的机器有足够内存。现在你可以在 DeepSeek-V4-Flash-0731 中运行 [Unsloth Desktop](#run-in-unsloth-studio) . **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 的新开源界面中运行和训练。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) 参数调优（温度、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/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：

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

{% endstep %}

{% step %}

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

前往 [Unsloth Chat](/docs/zh/xin/studio/chat.md) 或 Model hub，并在搜索栏中搜索 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 默认开启**，你可以在右侧下拉菜单中将其切换为 Non-think 或 Think Max。你也可以编辑上下文长度、聊天模板以及其他设置。 **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 提供 DeepSeek 服务： `llama-server` 运行时标志，包括上下文大小、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 tokens/s** 在 B200 GPU 上，相比原始 60 tokens/s 基线。 **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>

下载 drafter 和 GGUF 两者——我们制作了 2 个 Q8\_0 版本和 1 个无损 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 和其他提供方的量化版本基准。参考 = 官方权重。在 4x B200 上、ctx 512、wikitext-2 的困惑度和 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 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/deepseek-v4.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.
