> 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/glm-5.3.md).

# GLM-5.3 - 如何本地运行

运行 Z.ai 的全新 GLM-5.3 模型。

GLM-5.3 是 Z.ai 的新款 744B 参数（40B 激活）模型。截至 2026 年 8 月，GLM-5.3 是 **最强的开源模型** ，在 Terminal Bench 3.0 和 Agents' Last Exam 上取得了 SOTA。GLM-5.3 使用与 [GLM-5.2](/docs/zh/mo-xing/glm-5.2.md)相同的基础模型，所有提升都来自后训练。该模型拥有 **100 万上下文** 窗口，并且现在可通过 [Unsloth Dynamic](https://unsloth.ai/docs/basics/dynamic-3.0-ggufs) GGUF 与 llama.cpp 或 [Unsloth Desktop](#run-glm-5.3-in-unsloth).

<a href="/docs/zh/mo-xing/glm-5.3-flash.md" class="button primary">GLM-5.3-Flash 指南</a><a href="/pages/05cf6108e5727de5e44d90ca513250d025daed60#run-glm-5.3-tutorials" class="button secondary">GLM-5.3 指南</a>

{% hint style="info" %}
如果你想运行 [**GLM-5.3-Flash**](/docs/zh/mo-xing/glm-5.3-flash.md)，请阅读我们的 [专门文章](/docs/zh/mo-xing/glm-5.3-flash.md) 。
{% endhint %}

