> 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/qwen3.8.md).

# Qwen3.8：如何在本地运行

在本地环境中运行包括 Qwen3.8-27B 在内的 Qwen3.8 量化模型指南。

Qwen3.8 是 Qwen 的新模型家族，包含 Qwen3.8-**27B**，Qwen3.8-**2.4T-A95B** 以及 Qwen3.8-**Max**。Qwen3.8-27B 具备 **视觉** 和推理能力，拥有 **256K 上下文** 窗口，并可在以下配置上本地运行： **17GB RAM/VRAM** 。Qwen3.8 在代理式编码、视觉和聊天任务方面表现出色，现在还可通过 Unsloth GGUF、NVFP4 和 [Unsloth Desktop](#run-qwen3.8-in-unsloth-desktop)运行。Qwen3.8-2.4T-A95B 是一个 2.4T 参数（激活 95B）的模型，可与 GPT-5.6 Sol 相媲美。

**8 月 19 日更新：** Qwen3.8-27B GGUF 现在使用 [Unsloth Dynamic V3.0](/docs/zh/ji-chu/dynamic-3.0-ggufs.md) ，在相同大小下精度提高 10%，整体上显著优于其他方案。

{% columns %}
{% column %} <a href="/pages/d03b47babbad2abc249a0979b2d44af1f02bbd20#run-qwen3.8-guide" class="button primary">运行 Qwen3.8 指南</a><a href="https://unsloth.ai/download" class="button primary">下载 Unsloth</a>

感谢 Qwen 在首发日提供访问权限。Unsloth 量化还包括：

* **开发者角色支持** 适用于 Codex 等代理工具
* [启用 MTP](/docs/zh/mo-xing/mtp.md) 用于快速推理
* **工具调用：** 改进了嵌套对象解析，使工具更容易成功

完整精度的 Qwen3.8-2.4T-A95B 需要 4.9TB 存储和 1-bit [Unsloth](https://github.com/unslothai/unsloth) Dynamic GGUF 需要 **397GB（小 91%）**，更大的 IQ1\_S 需要 508GB。
{% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F6aw6IjO7lnYJhSyzXYwq%2Fvolcano%20qwen.gif?alt=media&amp;token=94e56117-d10d-45e8-82dc-3e134b2b9359" alt=""><figcaption><p>Unsloth Desktop 中的动态 4-bit Qwen3.8-27B</p></figcaption></figure>

Unsloth 量化：

* [Qwen3.8-**27B**-GGUF](https://huggingface.co/unsloth/Qwen3.8-27B-GGUF)
* [Qwen3.8-27B-**NVFP4**](https://huggingface.co/unsloth/Qwen3.8-27B-NVFP4)
  {% endcolumn %}
  {% endcolumns %}

### :gear: 使用指南

#### Qwen3.8-27B 需求：

Qwen3.8-**27B** 4-bit 量化可在 16-19GB VRAM 上运行，例如 RTX 5080、4090，或带 24GB RAM 的 Mac。\
**表：硬件需求** （单位 = 总内存：RAM + VRAM，或统一内存）

<table><thead><tr><th>1-bit</th><th>2-bit</th><th>3-bit</th><th>4-bit</th><th width="128">6-bit</th><th>8-bit</th><th>BF16</th></tr></thead><tbody><tr><td>7-8 GB</td><td>9-11 GB</td><td>12-14 GB</td><td>16-19 GB</td><td>23-26 GB</td><td>31 GB</td><td>56 GB</td></tr></tbody></table>

{% hint style="info" %}
如果你想使用 [MTP](/docs/zh/mo-xing/mtp.md) 以获得更快推理，请准备额外 1-2GB 的余量。
{% endhint %}

#### Qwen3.8-**2.4T** 需求：

* [Qwen3.8-**2.4T-A95B**-GGUF](https://huggingface.co/unsloth/Qwen3.8-2.4T-A95B-GGUF)

| 动态 1-bit XXXS | 动态 1-bit 标准版 | 动态 2-bit | Q8\_0  | BF16（无损） |
| ------------- | ------------ | -------- | ------ | -------- |
| 397GB         | 508GB        | 657 GB   | 2.6 TB | 4.9 TB   |

### 推荐设置

#### Qwen3.8-**27B 设置：**

Qwen3.8-27B 是一个 **混合思考** 模型，在思考和非思考模式下有不同的默认设置。默认启用 Extra high，因此如果你想要更短的思考轨迹，可以 [调整思考力度](#thinking--preserve-thinking):

| 参数                   | 思考模式 | 指令（非思考）模式 |
| -------------------- | ---- | --------- |
| `temperature`        | 1.0  | 0.7       |
| `top_p`              | 0.95 | 0.80      |
| `top_k`              | 20   | 20        |
| `min_p`              | 0.0  | 0.0       |
| `presence_penalty`   | 0.0  | 1.5       |
| `repetition_penalty` | 1.0  | 1.0       |

* **最大上下文窗口：** `262,144` （可通过 YaRN 扩展到 1M）
* 思考模式： `temperature=1.0`, `top_p=0.95`, `top_k=20`, `min_p=0.0`, `presence_penalty=0.0`, `repetition_penalty=1.0`
* 指令（或非思考）模式： `temperature=0.7`, `top_p=0.80`, `top_k=20`, `min_p=0.0`, `presence_penalty=1.5`, `repetition_penalty=1.0`

#### Qwen3.8-**2.4T 设置：**

Qwen3.8-2.4T 是 **仅思考**，而 Qwen3.8-Max 是混合型。

| 默认                      |
| ----------------------- |
| temperature = 1.0       |
| top\_p = 0.95           |
| top\_k = 20             |
| min\_p = 0.0            |
| presence\_penalty = 0.0 |

* 上下文长度 = 最多 `1,010,000`
* `temperature=1.0`, `top_p=0.95`, `top_k=20`, `min_p=0.0`, `presence_penalty=0.0`, `repetition_penalty=1.0`

如果模型能放得下，在使用 B200 时，你会得到约 20 tokens/s 的生成速度以及 >120 tokens/s 的吞吐量。最经验性的规则：RAM+VRAM ≈ 量化大小；否则它仍然可以运行，只是由于磁盘卸载会慢很多。

### 💡 思考 + 保留思考

{% columns %}
{% column %}
Qwen3.8 具有 **保留思考** ，它会保留上一轮对话中的思考轨迹。这会增加你使用的 token 数量，但在持续对话中可能提高准确性。 [Unsloth](#run-qwen3.8-in-unsloth-desktop) 为 Qwen3.8 提供了“Think”和“保留思考”切换开关（见右侧）：
{% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FLdgmjRrb5qhpbY9PwYe8%2FScreenshot%202026-08-14%20at%2011.26.15%E2%80%AFAM.png?alt=media&amp;token=6333f5ca-196d-46ae-9efd-2e522014e6db" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

Qwen3.8-27B 支持 `reasoning_effort`，可用于调整推理深度并控制成本。这些切换在 Unsloth 中会自动启用：

* `xhigh` （默认）：适用于需要深入分析的复杂任务
* `medium`：在准确性和速度之间取得平衡
* `low`：高效推理，偏向速度和成本优化
* none

{% hint style="warning" %}
要更改[ 思考 / 推理](#how-to-enable-or-disable-reasoning-and-thinking) 力度，在 `unsloth run` 或 `llama-server`中，使用 `--chat-template-kwargs '{"reasoning_effort":"medium"}'`

如果你使用的是 **Windows** PowerShell，请使用： `--chat-template-kwargs "{\"reasoning_effort\":\"medium\"}"`

将 `medium` 更改为你期望的推理级别。
{% endhint %}

## 运行 Qwen3.8 指南

你现在可以在 llama.cpp 和 Unsloth Desktop 中运行 Qwen3.8。对于大型 Qwen3.8-2.T 模型，我们将使用 397GB `IQ1_XXXS` 量化（名为 Q1\_0），以在可访问性和准确性方面获得最佳结果，并且至少需要 450GB RAM。欢迎更改量化类型。

* Hugging Face： [Qwen3.8-27B-**GGUF**](https://huggingface.co/unsloth/Qwen3.8-27B-GGUF) • [Qwen3.8-27B-**NVFP4**](https://huggingface.co/unsloth/Qwen3.8-27B-NVFP4)
* ModelScope： [Qwen3.8-27B-**GGUF**](https://www.modelscope.cn/models/unsloth/Qwen3.8-27B-GGUF) • [Qwen3.8-27B-**NVFP4**](https://www.modelscope.cn/models/unsloth/Qwen3.8-27B-NVFP4)
* **2.4T-A95B：** [Qwen3.8-**2.4T-A95B**-GGUF](https://huggingface.co/unsloth/Qwen3.8-2.4T-A95B-GGUF)

<a href="/pages/d03b47babbad2abc249a0979b2d44af1f02bbd20#run-qwen3.8-in-unsloth-desktop" class="button primary">在 Unsloth Desktop 中运行</a><a href="/pages/d03b47babbad2abc249a0979b2d44af1f02bbd20#run-qwen3.8-in-llama.cpp" class="button secondary">在 llama.cpp 中运行</a><a href="/pages/d03b47babbad2abc249a0979b2d44af1f02bbd20#run-qwen3.8-in-llama.cpp" class="button secondary">NVFP4 指南</a>

### 🦥 在 Unsloth Desktop 中运行 Qwen3.8

Qwen3.8 可以运行在 [Unsloth Desktop](#run-qwen3.8-in-unsloth-desktop)，这是一个用于本地 AI 的开源 UI 应用。 **Unsloth 会自动卸载到 RAM 并检测多 GPU 配置**。使用 Unsloth Desktop，你可以在本地运行模型于 **MacOS、Windows**、Linux 和：

{% columns %}
{% column %}

* 搜索、下载、 [运行 GGUF](/docs/zh/xin/studio.md#run-models-locally)、MLX 和 safetensor 模型
* [**自我修复** 工具调用](/docs/zh/xin/studio/chat.md#auto-healing-tool-calling) + **网页搜索**
* [**代码执行**](/docs/zh/desktop.md#code-execution) （Python、Bash）
* [自动推理](https://unsloth.ai/docs/desktop#feature-deep-dive) 参数调优（temp、top-p 等）
* 通过 MLX 和 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%2F6IXaXdTVyvbrnjehlxys%2Fkimik3.gif?alt=media&amp;token=31e1213b-d7da-46e9-bc7f-3a8c402513fc" 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 %}

#### 搜索并下载 Qwen3.8

前往 [Unsloth Chat](/docs/zh/xin/studio/chat.md) 或 Model hub，在搜索栏中搜索 Qwen3.8，并下载你想要的模型和量化。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fo53hIyoFypinWWLa1c0x%2FScreenshot%202026-08-14%20at%2012.42.38%E2%80%AFPM.png?alt=media&amp;token=a69de985-56ee-4ef3-8e10-f669cc168346" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### 运行 Qwen3.8

使用 Unsloth 时，推理参数应会自动设置，不过你仍然可以手动更改。你也可以编辑上下文长度、聊天模板和其他设置。

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

例如，使用带有 397GB Qwen3.8（小 91%）的 Unsloth Desktop，可让你切换思考模式、启用内联画布、网页搜索和代码执行等等。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fb3IiYJzHzsp2698xTim4%2Fgiffyy%20gf.gif?alt=media&amp;token=f1bda1a1-b81f-43e2-ba10-dbdc9a29c0c0" alt="" width="563"><figcaption><p>Unsloth Desktop 中的 Qwen3.8 2.4T 动态 1-bit 397GB、缩小 91% 的 GGUF</p></figcaption></figure>
{% endstep %}

{% step %}

#### 通过 Unsloth API 提供 Qwen3.8 服务

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

{% code overflow="wrap" %}

```bash
unsloth run --model unsloth/qwen3.8-27B-GGUF:UD-Q4_K_XL
    --temp 1.0 \\
    --top-p 0.95 \\
    --top-k 20 \\
    --min-p 0.0 \\
    --reasoning-effort medium
```

{% endcode %}
{% endstep %}

{% step %}

#### Unsloth 现已准备就绪

你还可以通过 Unsloth Desktop 用 Qwen3.8 做很多其他事情，例如：

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

<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=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### Qwen3.8-2.4T-A95B 新的 1-bit 数据类型

我们通过减少代码本中的条目数量，将 llama.cpp 中的 IQ1\_S 从每个权重 1.5625 bit 扩展到 1.1875 bpw——我们发现这对大型模型效果很好，并且仍能保留大量准确性——我们还发现这些新的数据类型适用于训练后量化（PTQ），无需 QAT 或 QAD（量化感知训练 / 蒸馏）。 [Qwen3.8-**2.4T-A95B**-GGUF](https://huggingface.co/unsloth/Qwen3.8-2.4T-A95B-GGUF)

由于命名问题，我们使用了 TQ2\_0、TQ1\_0 和 Q1\_0，否则它不会显示在 HF 仓库中。

<table><thead><tr><th>数据类型</th><th width="147.60000610351562">命名</th><th width="114.39996337890625" align="right">BPW</th><th width="106.20001220703125" align="right"># 条目</th><th width="113.413330078125" align="right">索引位</th><th width="106.4000244140625" align="right">块</th></tr></thead><tbody><tr><td>IQ1_S</td><td>IQ1_S</td><td align="right"><strong>1.5625</strong></td><td align="right">2048</td><td align="right">11</td><td align="right">50 B</td></tr><tr><td>UD-IQ1_XS</td><td>TQ2_0</td><td align="right">1.4375</td><td align="right">1024</td><td align="right">10</td><td align="right">46 B</td></tr><tr><td>UD-IQ1_XXS</td><td>TQ1_0</td><td align="right">1.3125</td><td align="right">512</td><td align="right">9</td><td align="right">42 B</td></tr><tr><td>UD-IQ1_XXXS</td><td>Q1_0</td><td align="right"><strong>1.1875</strong></td><td align="right">256</td><td align="right">8</td><td align="right">38 B</td></tr></tbody></table>

我们仍在对这些新数据类型进行基准测试，但对于其他大型模型，我们得到了 **无需任何 QAT / QAD 也能获得良好结果**:

| 数据类型         |     GiB |      PPL |      KLD |  top-p |
| ------------ | ------: | -------: | -------: | -----: |
| IQ1\_S       | 553.204 | 2.578876 | 0.564553 | 78.882 |
| UD-IQ1\_XS   | 513.583 | 2.931261 | 0.690161 | 75.726 |
| UD-IQ1\_XXS  | 473.961 | 3.540383 | 0.876007 | 71.284 |
| UD-IQ1\_XXXS | 434.340 | 4.488796 | 1.109944 | 66.257 |

### :llama: 在 llama.cpp 中运行 Qwen3.8

{% stepper %}
{% step %}
我们需要使用特定的 IQ1\_XXXS 分支 [这里](https://github.com/unslothai/llama.cpp/pull/61)。你也可以按照下面的构建说明进行操作。将 `-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 --branch iq1-narrow https://github.com/unslothai/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 %}
如果你只想运行标准的 `IQ1_S` 以及其他量化版本，那么请正常编译 llama.cpp：

{% 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 %}
通过以下方式下载模型（在安装后 `pip install huggingface_hub`）。你可以选择 `Q1_0` 用于 `IQ1_XXXS` 或其他量化版本，例如 `Q8_0` 。如果下载卡住，请参见： [Hugging Face Hub、XET 调试](/docs/zh/ji-chu/troubleshooting-and-faqs/hugging-face-hub-xet-debugging.md)

**Qwen3.8-27B：**

```bash
pip install -U "huggingface_hub[cli]"
hf download unsloth/Qwen3.8-27B-GGUF \\
    --local-dir unsloth/Qwen3.8-27B-GGUF \\
    --include "*UD-Q4_K_XL*" # 3-bit 使用 "*UD-Q3_K_XL*"
```

**Qwen3.8-2.4T：**

```bash
pip install -U "huggingface_hub[cli]"
hf download unsloth/Qwen3.8-2.4T-A95B-GGUF \\
    --local-dir unsloth/Qwen3.8-2.4T-A95B-GGUF \\
    --include "*Q1_0*" # 2-bit 使用 "*IQ2_XXS*"
```

{% endstep %}

{% step %}
要在 llama-cli 中运行模型，请按照下面的代码片段操作：\
记得 [更改设置](#recommended-settings) 以适配你的使用场景。

**Qwen3.8-27B：**

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \\
    --model unsloth/Qwen3.8-27B-GGUF/Qwen3.8-27B-UD-Q4_K_XL.gguf \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --top-k 20 \\
    --min-p 0.0
```

{% endcode %}

**Qwen3.8-2.4T：**

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \\
    --model unsloth/Qwen3.8-2.4T-A95B-GGUF/UD-Q1_0/Qwen3.8-2.4T-A95B-UD-Q1_0-00001-of-00010.gguf \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --top-k 20 \\
    --min-p 0.0
```

{% endcode %}
{% endstep %}

{% step %}
要运行通用的 UD-IQ1\_S，你可以这样做：

**Qwen3.8-2.4T：**

{% code overflow="wrap" %}

```bash
pip install -U "huggingface_hub[cli]"
hf download unsloth/Qwen3.8-2.4T-A95B-GGUF \\
    --local-dir unsloth/Qwen3.8-2.4T-A95B-GGFF \\
    --include "*IQ1_S*" # 2-bit 使用 "*IQ2_XXS*"
```

{% endcode %}
{% endstep %}

{% step %}
然后运行它：

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \\
    --model unsloth/Qwen3.8-2.4T-A95B-GGUF/UD-IQ1_S/Qwen3.8-2.4T-A95B-UD-IQ1_S-00001-of-00012.gguf \
    --temp 1.0 \\
    --top-p 0.95 \\
    --top-k 20 \\
    --min-p 0.0
```

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

### ⚡️NVFP4

与 Qwen3.6 一样，我们也发布新的 [动态 NVFP4 Qwen3.8](/docs/zh/ji-chu/nvfp4.md)-27B 量化模型，可运行 **约快 1.5×** 比 BF16 检查点，并且 **性能更好** 且文件大小相当。运行 Qwen3.8-27B NVFP4 **快 1.5 倍** 在 **24GB 显存上。** 我们还添加了 **FP8 KV 缓存校准** 以实现 2 倍更长的上下文长度！NVFP4 需要 NVIDIA 的 Blackwell GPU，例如 RTX 50X、DGX Spark（见 [#dgx-spark-with-nvfp4-quants](#dgx-spark-with-nvfp4-quants "mention")），B200、B300 GPU。对于较旧的 GPU，我们的 GGUF 表现很好！你可以在 [vLLM](#vllm) 目前仅支持 vLLM（不支持 SGLang）。

* [Qwen3.8-27B-**NVFP4**](https://huggingface.co/unsloth/Qwen3.8-27B-NVFP4) 量化

<table><thead><tr><th width="90" align="right">批次</th><th width="114.5999755859375" align="right">BF16 总 tok/s</th><th width="122.60003662109375" align="right">NVFP4 总 tok/s</th><th width="122" align="right">加速比</th><th width="137.4000244140625" align="right">BF16 单用户</th><th align="right">NVFP4 单用户</th></tr></thead><tbody><tr><td align="right">1</td><td align="right">89.8</td><td align="right"><strong>133.7</strong></td><td align="right">1.49x</td><td align="right">89.8</td><td align="right"><strong>133.7</strong></td></tr><tr><td align="right">8</td><td align="right">649.4</td><td align="right"><strong>938.8</strong></td><td align="right">1.45x</td><td align="right">81.2</td><td align="right"><strong>117.3</strong></td></tr><tr><td align="right">32</td><td align="right">1983.0</td><td align="right"><strong>2787.0</strong></td><td align="right">1.41x</td><td align="right">62.0</td><td align="right"><strong>87.1</strong></td></tr><tr><td align="right">64</td><td align="right">3048.5</td><td align="right"><strong>4407.2</strong></td><td align="right">1.45x</td><td align="right">47.6</td><td align="right"><strong>68.9</strong></td></tr></tbody></table>

下方可查看我们此前为 Qwen3.6 进行的基准测试，以及与其他使用 16 位激活的 NVFP4 实现相比的结果；而我们的实现使用 NVFP4 激活：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F8zM7cg0Xgo2pAlop1iPW%2F01_qwen36_combined_throughput.png?alt=media&amp;token=23131a96-4c41-42d7-aa16-5bfb21bb44a3" alt="" width="563"><figcaption></figcaption></figure>

所有基准测试均使用 1× B200、128 并发。更高并发可将 35B 提升至 17,561 tokens/s。&#x20;

对于准确率基准，我们在代码、聊天以及多个领域上运行了 KLD 和 Top-1 一致性测试。与 BF16 相比，NVFP4 可稳定恢复 92% 到 97% 的准确率

| 语料                |        KLD 均值 | Top-1 一致率 |
| ----------------- | ------------: | --------: |
| 中文                |       0.01628 |    93.55% |
| 代码                |       0.02600 |    96.68% |
| 参考生成              |       0.03993 |    94.46% |
| 聊天                |       0.05818 |    92.15% |
| 日语 / 韩语 / 俄语 / 西语 | 0.0124-0.0155 |    94-95% |

对于准确率基准，在 Qwen 3.6 上，我们针对 FP8、BF16、NVIDIA 的 NVFP4 以及我们的 NVFP4s 进行了 MMLU-Pro、AIME 2025、GPQA 测试——我们展示了我们的更快量化版本在所有项目上的表现都相近：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FFhOUUUlRBj3dafGnmvhK%2F03_qwen36_combined_accuracy(7).png?alt=media&amp;token=9178447f-d5ae-4489-9bdc-73b2b7b1631b" alt=""><figcaption></figcaption></figure>

更多信息，请阅读我们的 [Dynamic NVFP4 量化博客](/docs/zh/ji-chu/nvfp4.md).

要运行 NVFP4 量化模型，请查看下方在以下环境中运行 Qwen3.8-27B 的命令： [vLLM](/docs/zh/ji-chu/inference-and-deployment/vllm-guide.md) 或 [SGLang](/docs/zh/ji-chu/inference-and-deployment/sglang-guide.md):

#### **vLLM：**

要在单独的虚拟环境中安装 vLLM：

{% code overflow="wrap" expandable="true" %}

```bash
uv venv unsloth-nvfp4-env --python 3.13
source unsloth-nvfp4-env/bin/activate
uv pip install "vllm>=0.25.0" "flashinfer-python>=0.6.13" "nvidia-cutlass-dsl>=4.5.2" \
    --torch-backend=auto
```

{% endcode %}

然后启动 27B 版本服务：

```shell
vllm serve unsloth/Qwen3.8-27B-NVFP4
```

要启用 MTP / 推测解码（解码更快，但吞吐量会略低），使用：

```bash
vllm serve unsloth/Qwen3.8-27B-NVFP4
    --speculative-config '{"method": "mtp", "num_speculative_tokens": 2}'
```

如果遇到 Torchcodec 问题，请务必先执行以下操作，然后重新启动 vllm。

{% code overflow="wrap" expandable="true" %}

```bash
sudo apt-get update
sudo apt-get install -y ffmpeg
```

{% endcode %}

#### **SGLang：**

如果使用 SGLang，你必须使用 **SGLang 版本 v0.5.19** 否则将无法工作，因为我们将 lm\_head 量化为 FP8。

{% hint style="info" %}
vLLM 有一个 `CompressedTensorsW8A8Fp8` 内核支持这一点，而 SGLang v0.5.19 无法加载 FP8 lm\_head。v0.5.19 现在可以用了！
{% endhint %}

对于 sglang，在安装最新版本后：

{% code overflow="wrap" %}

```bash
uv pip install sglang sglang-kernel \
  --extra-index-url https://sgl-project.github.io/whl/cu130/ \
  --extra-index-url https://download.pytorch.org/whl/cu130 \
  --index-strategy unsafe-best-match
```

{% endcode %}

然后你可以启动服务：

```bash
sglang serve unsloth/Qwen3.8-27B-NVFP4
```

要启用 MTP，使用：

{% code overflow="wrap" %}

```bash
sglang serve unsloth/Qwen3.8-27B-NVFP4 --speculative-algorithm EAGLE \
    --speculative-num-steps 3 --speculative-eagle-topk 1  --speculative-num-draft-tokens 4
```

{% endcode %}

### :exploding\_head:量化分析

NVFP4 量化比 BF16 快 1.5 倍，并保持 92% 到 97% 的 Top-1 准确率。

我们使用了 [Dynamic 3.0 GGUFs](/docs/zh/ji-chu/dynamic-3.0-ggufs.md) 来让 Qwen3.8-27B 好很多！

Qwen3.8-27B 的 UD-3 中所示 Top-1 准确率图：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FVg5FHPxOpmaJ1r3ciw4u%2Fimage.png?alt=media&amp;token=107ef044-0181-489b-b6ae-da218e16c98b" alt=""><figcaption></figcaption></figure>

以及 Qwen3.8 的 KLD 均值：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Ft8BnEqBLUQGUgu2cAKKI%2Fimage.png?alt=media&amp;token=912d5b6a-540f-4ee0-9208-f5ad45776341" alt=""><figcaption></figcaption></figure>

### 📊 基准测试

关于 GGUF 量化基准测试，你可以在上方查看我们的 [量化分析](#quantization-analysis) 或 [Dynamic V3.0 文章](/docs/zh/ji-chu/dynamic-3.0-ggufs.md).

#### Qwen3.8-**27B**

表格基准测试请见下方：

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FWijY5wYmLx70Ao2ol7Tj%2Fqwen%20benchmark%201.jpeg?alt=media&amp;token=f69ebf50-cf35-426f-a610-8eeb32151d90" alt=""><figcaption></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FELa2vq8Wh3oelQi6Bf07%2Fqwen%20benchmark%202.jpeg?alt=media&amp;token=2cc6d085-630d-4fa1-9b50-784b22a1fb04" alt=""><figcaption></figcaption></figure></div>

#### 文本性能

| 基准                                  | Qwen3.8-27B               | Qwen3.6-27B          | Qwen3.7-Plus         | Muse Glimmer-30B | Opus4.6 Max |
| ----------------------------------- | ------------------------- | -------------------- | -------------------- | ---------------- | ----------- |
| **编程**                              |                           |                      |                      |                  |             |
| 智能体终端编程Terminal Bench 2.1（Terminus） | 73.0                      | 63.4                 | 64.0                 | 51.7             | **78.2**    |
| 智能体编程SWE-bench Pro                  | **61.7**                  | 53.5                 | 57.6                 | 51.2             | 53.4        |
| 仓库级代码生成NL2Repo-Bench                | 42.3                      | 36.2                 | 41.1                 | --               | **47.6**    |
| 智能体编程DeepSWE 1.1                    | **42.2**                  | 13.3                 | 14.2                 | --               | --          |
| 软件工程QwenSWEBench                    | **79.0**                  | 49.3                 | 59.2                 | --               | 63.8        |
| **智能体**                             |                           |                      |                      |                  |             |
| 长周期办公任务CoWorkBench                  | **70.7**                  | 61.0                 | 65.1                 | --               | 68.2        |
| 专业工作任务JobBench                      | **33.4**                  | 21.8                 | 27.6                 | --               | --          |
| 前沿智能体任务Agents' Last Exam            | Pass\@1**20.4**得分**42.9** | Pass\@1 10.6，得分 27.3 | Pass\@1 13.2，得分 33.6 | --               | --          |
| 通用                                  |                           |                      |                      |                  |             |
| 指令遵循IFBench                         | **79.5**                  | 69.1                 | 79.1                 | 77.0             | 62.5        |
| 科学推理GPQA Diamond                    | 89.2                      | 87.8                 | 90.3                 | 83.5             | **91.3**    |
| 多学科推理HLE                            | 30.8                      | 24.0                 | 34.7                 | 22.0             | **40.0**    |
| 竞赛编程LiveCodeBench v6                | **90.3**                  | 83.9                 | 89.6                 | --               | 88.8        |

#### Qwen3.8-**2.4T-A95B**

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FWP0nBgaQcnnAGjqG1jyQ%2Fqwen3.8%20bench.jpg?alt=media&amp;token=92a0d19c-51cb-4df2-a4f5-334fe08e6a21" alt=""><figcaption></figcaption></figure>


---

# 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/qwen3.8.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.
