# Qwen3.6 - 如何本地运行

Qwen3.6 是阿里巴巴全新的多模态混合推理模型系列，包括： **Qwen3.6-27B** 以及 **35B-A3B**。它在同等规模下提供顶尖性能，支持覆盖 201 种语言的 256K 上下文。它在智能体式编程、视觉、聊天任务上表现出色。Qwen3.6-27B 可在 **18GB 内存** 配置上运行，而 35B-A3B 可在 **22GB**上运行。现在你可以在中运行和训练这些模型 [Unsloth Studio](#unsloth-studio-guide).

{% hint style="success" %}
**新：** [**Qwen3.6 MTP 来了**](#mtp-guide)**！MTP 可在不损失准确率的情况下实现 1.4-2 倍更快的推理。可直接在中运行 MTP** [**Unsloth Studio**](#unsloth-studio-mtp-guide)**.**

我们进行了 [Qwen3.6 GGUF 基准测试](#unsloth-gguf-benchmarks) ，帮助你选择最佳量化版本。
{% endhint %}

<a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#qwen3.6-inference-tutorials" class="button primary">运行 Qwen3.6 教程</a><a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#unsloth-guide" class="button primary">MTP 指南</a>

{% columns %}
{% column %}
Qwen3.6 GGUF 使用 Unsloth [Dynamic 2.0](/docs/zh/ji-chu/unsloth-dynamic-2.0-ggufs.md) 以获得 SOTA 级量化性能——因此量化版本会基于真实世界使用场景数据集进行校准，并且会对重要层进行上浮精度处理。 *感谢 Qwen 在第一天就提供访问权限。*

* **开发者角色支持** 适用于 Codex、OpenCode 等：\
  我们的上传现在支持 `开发者角色` ，适用于智能体式编程工具。
* **工具调用：** 类似于 [Qwen3.5](/docs/zh/mo-xing/qwen3.5.md)，我们改进了对嵌套对象的解析，以提高工具调用成功率。
  {% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/23fb40df7f876a1d75f48943c38802ab9e31027f" alt=""><figcaption><p>运行中的 Qwen3.6 <a href="#unsloth-studio-guide">Unsloth Studio</a>.</p></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

### :gear: 使用指南

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

<table><thead><tr><th>Qwen3.6</th><th>3 位</th><th>4 位</th><th width="128">6 位</th><th>8 位</th><th>BF16</th></tr></thead><tbody><tr><td><strong>27B</strong></td><td>15 GB</td><td>18 GB</td><td>24 GB</td><td>30 GB</td><td>55 GB</td></tr><tr><td><strong>35B-A3B</strong></td><td>17 GB</td><td>23 GB</td><td>30 GB</td><td>38 GB</td><td>70 GB</td></tr></tbody></table>

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

{% hint style="warning" %}
不要使用 CUDA 13.2，否则可能会得到乱码输出。NVIDIA 正在修复。
{% endhint %}

**要训练 Qwen3.6，你可以参考我们之前的** [**Qwen3.5 微调指南**](/docs/zh/mo-xing/qwen3.5/fine-tune.md)**.**

### 推荐设置

* **最大上下文窗口：** `262,144` （可通过 YaRN 扩展到 1M）
* `presence_penalty = 0.0 到 2.0` 默认情况下这是关闭的，但为了减少重复，你可以使用它；不过使用更高的值可能会导致 **性能略有下降**
* **足够的输出长度**: `32,768` 适用于大多数查询的 tokens 数

{% hint style="info" %}
如果你得到的是乱码，可能是你的上下文长度设置得太低了。或者尝试使用 `--cache-type-k bf16 --cache-type-v bf16` 这可能会有帮助。
{% endhint %}

由于 Qwen3.6 是混合推理模型，思考模式和非思考模式有不同设置：

#### 思考模式：

{% hint style="success" %}
Qwen3.6 现在有 [保留思考](#turn-on-off-thinking--preserve-thinking).
{% endhint %}

| 通用任务                       | 精确编程任务（例如 WebDev）          |
| -------------------------- | -------------------------- |
| temperature = 1.0          | temperature = 0.6          |
| top\_p = 0.95              | top\_p = 0.95              |
| top\_k = 20                | top\_k = 20                |
| min\_p = 0.0               | min\_p = 0.0               |
| presence\_penalty = 1.5    | presence\_penalty = 0.0    |
| repeat\_penalty = 已禁用或 1.0 | repeat\_penalty = 已禁用或 1.0 |

{% columns %}
{% column %}
通用任务的思考模式：

{% code overflow="wrap" %}

```bash
temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
```

{% endcode %}
{% endcolumn %}

{% column %}
精确编程任务的思考模式：

{% code overflow="wrap" %}

```bash
temperature=0.6, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0
```

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

#### Instruct（非思考）模式设置：

| 通用任务                       | 推理任务                       |
| -------------------------- | -------------------------- |
| temperature = 0.7          | temperature = 1.0          |
| top\_p = 0.8               | top\_p = 0.95              |
| top\_k = 20                | top\_k = 20                |
| min\_p = 0.0               | min\_p = 0.0               |
| presence\_penalty = 1.5    | presence\_penalty = 1.5    |
| repeat\_penalty = 已禁用或 1.0 | repeat\_penalty = 已禁用或 1.0 |

{% hint style="warning" %}
要 [禁用思考 / 推理](#how-to-enable-or-disable-reasoning-and-thinking)，请使用 `--chat-template-kwargs '{"enable_thinking":false}'`

如果你在 **Windows** Powershell 中，请使用： `--chat-template-kwargs "{\"enable_thinking\":false}"`

可互换使用 'true' 和 'false'。
{% endhint %}

{% columns %}
{% column %}
通用任务的 Instruct（非思考）模式：

{% code overflow="wrap" %}

```bash
temperature=0.7, top_p=0.8, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
```

{% endcode %}
{% endcolumn %}

{% column %}
推理任务的 Instruct（非思考）模式：

{% code overflow="wrap" %}

```bash
temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
```

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

## Qwen3.6 推理教程：

我们将使用动态 4 位 `UD-Q4_K_XL` GGUF 变体进行推理工作负载。点击下方可跳转到对应模型说明：

<a href="/pages/1427becb679b955148197a06de42a82ae44b05b6#unsloth-studio-guide" class="button primary">在 Unsloth Studio 中运行</a><a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#llama.cpp-guides" class="button secondary">在 llama.cpp 中运行</a><a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#mtp-guide" class="button primary">MTP 指南</a>

{% hint style="warning" %}
不要使用 CUDA 13.2，否则可能会得到乱码输出。NVIDIA 正在修复。

目前由于独立的 mmproj 视觉文件，Ollama 中没有任何 Qwen3.6 GGUF 可用。请使用与 llama.cpp 兼容的后端。
{% endhint %}

### 🦥 Unsloth Studio 指南

Qwen3.6 和 Qwen3.6 MTP 现在可以在中运行 [Unsloth Studio](/docs/zh/xin/studio.md)，这是我们新的本地 AI 开源网页 UI。Unsloth Studio 让你可以在上本地运行模型 **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）
* [自动推理](/docs/zh/xin/studio.md#model-arena) 参数调优（temp、top-p 等）
* 通过 llama.cpp 实现快速 CPU + GPU 推理
* [训练 LLM](/docs/zh/xin/studio.md#no-code-training) 速度提升 2 倍，显存减少 70%
  {% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/16cd5c624d215906fa9d68a69a32e3e5c28d1730" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% stepper %}
{% step %}

#### 安装 Unsloth

在终端中运行：

**MacOS、Linux、WSL：**

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

**Windows PowerShell：**

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

{% hint style="success" %}
**安装会很快，约需 20 秒到 1 分钟。**
{% endhint %}
{% endstep %}

{% step %}

#### 启动 Unsloth

**MacOS、Linux、WSL 和 Windows：**

```bash
unsloth studio -H 0.0.0.0 -p 8888
```

<div data-with-frame="true"><figure><img src="/files/7fd4b2ed7fb55df6d31b4dd1ce1181d57613709b" alt="" width="375"><figcaption></figcaption></figure></div>

然后打开 `http://127.0.0.1:8888` （或你的特定 URL）在浏览器中打开。
{% endstep %}

{% step %}

#### 搜索并下载 Qwen3.6 或 Qwen3.6 MTP

首次启动时，你需要创建一个密码来保护你的账户，之后再次登录。然后你会看到一个简短的引导向导，用于选择模型、数据集和基本设置。你可以随时跳过它。

然后转到 [Studio Chat](/docs/zh/xin/studio/chat.md) 选项卡，在搜索栏中搜索 Qwen3.6 或 Qwen3.6 MTP，并下载你想要的模型和量化版本。

<div data-with-frame="true"><figure><img src="/files/7aef36cb0ac4aa56d855f97124b0fda59c858502" alt="" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### 运行 Qwen3.6

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

更多信息请查看我们的 [Unsloth Studio 推理指南](/docs/zh/xin/studio/chat.md)。下面这个 2 位 Qwen3.6 GGUF 完成了 30+ 次工具调用，搜索了 20 个网站，并执行了 Python 代码：

{% embed url="<https://cdn-uploads.huggingface.co/production/uploads/62ecdc18b72a69615d6bd857/9lqVQm1qDX3elt6Uan5Vm.mp4>" %}
{% endstep %}
{% endstepper %}

### ⚡ MTP 指南

MTP（多 token 预测） 投机解码使 Qwen3.6 这类模型能够 **实现约 1.4-2 倍更快的生成，且&#x20;**<mark style="background-color:$success;">**准确率不变**</mark>。这使得 Qwen3.6 27B 和 35B-A3B 可实现 **超过 1.4 倍的速度提升** ，相较于原始基线，尤其适合本地模型。

你可以直接通过 UI 在中运行 MTP GGUF [Unsloth Studio](#unsloth-studio-mtp-guide). **Qwen3.6 27B 现在可达到 140 tokens/s 的生成速度，而 Qwen3.6 35B-A3B 可达到 220 tokens/s！** 查看 [#mtp-benchmarks](#mtp-benchmarks "mention") 了解更多细节。

<a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#unsloth-studio-mtp-guide" class="button primary">在 Unsloth Studio 中运行</a><a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#llama.cpp-mtp-guide" class="button secondary">在 llama.cpp 中运行</a>

| [Qwen3.6-27B-MTP-GGUF](https://huggingface.co/unsloth/Qwen3.6-27B-MTP-GGUF) | [Qwen3.6-35B-A3B-MTP-GGUF](https://huggingface.co/unsloth/Qwen3.6-35B-A3B-MTP-GGUF) |
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |

<div><figure><img src="/files/fbf013b2e3fe83053bc6b4fac6fca94146c321b0" alt=""><figcaption></figcaption></figure> <figure><img src="/files/3a0ee4795c3e9a1c666b1785d7f9e0fe6d031673" alt=""><figcaption></figcaption></figure></div>

实际中，MTP 会先预测若干未来 token，然后由主模型并行验证这些 token。这减少了生成过程中所需的前向传播次数，从而让输出更快。我们发现 `--spec-draft-n-max 2` 效果最好！

#### 🦥 Unsloth Studio MTP 指南

{% stepper %}
{% step %}

#### 安装 Unsloth

在终端中运行：

**MacOS、Linux、WSL：**

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

**Windows PowerShell：**

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

{% hint style="success" %}
**安装会很快，约需 20 秒到 1 分钟。**
{% endhint %}
{% endstep %}

{% step %}

#### 启动 Unsloth

**MacOS、Linux、WSL 和 Windows：**

```bash
unsloth studio -H 0.0.0.0 -p 8888
```

<div data-with-frame="true"><figure><img src="/files/7fd4b2ed7fb55df6d31b4dd1ce1181d57613709b" alt="" width="375"><figcaption></figcaption></figure></div>

然后打开 `http://127.0.0.1:8888` （或你的特定 URL）在浏览器中打开。
{% endstep %}

{% step %}

#### 搜索并下载 Qwen3.6 MTP

首次启动时，你需要创建一个密码来保护你的账户，并在稍后重新登录。然后转到 [Studio Chat](/docs/zh/xin/studio/chat.md) 选项卡，在搜索栏中搜索 Qwen3.6 MTP，并下载你想要的模型和量化版本。

<div data-with-frame="true"><figure><img src="/files/12b8f9f54d20898a6adf6a79206c0689ab115b74" alt="" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### 运行 Qwen3.6 MTP

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

更多信息请查看我们的 [Unsloth Studio 推理指南](/docs/zh/xin/studio/chat.md)。下面这个 2 位 Qwen3.6 GGUF 完成了 30+ 次工具调用，搜索了 20 个网站，并执行了 Python 代码：

{% embed url="<https://cdn-uploads.huggingface.co/production/uploads/62ecdc18b72a69615d6bd857/9lqVQm1qDX3elt6Uan5Vm.mp4>" %}
{% endstep %}
{% endstepper %}

#### 🦙 Llama.cpp MTP 指南

{% stepper %}
{% step %}
安装最新版本的 `llama.cpp` 默认开启 [**GitHub 仓库**](https://github.com/ggml-org/llama.cpp/pull/22673)。你也可以按照下面的构建说明进行。将 `-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` 直接加载模型的话，你可以执行下面的操作：（`Q4_K_XL`）是量化类型。你也可以通过 Hugging Face 下载（第 3 点）。这与 `ollama run` 类似。使用 `export LLAMA_CACHE="folder"` 强制 `llama.cpp` 保存到特定位置。该模型的最大上下文长度为 256K。

请按照特定模型对应的命令之一执行：

<a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#mtp-qwen3.6-27b" class="button primary">27B MTP</a><a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#mtp-qwen3.6-35b-a3b" class="button primary">35-A3B MTP</a>

{% hint style="info" %}
`llama.cpp` 已将启用 MTP 的参数从 `--spec-type mtp` 到 `--spec-type draft-mtp` 于 2026 年 5 月 13 日更改。请使用这个新参数来启用 MTP。
{% endhint %}

#### MTP Qwen3.6-27B：

**思考模式：**

{% hint style="info" %}
请查看 Qwen3.6 的新 [保留思考](#thinking-enable-disable--preserve-thinking).
{% endhint %}

通用任务：

```bash
export LLAMA_CACHE="unsloth/Qwen3.6-27B-MTP-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/Qwen3.6-27B-GGUF:UD-Q4_K_XL \\
    --temp 1.0 \\
    --top-p 0.95 \
    --top-k 20 \\
    --presence-penalty 1.5 \\
    --min-p 0.00 \\
    --spec-type draft-mtp --spec-draft-n-max 6
```

对于精确编程任务，修改： `temperature=0.6, presence-penalty=0.0`

**非思考模式：**

通用任务：

```bash
export LLAMA_CACHE="unsloth/Qwen3.6-27B-MTP-GGUF"
./llama.cpp/llama-server \\
    -hf unsloth/Qwen3.6-27B-MTP-GGUF:UD-Q4_K_XL \\
    --temp 0.7 \\
    --top-p 0.8 \\
    --top-k 20 \\
    --presence-penalty 1.5 \\
    --min-p 0.00 \\
    --spec-type draft-mtp --spec-draft-n-max 6 \\
    --chat-template-kwargs '{"enable_thinking":false}'
```

对于推理任务，修改： `temperature=1.0, top-p=0.95`

#### MTP Qwen3.6-35B-A3B：

**思考模式：**

{% hint style="info" %}
请查看 Qwen3.6 的新 [保留思考](#thinking-enable-disable--preserve-thinking).
{% endhint %}

通用任务：

```bash
export LLAMA_CACHE="unsloth/Qwen3.6-35B-A3B-MTP-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \\
    --temp 1.0 \\
    --top-p 0.95 \
    --top-k 20 \\
    --presence-penalty 1.5 \\
    --min-p 0.00 \\
    --spec-type draft-mtp --spec-draft-n-max 6
```

对于精确编程任务，修改： `temperature=0.6, presence-penalty=0.0`

**非思考模式：**

通用任务：

```bash
export LLAMA_CACHE="unsloth/Qwen3.6-35B-A3B-MTP-GGUF"
./llama.cpp/llama-server \\
    -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \\
    --temp 0.7 \\
    --top-p 0.8 \\
    --top-k 20 \\
    --presence-penalty 1.5 \\
    --min-p 0.00 \\
    --spec-type draft-mtp --spec-draft-n-max 6 \\
    --chat-template-kwargs '{"enable_thinking":false}'
```

对于推理任务，修改： `temperature=1.0, top-p=0.95`
{% endstep %}

{% step %}
通过下面的代码下载模型（在安装后 `pip install huggingface_hub hf_transfer`）。你可以选择 Q4\_K\_M 或其他量化版本，例如 `UD-Q4_K_XL` 。我们建议至少使用 2 位动态量化 `UD-Q2_K_XL` ，以平衡大小和准确率。如果下载卡住，请参见： [Hugging Face Hub，XET 调试](/docs/zh/ji-chu/troubleshooting-and-faqs/hugging-face-hub-xet-debugging.md)

```bash
hf download unsloth/Qwen3.6-35B-A3B-MTP-GGUF \\
    --local-dir unsloth/Qwen3.6-35B-A3B-MTP-GGUF \\
    --include "*mmproj-F16*" \\
    --include "*UD-Q4_K_XL*" # 动态 2bit 请使用 "*UD-Q2_K_XL*"
```

{% endstep %}

{% step %}
然后以对话模式运行模型：

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \
    --model unsloth/Qwen3.6-35B-A3B-MTP-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf \\
    --mmproj unsloth/Qwen3.6-35B-A3B-MTP-GGUF/mmproj-F16.gguf \\
    --temp 1.0 \\
    --top-p 0.95 \
    --min-p 0.00 \\
    --presence-penalty 1.5 \\
    --top-k 20 \\
    --spec-type draft-mtp --spec-draft-n-max 6
```

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

### 🦙 Llama.cpp 指南

在本指南中，我们将使用动态 4 位，它在 24GB 内存 / Mac 设备上运行良好，可在上进行快速推理 [llama.cpp](llama.cpphttps://github.com/ggml-org/llama.cpp)。由于该模型在完整 F16 精度下只有大约 72GB，因此我们无需太担心性能问题。 [查看我们的 GGUF 集合](https://huggingface.co/collections/unsloth/qwen36).

<a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#qwen3.6-27b" class="button primary">27B</a><a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#qwen3.6-35b-a3b" class="button primary">35-A3B</a>

{% 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` 直接加载模型的话，你可以执行下面的操作：（`Q4_K_XL`）是量化类型。你也可以通过 Hugging Face 下载（第 3 点）。这与 `ollama run` 类似。使用 `export LLAMA_CACHE="folder"` 强制 `llama.cpp` 保存到特定位置。该模型的最大上下文长度为 256K。

请按照特定模型对应的命令之一执行：

<a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#qwen3.5-27b" class="button primary">27B</a><a href="/pages/213bd08e4302b621f4392f7ee38decb275ffab02#qwen3.5-35b-a3b" class="button primary">35-A3B</a>

#### Qwen3.6-27B：

**思考模式：**

{% hint style="info" %}
请查看 Qwen3.6 的新 [保留思考](#thinking-enable-disable--preserve-thinking).
{% endhint %}

通用任务：

```bash
export LLAMA_CACHE="unsloth/Qwen3.6-27B-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/Qwen3.6-27B-GGUF:UD-Q4_K_XL \\
    --temp 1.0 \\
    --top-p 0.95 \
    --top-k 20 \\
    --presence-penalty 1.5 \\
    --min-p 0.00
```

对于精确编程任务，修改： `temperature=0.6, presence-penalty=0.0`

**非思考模式：**

通用任务：

```bash
export LLAMA_CACHE="unsloth/Qwen3.6-27B-GGUF"
./llama.cpp/llama-server \\
    -hf unsloth/Qwen3.6-27B-GGUF:UD-Q4_K_XL \\
    --temp 0.7 \\
    --top-p 0.8 \\
    --top-k 20 \\
    --presence-penalty 1.5 \\
    --min-p 0.00 \\
    --chat-template-kwargs '{"enable_thinking":false}'
```

对于推理任务，修改： `temperature=1.0, top-p=0.95`

#### Qwen3.6-35B-A3B：

**思考模式：**

{% hint style="info" %}
请查看 Qwen3.6 的新 [保留思考](#thinking-enable-disable--preserve-thinking).
{% endhint %}

通用任务：

```bash
export LLAMA_CACHE="unsloth/Qwen3.6-35B-A3B-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL \\
    --temp 1.0 \\
    --top-p 0.95 \
    --top-k 20 \\
    --presence-penalty 1.5 \\
    --min-p 0.00
```

对于精确编程任务，修改： `temperature=0.6, presence-penalty=0.0`

**非思考模式：**

通用任务：

```bash
export LLAMA_CACHE="unsloth/Qwen3.6-35B-A3B-GGUF"
./llama.cpp/llama-server \\
    -hf unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL \\
    --temp 0.7 \\
    --top-p 0.8 \\
    --top-k 20 \\
    --presence-penalty 1.5 \\
    --min-p 0.00 \\
    --chat-template-kwargs '{"enable_thinking":false}'
```

对于推理任务，修改： `temperature=1.0, top-p=0.95`
{% endstep %}

{% step %}
通过下面的代码下载模型（在安装后 `pip install huggingface_hub hf_transfer`）。你可以选择 Q4\_K\_M 或其他量化版本，例如 `UD-Q4_K_XL` 。我们建议至少使用 2 位动态量化 `UD-Q2_K_XL` ，以平衡大小和准确率。如果下载卡住，请参见： [Hugging Face Hub，XET 调试](/docs/zh/ji-chu/troubleshooting-and-faqs/hugging-face-hub-xet-debugging.md)

```bash
hf download unsloth/Qwen3.6-35B-A3B-GGUF \\
    --local-dir unsloth/Qwen3.6-35B-A3B-GGUF \\
    --include "*mmproj-F16*" \\
    --include "*UD-Q4_K_XL*" # 动态 2bit 请使用 "*UD-Q2_K_XL*"
```

{% endstep %}

{% step %}
然后以对话模式运行模型：

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \
    --model unsloth/Qwen3.6-35B-A3B-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf \\
    --mmproj unsloth/Qwen3.6-35B-A3B-GGUF/mmproj-F16.gguf \\
    --temp 1.0 \\
    --top-p 0.95 \
    --min-p 0.00 \\
    --presence-penalty 1.5 \\
    --top-k 20
```

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

#### Llama-server 与 OpenAI completion 库

要将 Qwen3.6 部署到生产环境，我们使用 `llama-server` 在一个新终端中，例如通过 tmux，使用以下命令部署模型：

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-server \\
--model unsloth/Qwen3.6-35B-A3B-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf \\
    --mmproj unsloth/Qwen3.6-35B-A3B-GGUF/mmproj-F16.gguf \\
    --alias "unsloth/Qwen3.6-35B-A3B" \\
    --temp 0.6 \\
    --top-p 0.95 \
    --ctx-size 16384 \\
    --top-k 20 \\
    --min-p 0.00 \\
    --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/Qwen3.6-35B-A3B",
    messages = [{"role": "user", "content": "Create a Snake game."},],
)
print(completion.choices[0].message.content)
```

{% endcode %}

### 🍎 MLX 动态量化

我们还为 MacOS 设备上传了动态 Qwen3.6 4bit 和 8bit 量化版本！我们的 MLX 量化算法仍在演进中，我们也在持续优化任何可以改进的地方。

**Qwen3.6-27B MLX：**

| [3 位](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-3bit) | [4 位](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-4bit) | [MXFP4](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-MXFP4) | [NVFP4](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-NVFP4) | [6 位](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-6bit) | [8 位](https://huggingface.co/unsloth/Qwen3.6-27B-MLX-8bit) |
| ------------------------------------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------- |

**Qwen3.6-35B-A3B MLX：**

| [3 位](https://huggingface.co/unsloth/Qwen3.6-35B-A3B-UD-MLX-3bit) | [4 位](https://huggingface.co/unsloth/Qwen3.6-35B-A3B-UD-MLX-4bit) | [8 位](https://huggingface.co/unsloth/Qwen3.6-35B-A3B-MLX-8bit) |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------- |

试用它们请使用：

{% code overflow="wrap" %}

```bash
curl -fsSL https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/scripts/install_qwen3_6_mlx.sh | sh
source ~/.unsloth/unsloth_qwen3_6_mlx/bin/activate
python -m mlx_vlm.chat --model unsloth/Qwen3.6-27B-UD-MLX-4bit
```

{% endcode %}

下面是 Qwen3.6-27B 的 KL 散度（KLD）和困惑度（PPL）分数（越低越好）：

| 模型                                                               | 平均 KLD | 中位数 KLD | PPL   | P90 KLD | P99.9 KLD | 大小      |
| ---------------------------------------------------------------- | ------ | ------- | ----- | ------- | --------- | ------- |
| [8 位](https://huggingface.co/unsloth/Qwen3.6-27B-MLX-8bit)       | 0.0028 | 0.0003  | 4.812 | 0.0019  | 0.192     | 34.7 GB |
| [6 位](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-6bit)    | 0.0037 | 0.0007  | 4.809 | 0.0032  | 0.343     | 30.5 GB |
| [4 位](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-4bit)    | 0.0227 | 0.0053  | 4.821 | 0.0293  | 2.339     | 26.2 GB |
| [NVFP4](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-NVFP4) | 0.0325 | 0.0087  | 4.843 | 0.0466  | 3.693     | 26.2 GB |
| [MXFP4](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-MXFP4) | 0.0479 | 0.0153  | 4.902 | 0.0769  | 4.035     | 25.6 GB |
| [3 位](https://huggingface.co/unsloth/Qwen3.6-27B-UD-MLX-3bit)    | 0.0734 | 0.0223  | 4.976 | 0.1261  | 5.529     | 24.1 GB |

### 💡 思考：启用/禁用 + 保留思考

Qwen3.6 也有 **保留思考** 它会保留上一轮对话中的思考轨迹。这会增加你使用的 token 数量，但可能提高持续对话中的准确率。Unsloth Studio 为 Qwen3.6 提供了 'Think' 和保留思考开关：

<div data-with-frame="true"><figure><img src="/files/16cd5c624d215906fa9d68a69a32e3e5c28d1730" alt="" width="563"><figcaption><p>Unsloth Studio 默认提供 Think 开关，并新增一个 <a href="#preserved-thinking">保留思考</a> 切换开关</p></figcaption></figure></div>

要启用 **保留思考** 在 llama.cpp 中使用（将其改为 'true' 或 'false'）'`preserve_thinking`' 而不是 '`enable_thinking`' 或 '`disable_thinking`'.

{% code expandable="true" %}

```bash
--chat-template-kwargs '{"preserve_thinking":true}'
```

{% endcode %}

对于正常思考，你可以按照下面的命令在 llama.cpp 中启用 / 禁用思考。使用 '`true`' 和 '`false`' 可互换。&#x20;

<table data-full-width="false"><thead><tr><th width="197.76666259765625">llama-server 操作系统：</th><th>启用思考</th><th>禁用思考</th></tr></thead><tbody><tr><td>Linux、MacOS、WSL：</td><td><pre data-overflow="wrap"><code>--chat-template-kwargs '{"enable_thinking":true}'
</code></pre></td><td><pre data-overflow="wrap"><code>--chat-template-kwargs '{"enable_thinking":false}'
</code></pre></td></tr><tr><td>Windows / Powershell：</td><td><pre data-overflow="wrap"><code>--chat-template-kwargs "{\"enable_thinking\":true}"
</code></pre></td><td><pre data-overflow="wrap"><code>--chat-template-kwargs "{\"enable_thinking\":false}"
</code></pre></td></tr></tbody></table>

例如，对于 Qwen3.6-35B-A3B，要启用保留思考（默认已启用）：

```bash
./llama.cpp/llama-server \\
    --model unsloth/Qwen3.6-35B-A3B-GGUF/Qwen3.6-35B-A3B-BF16.gguf \\
    --alias "unsloth/Qwen3.6-35B-A3B-GGUF" \\
    --temp 0.6 \\
    --top-p 0.95 \
    --top-k 20 \\
    --min-p 0.00 \\
    --port 8001 \\
    --chat-template-kwargs '{"preserve_thinking":true}'
```

然后在 Python 中：

```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/Qwen3.6-35B-A3B-GGUF",
    messages = [{"role": "user", "content": "2+2 等于多少？"},],
)
print(completion.choices[0].message.content)
print(completion.choices[0].message.reasoning_content)
```

### 👨‍💻 OpenAI Codex 与 Claude Code <a href="#claude-codex" id="claude-codex"></a>

要通过本地编码智能体工作负载运行模型，你可以 [参考我们的指南](/docs/zh/ji-chu/claude-code.md)。只需将模型名称改为你的 'Qwen3.6' 变体，并确保遵循正确的 Qwen3.6 参数和使用说明。使用我们刚刚设置好的 `llama-server` 。

{% columns %}
{% column %}
{% content-ref url="/pages/1a707991086189a8e5cd8374f3ce1b81915bc159" %}
[Claude Code](/docs/zh/ji-chu/claude-code.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
{% content-ref url="/pages/b71ddea7924324c058a771e5e831c3cb6fc75b18" %}
[OpenAI Codex](/docs/zh/ji-chu/codex.md)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}

例如，在按照 Claude Code 的说明后，你会看到：

<div data-with-frame="true"><figure><img src="/files/be54fd4979cb843065fdc5154054004c88461f07" alt="" width="563"><figcaption></figcaption></figure></div>

然后我们可以这样提问 `创建一个 Python 国际象棋游戏` :

<div><figure><img src="/files/f550af4f99be6b79fd3b5a400e30ad58218fa7e3" alt="" width="563"><figcaption></figcaption></figure> <figure><img src="/files/fdd9c81b9b972c00c10cb5f7f81465750b5ffb9f" alt="" width="563"><figcaption></figcaption></figure> <figure><img src="/files/578a400d2f1235e4bf41d8620874e1c714fa38e6" alt="" width="563"><figcaption></figcaption></figure></div>

## 📊 基准测试

### Unsloth GGUF 基准测试

我们对不同提供方的 Qwen3.6-35-A3B GGUF 进行了平均 KL 散度基准测试，帮助你选择最佳量化版本。

* KL 散度使几乎所有 Unsloth GGUF 都位于 SOTA 帕累托前沿
* KLD 显示量化模型与原始 BF16 输出分布的匹配程度，表明保留的准确率。
* 这使得 Unsloth 在 22 种尺寸中的 21 种上表现最佳
* 只有 Q6\_K 因更多动态层而更新，我们还引入了新的 `UD-IQ4_NL_XL` 量化版本

<div data-with-frame="true"><figure><img src="/files/2a6320fe208e8cb5edf737d5094f9f3a28f26540" alt=""><figcaption><p>35B-A3B - KLD 基准测试（越低越好）</p></figcaption></figure></div>

### MTP 基准测试

我们对为 27B 和 35B MoE 制作的新量化版本进行了基准测试。总体而言，与 MoE 模型（1.15-1.25x）相比，稠密模型在 MTP 下加速更明显（1.4-2x）。

据此，Qwen3.6 27B 现在使用 UD-Q2\_K\_XL 可达到 140 tokens/s 的生成速度，而 Qwen3.6 35B-A3B 可达到 220 tokens/s！部分吞吐量数据会有噪声，因此不要据此推断某些量化版本比其他版本更慢。

<figure><img src="/files/92fcc5e0d35c217a4a43e7b9b42e34141295c89c" alt=""><figcaption></figcaption></figure>

在平均加速比方面，当 draft tokens = 2 时，稠密模型可达到 1.4x，而 MoE 大约为 1.15 到 1.2x。

<figure><img src="/files/84b1b687b4897a2fdc21b71fac7198ae06ab9b3e" alt=""><figcaption></figcaption></figure>

我们不建议使用超过 2 个 draft token，因为当 draft token 数为 4 时，接受率会从 83% 骤降到 50%，MTP 的前向传播收益会变得更小。

<figure><img src="/files/ee54526633fbe916daa30ea4531bd81bb5284f29" alt=""><figcaption></figcaption></figure>

### 官方 Qwen 基准测试

#### Qwen3.6-27B

<div data-with-frame="true"><figure><img src="/files/391557e702d18cc856f961354b70ebe3df6b4123" alt=""><figcaption></figcaption></figure></div>

#### Qwen3.6-35B-A3B

<div data-with-frame="true"><figure><img src="/files/c66094264b39d012237e655baa3d3f110ddb12f1" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions: 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:

```
GET https://unsloth.ai/docs/zh/mo-xing/qwen3.6.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