动态 1-bit GGUF 可达到 **\~76%** top-1 准确率，同时 **体积缩小 85%**。动态 2-bit 可达到 **\~81%** 准确率，同时 **体积缩小 83%**。由于 GLM-5.3 与 GLM-5.2 在大小和架构上相同，大多数要求/设置也相同。感谢 Z.ai 提供 Unsloth 首日访问权限。 [**GLM-5.3-GGUF**](https://huggingface.co/unsloth/GLM-5.3-GGUF)

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

2-bit 动态量化版本 `UD-IQ2_M` 占用 **239GB** 的磁盘空间，可很好地运行在 **256GB RAM** 等设备上，例如 2x NVIDIA DGX Sparks 或 Mac Studio。

该 **1-bit** 量化版本可适配 223GB RAM，而 8-bit 需要 810GB RAM。

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

| 1-bit | 2-bit | 3-bit     | 4-bit     | 6-bit | 8-bit |
| ----- | ----- | --------- | --------- | ----- | ----- |
| 223GB | 245GB | 290-360GB | 372-475GB | 570GB | 810GB |

为获得最佳性能，请确保包括 VRAM 和系统 RAM 在内的可用总内存，明显大于量化后的模型文件大小。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FJsaB5Sn5JEJXD40RU06i%2Fglm53_unsloth_dynamic_ggufs_top1_accuracy_updated.png?alt=media&amp;token=ef24f54e-c3a7-461e-aa02-ccb8f654fede" alt=""><figcaption></figcaption></figure>

#### 推荐设置

GLM-5.3 具有 **3 种思考模式**: **低**, **高**，和 **最大**。对于复杂的编程任务，请使用 Max Thinking。在 [Unsloth Desktop](/docs/zh/desktop.md) 中，你可以通过 UI 轻松切换 Low、High 和 Max Thinking。

大多数使用场景都可使用以下设置：

| 默认设置（大多数任务）         | 长周期智能体任务            |
| ------------------- | ------------------- |
| `temperature` = 1.0 | `temperature` = 1.0 |
| `top_p` = 0.95      | `top_p` = 1.0       |

该 **最大上下文窗口** 是 `1,048,576`.

GLM-5.3 默认使用最大推理，且无法关闭思考。 `reasoning_effort` 可以是 `低`, `高`，或 `最大`.

`clear_thinking` 默认值为 false，他们建议设为 true。

如需自定义推理强度（将 'low' 改为 'high' 或 'max'）：

```bash
--chat-template-kwargs '{"reasoning_effort":"低"}'
```

对于多轮对话，请使用 `clear_thinking=true` 以移除前几轮的推理内容（本模型推荐这样做）：

```bash
--chat-template-kwargs '{"reasoning_effort":"最大","clear_thinking":true}'
```

### 聊天模板修复

我们发现 GLM 在聊天模板中使用了一种有趣的 `.{id}.` 记法，但许多引擎不支持。我们已将其全部改为 `[id]` ，以符合 Python 列表索引语法。请参见此 [提交更改](https://huggingface.co/unsloth/GLM-5.3/commit/05cd131f7ab554f983b81c6be97916450b0ff8d2) 了解更多细节。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F3d64OwoEjqpJ5fHum860%2Fimage.png?alt=media&amp;token=784da534-c703-4246-886d-bd058cf345f1" alt="" width="563"><figcaption></figcaption></figure>

## 运行 GLM-5.3 教程：

你现在可以在 [llama.cpp](https://unsloth.ai/docs/models/glm-5.3#run-glm-5.3-in-llama.cpp) 和 [Unsloth Desktop](#run-glm-5.3-flash-in-unsloth)中运行 GLM-5.3。我们将使用 239GB [`UD-IQ2_M`](https://huggingface.co/unsloth/GLM-5.3-GGUF/tree/main/UD-IQ2_M) 量化版本，以在可访问性和准确性之间取得最佳平衡。

### 🦥 在 Unsloth 中运行 GLM-5.3

GLM-5.3 现在可以在 [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%2FYVcpYHcS7vpnYcZUiwpO%2Fglm52%20example.png?alt=media&amp;token=d218ed4e-5102-48a6-943a-7d6b7a10446f" 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 %}

#### 搜索并下载 GLM-5.3

前往 [Unsloth Chat](/docs/zh/xin/studio/chat.md) 或 Model hub，在搜索栏中搜索 GLM-5.3，然后下载你想要的模型和量化版本。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fpcug1oswnDUemsv08ffL%2FScreenshot%202026-08-28%20at%209.45.17%E2%80%AFAM.png?alt=media&amp;token=716b05f9-b0e9-4433-a592-6f9fdcec13a3" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### 运行 GLM-5.3

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

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

{% step %}

#### 通过 Unsloth API 提供 GLM-5.3 服务

你可以使用 `unsloth run` 命令，并使用 `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/GLM-5.3-GGUF:UD-IQ2_M
```

{% endcode %}
{% endstep %}

{% step %}

#### Unsloth 现在已准备就绪

你还可以通过 Unsloth Desktop 使用 GLM-5.3 做许多其他事情，例如：

* **连接工具：** [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%2FhxlaXPPPrWDFXhdkSdck%2FScreenshot%202026-08-27%20at%2011.59.01%E2%80%AFPM.png?alt=media&amp;token=a2ef8037-b657-473d-83e6-a5f5f22208ff" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### 🦙 在 llama.cpp 中运行 GLM-5.3

在本指南中，我们将运行 `UD-IQ2_M` 量化版本，该版本至少需要 245GB RAM。你可以自由更改量化类型。在这些教程中，我们将使用 [llama.cpp](https://https/github.com/ggml-org/llama.cpp) 以实现快速本地推理。GGUF： [**GLM-5.3-GGUF**](https://huggingface.co/unsloth/GLM-5.3-GGUF)&#x20;

{% 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`一样。首先，选择你想要的量化类型，例如 `UD-IQ2_M`。同时使用 `export LLAMA_CACHE="unsloth/GLM-5.3-GGUF"` 以强制 `llama.cpp` 将其保存到特定位置。 **注意，这个下载过程可能会非常慢**，因此最好使用下一节中的手动下载方法。

```bash
export LLAMA_CACHE="unsloth/GLM-5.3-GGUF"
./llama.cpp/llama-cli \\
    -hf unsloth/GLM-5.3-GGUF:UD-IQ2_M \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --min-p 0.01
```

{% endstep %}

{% step %}
如果你想手动下载模型 **（快得多！）**，我们可以通过下面的代码下载模型（在安装 `pip install huggingface_hub`之后）。如果下载卡住，请参见： [Hugging Face Hub、XET 调试](/docs/zh/ji-chu/troubleshooting-and-faqs/hugging-face-hub-xet-debugging.md)

```bash
hf download unsloth/GLM-5.3-GGUF \\
    --local-dir unsloth/GLM-5.3-GGUF \\
    --include "*UD-IQ2_M*" # 使用 "*UD-Q8_K_XL*" 可获得接近全精度
```

如果你想使用动态 1-bit，请执行：

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

```bash
hf download unsloth/GLM-5.3-GGUF \\
    --local-dir unsloth/GLM-5.3-GGUF \\
    --include "*UD-IQ1_S*"
```

{% endcode %}
{% endstep %}

{% step %}
然后以对话模式运行该模型。使用 `unsloth/GLM-5.3-GGUF/UD-IQ2_M/GLM-5.3-UD-IQ2_M-00001-of-00006.gguf` 用于 2bit，或 `unsloth/GLM-5.3-GGUF/UD-IQ1_S/GLM-5.3-UD-IQ1_S-00001-of-00006.gguf`  用于 1bit。

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \\
    --model unsloth/GLM-5.3-GGUF/UD-IQ2_M/GLM-5.3-UD-IQ2_M-00001-of-00006.gguf \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --min-p 0.01
```

{% endcode %}
{% endstep %}

{% step %}
与 GLM-5.2 类似，当你启动 llama-cli 时，你会看到：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FUalNNvFxH613C9kcM3r4%2Fimage.png?alt=media&amp;token=f376e93d-26af-472f-8ea3-0968b57b004c" alt="" width="375"><figcaption></figcaption></figure>

然后在提示之后，我们用 `UD-IQ1_S` 做了一个很酷的小贪吃蛇游戏，因此是 1-bit，并且与 GLM-5.3 配合得很好！

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FDmysmr1aSotb5nIbLou5%2Fglm53-ezgif.com-video-to-gif-converter.gif?alt=media&amp;token=dff4c0a8-cf4f-43e8-99a0-40430ab8153b" alt="" width="395"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

#### 📐通过 KV Cache 量化实现长上下文

要在 llama.cpp 中使用长上下文，请使用 KV cache 量化来减少内存占用。

目前支持以下 KV cache 数据类型： `f32`, `f16`, `bf16`, `q8_0`, `q4_0`, `q4_1`, `iq4_nl`, `q5_0`，和 `q5_1`。默认情况下 `f16` 使用的是 `q4_1` 每个权重大约使用 5 bit，从而可实现约 **3.2 倍更长的上下文长度**.

```bash
./llama.cpp/llama-cli \\
    --model unsloth/GLM-5.3-GGUF/UD-IQ2_M-/GLM-5.3-UD-IQ2_M-00001-of-00006.gguf \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --min-p 0.01 \\
    --cache-type-k q4_1 \\
    --cache-type-v q4_1 \\
    --jinja \\
    --chat-template-kwargs '{"reasoning_effort":"最大"}'
```

### 量化分析

我们也对上传的量化版本进行了 KLD 测试，结果显示 Q4\_K\_XL 和 Q5\_K\_XL 非常接近基线，因此建议优先选择它们。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F1ClHNDXzzv9r4bLywjEJ%2Fglm53_unsloth_dynamic_ggufs_kld_benchmarks_updated.png?alt=media&amp;token=9e4677e8-df89-4718-acf2-5c14aad393c9" alt=""><figcaption></figcaption></figure>

| 量化           |    GB | top-1 % |   平均 KLD | 99.9% KLD |    PPL |
| ------------ | ----: | ------: | -------: | --------: | -----: |
| UD-IQ1\_S    | 216.7 |   72.56 | 0.687991 |     9.104 | 4.6130 |
| UD-IQ1\_M    | 228.5 |   75.64 | 0.565455 |     8.595 | 4.1410 |
| UD-IQ2\_M    | 238.6 |   78.53 | 0.453992 |     7.717 | 3.7433 |
| UD-Q2\_K\_XL | 253.9 |   80.93 | 0.374219 |     7.076 | 3.5048 |
| UD-IQ3\_XXS  | 281.7 |   84.15 | 0.272796 |     6.252 | 3.2482 |
| UD-Q3\_K\_XL | 343.0 |   88.86 | 0.141406 |     4.127 | 2.9107 |
| UD-IQ4\_XS   | 365.3 |   90.59 | 0.101496 |     3.177 | 2.8460 |
| UD-Q4\_K\_XL | 467.3 |   94.29 | 0.036922 |     1.309 | 2.7006 |
| UD-Q5\_K\_XL | 562.5 |   95.82 | 0.019728 |     0.786 | 2.6842 |
| UD-Q6\_K\_XL | 684.4 |   96.59 | 0.013257 |     0.534 | 2.6771 |

### 📊 基准测试

你可以在下方表格中查看 GLM-5.3 的主要基准提升：

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fm0D8JgqiMhFBvxu1IBfm%2Fglm53bench.jpg?alt=media&amp;token=fe3e5fdf-c5e8-45a2-8a7a-941fdcd5ec6b" alt=""><figcaption></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Ftqb0wwb4uhbrmjB3bOAr%2Fglmcodingper.png?alt=media&amp;token=fc306ac0-a542-4675-b361-ccac23b691a8" alt=""><figcaption></figcaption></figure></div>

| 基准                                      | GLM-5.3   | GLM-5.2 | Kimi K3 | <p>DeepSeek-V4</p><p>Pro-0813</p> | Qwen3.8-Max | Opus 4.8 | <p>Fable 5</p><p>（含回退）</p> | GPT-5.6 Sol |
| --------------------------------------- | --------- | ------- | ------- | --------------------------------- | ----------- | -------- | -------------------------- | ----------- |
| 编程                                      |           |         |         |                                   |             |          |                            |             |
| Terminal Bench 2.1                      | 88.2      | 81.0    | 88.3    | 87.9                              | 86.6        | 85.0     | 88.0                       | 88.8        |
| Terminal Bench 3.0                      | 28.3      | 4.6     | 17.4    | -                                 | -           | 21.1     | 33.7                       | 34.6        |
| <p>DeepSWE</p><p>v1.1</p>               | 66.9      | 46.2    | 67.5    | 62.7                              | 56.6        | 58.0     | 69.7                       | 72.7        |
| NL2Repo                                 | 58.0      | 48.9    | 58.0    | 61.1                              | 55.9        | 69.7     | -                          | -           |
| <p>ProgramBench</p><p>Almost Solved</p> | 19.0      | 9.5     | 17.5    | -                                 | 10.5        | 15.5     | 33.0                       | 23.0        |
| FrontierSWE                             | 78.1      | 67.5    | -       | -                                 | -           | 66.5     | 88.2                       | -           |
| <p>SWE-Marathon</p><p>v1.1</p>          | 42.5      | 19.4    | 48.1    | -                                 | -           | 48.8     | 33.1                       | 42.5        |
| PostTrainBench                          | 39.8      | 31.7    | 32.0    | -                                 | -           | 32.9     | 41.8                       | 36.2        |
| 网络安全                                    |           |         |         |                                   |             |          |                            |             |
| CyberGym                                | 84.5      | 77.2    | 80.0    | 83.3                              | 78.5        | 78.1     | 83.8                       | 83.6        |
| <p>ExploitGym</p><p>2h / 6h</p>         | 105 / 130 | 29 / 39 | 36 / 70 | -                                 | 14 / 26     | 80 / 120 | 181 / 247                  | 216 / 293   |
| ExploitBench                            | 54.4      | 24.4    | 32.2    | -                                 | 28.8        | 40.0     | 78.0                       | 76.5        |
| 智能体                                     |           |         |         |                                   |             |          |                            |             |
| Toolathlon Verified                     | 73.0      | 59.9    | 76.5    | 74.1                              | 72.5        | 76.2     | 74.7                       | 74.9        |
| <p>AutomationBench</p><p>v1.0.6</p>     | 48.2      | 26.2    | 46.7    | 43.2                              | 39.8        | 41.0     | 46.2                       | 45.8        |
| <p>Agents' Last Exam</p><p>ALE-CLI</p>  | 28.5      | 23.8    | 27.6    | 25.7                              | 27.0        | 25.7     | 23.8                       | 28.6        |
| HLE w/ Tools                            | 62.5      | 54.7    | 59.8    | 60.0                              | 56.2        | 57.9     | 63.9                       | 64.5        |
| GDPval-AA v2                            | 1769      | 1508    | 1682    | 1590                              | 1739        | 1588     | 1743                       | 1730        |


---

# 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/glm-5.3.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.
