> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-zh/yu-yan-mo-xing/glm-5-2.md).

# GLM-5.2（MIT，100 万上下文）

在 Clore.ai 市场上的大型多 GPU 机器上运行 GLM-5.2，Z.ai 的 MIT 许可、100 万上下文的代码旗舰模型

{% hint style="info" %}
**状态（2026年8月）：** Z.ai 发布了 **GLM-5.2** 于 **2026年6月13日** 在以下许可证下发布： **MIT 许可证** — 无地区限制，无收入条款。权重： [zai-org/GLM-5.2](https://huggingface.co/zai-org/GLM-5.2) 以及 [zai-org/GLM-5.2-FP8](https://huggingface.co/zai-org/GLM-5.2-FP8)。稀疏注意力 MoE，大约 **总参数约 750B，激活约 40B**，一个 **稳定的 100万 token 上下文**，以及迄今公布的最强开源代码能力分数。
{% endhint %}

GLM-5.1 已经是软件工程领域最值得超越的开源模型。GLM-5.2 将 Terminal-Bench 2.1 从 63.5 提升到 **81.0** 并将 SWE-bench Pro 从 58.4 提升到 **62.1**，而且它采用 MIT 许可证；与此同时，其他前沿模型却转向带有收入门槛的定制条款。

但问题在于体积。FP8 检查点为 **756GB**。这不是单卡模型，而且永远也不会是。它在 Clore.ai 上之所以有意思，是因为量化版本刚好落在市场上最大机器的上限之内。

### 关键规格

| 属性    | 数值                                                   |
| ----- | ---------------------------------------------------- |
| 参数    | 总计约 750B，激活约 40B（MoE）                                |
| 架构    | 78 层，256 个路由专家，每个 token 激活 8 个，IndexShare 稀疏注意力，MTP  |
| 上下文   | 1,000,000 个 token                                    |
| 许可证   | MIT                                                  |
| 发布日期  | 2026年6月13日                                           |
| 权重    | FP8 756GB · Q2\_K\_XL GGUF 254GB · IQ1\_S GGUF 217GB |
| 主要工具链 | SGLang ≥ 0.5.13.post1，vLLM ≥ 0.23.0，llama.cpp        |

### 相较于 GLM-5.1 的新变化

* **扎实的 100万上下文** — 这不是一个标题党式的数字，而是一个在长程任务中也经得起考验的上下文窗口
* **IndexShare** — 每四层稀疏注意力复用一个索引器，将每个 token 的 FLOPs 降低 **在 100万上下文下达到 2.9×**
* **更好的 MTP** — 推测解码的接受长度最多提升 20%
* **可灵活调整的思考强度** — 在每个请求中权衡延迟与推理深度
* **仍然是 MIT** — 权重不附带任何使用限制

***

## 需求

{% hint style="warning" %}
**这个模型需要整机，不是单卡。** 756GB 的 FP8 超过 Clore.ai 市场上的所有机器。列表中最大的机器是 4× RTX PRO 6000 Blackwell（380GB）和 10–11× RTX 5090（310–341GB）。在这里，只有量化 GGUF 是可行路径；全精度推理适合放在 [裸机](https://clore.ai/bare-metal).
{% endhint %}

| 构建版本         | 大小    | 在 Clore.ai 上可运行的平台                          |
| ------------ | ----- | ------------------------------------------- |
| `UD-IQ1_S`   | 217GB | 8× RTX 5090（248GB）— 列出有 ≥242GB 的服务器 47 台    |
| `UD-IQ2_M`   | 239GB | 8× RTX 5090，勉强够用                            |
| `UD-Q2_K_XL` | 254GB | 10× RTX 5090（310GB）或 4× RTX PRO 6000（380GB） |
| `UD-Q3_K_M`  | 343GB | 仅 4× RTX PRO 6000（380GB）—— 列出了 2 台这样的服务器    |
| `UD-IQ4_XS`  | 365GB | 4× RTX PRO 6000，没有余量                        |
| 官方 FP8       | 756GB | 不在市场上 → [裸机](https://clore.ai/bare-metal)   |

在工作上下文长度下，为 KV 缓存和激活在权重大小基础上再预留 10–15%，并检查系统内存：这些机器在加载时需要足够内存暂存权重。

***

## 在多 GPU 机器上使用 llama.cpp 部署

在市场硬件上可行的路径。租一台 10× RTX 5090 机器（大约 **5.00 美元/小时** 在上次快照时）并把模型分配到所有显卡上：

```bash
# 约 254GB — 给机器留一些余量
huggingface-cli download unsloth/GLM-5.2-GGUF \\
  --include "*UD-Q2_K_XL*" --local-dir /workspace/glm52

llama-server -m /workspace/glm52/*UD-Q2_K_XL*-00001-of-*.gguf \\
  --host 0.0.0.0 --port 8080 \\
  -ngl 999 --split-mode layer \\
  -c 131072 --flash-attn \\
  --no-mmap
```

{% hint style="info" %}
`--no-mmap` 在租用硬件上这很重要：权重会新鲜拉取到一个你不会保留的磁盘上，而在慢盘上对一个 254GB 文件进行 mmap 会把首 token 延迟拖到几分钟。仅下载本身就要预留 30–60 分钟，并选择带宽快的服务器。
{% endhint %}

## 使用 vLLM 或 SGLang 部署（FP8，专用硬件）

如果你有相应资源——裸机或自有集群——Z.ai 直接支持这两种引擎：

```bash
# vLLM >= 0.23.0
vllm serve zai-org/GLM-5.2-FP8 \\
  --tensor-parallel-size 8 \\
  --max-model-len 1000000 \\
  --enable-expert-parallel \\
  --gpu-memory-utilization 0.92

# SGLang >= 0.5.13.post1
python3 -m sglang.launch_server \\
  --model-path zai-org/GLM-5.2-FP8 \\
  --tp 8 --context-length 1000000 \\
  --speculative-algorithm EAGLE
```

适用于其他栈的现成量化检查点： [`nvidia/GLM-5.2-NVFP4`](https://huggingface.co/nvidia/GLM-5.2-NVFP4) 适用于 Blackwell， [`cyankiwi/GLM-5.2-AWQ-INT4`](https://huggingface.co/cyankiwi/GLM-5.2-AWQ-INT4) 适用于 AWQ 栈， [`amd/GLM-5.2-MXFP4`](https://huggingface.co/amd/GLM-5.2-MXFP4) 适用于 Instinct。

***

## Clore.ai GPU 推荐

| 配置                        | 总显存       | 构建版本                 | Clore.ai 成本                       |
| ------------------------- | --------- | -------------------- | --------------------------------- |
| 8× RTX 5090               | 248GB     | IQ1\_S / IQ2\_M      | 约 2.00–3.50 美元/小时                 |
| **10× RTX 5090**          | **310GB** | **Q2\_K\_XL**        | **约 5.00 美元/小时**                  |
| 4× RTX PRO 6000 Blackwell | 380GB     | Q2\_K\_XL 或 Q3\_K\_M | 约 5.00 美元/小时                      |
| 专用 8× H200                | 1,128GB   | FP8，完整 100万上下文       | [裸机](https://clore.ai/bare-metal) |

这种规模的机器任何时刻都只有寥寥几台——≥242GB 的服务器有 47 台，其中 9 台在上次快照时为空闲。在把计划建立在这类机器上之前，先检查市场。

***

## 基准

来自 Z.ai 自家的模型卡（2026年6月13日）。代码评测套件已有独立复现；推理分数请视为厂商报告。

| 基准                             | GLM-5.2  | GLM-5.1 | DeepSeek-V4-Pro（预览版） | MiniMax M3 |
| ------------------------------ | -------- | ------- | -------------------- | ---------- |
| Terminal-Bench 2.1（Terminus-2） | **81.0** | 63.5    | 64                   | 65         |
| Terminal-Bench 2.1（最佳评测框架）     | **82.7** | 69      | —                    | —          |
| SWE-bench Pro                  | **62.1** | 58.4    | 55.4                 | 59         |
| NL2Repo                        | **48.9** | 42.7    | 35.5                 | 42.1       |
| DeepSWE                        | **46.2** | 18      | 8                    | 20         |
| HLE                            | 40.5     | 31      | 37.7                 | 37         |
| AIME 2026                      | 99.2     | 95.3    | 94.6                 | —          |
| GPQA-Diamond                   | 91.2     | 86.2    | 90.1                 | 93         |

***

## 应用场景

* **自主编码代理** — Terminal-Bench 和 DeepSWE 的提升正是代理所需的长程行为
* **整仓库推理** — 100万上下文配合稀疏注意力，在长上下文下依然可负担
* **迁移与重构工作** — NL2Repo 衡量的是根据规格构建仓库的能力，而 GLM-5.2 在开源阵营领先
* **闭源前沿 API 的自托管替代方案** — MIT 许可意味着你可以把它集成到产品中发布
* **批量评测框架** — 按分钟租一台大机器，跑完批量测试，关闭订单

***

## 故障排查

| 问题             | 修复                                                                                |
| -------------- | --------------------------------------------------------------------------------- |
| 下载要很久          | Q2 版本下有 254GB——在市场中筛选高带宽服务器并使用 `--include` 仅下载一个量化版本                              |
| OOM 跨 GPU 分摊   | `--split-mode layer` 在 llama.cpp 中；在 vLLM 中提高 `--tensor-parallel-size` 到全部 GPU 数量 |
| 首个 token 需要几分钟 | 去掉 `--mmap`，把模型保存在本地 NVMe 上，并用一个短提示词预热                                            |
| vLLM 拒绝该配置     | 需要 ≥ 0.23.0；SGLang 需要 ≥ 0.5.13.post1                                              |
| 在 IQ1 下质量感觉不对劲 | 这是一个 750B 模型的 1 比特版本。如果机器允许，升级到 Q2\_K\_XL 或更高。                                    |
| 下载中途机器消失       | 被别人租走了。长时间搭建工作请使用按需实例而不是抢占式实例                                                     |

***

## 下一步

* **前代：** [GLM-5.1](/guides/guides_v2-zh/yu-yan-mo-xing/glm-5-1.md) — 4 月发布的 744B 版本
* **反而能装进一张卡：** [Qwen3.8-27B](/guides/guides_v2-zh/yu-yan-mo-xing/qwen38-27b.md) — Apache 2.0 许可，Q4 时为 15GB
* **同一量级：** [MiniMax M3](/guides/guides_v2-zh/yu-yan-mo-xing/minimax-m3.md) · [Nemotron 3 Ultra](/guides/guides_v2-zh/yu-yan-mo-xing/nemotron-3-ultra.md) · [DeepSeek V4](/guides/guides_v2-zh/yu-yan-mo-xing/deepseek-v4.md)
* **设备规格：** [GPU 价格与可用性](/guides/guides_v2-zh/ru-men-zhi-nan/pricing.md) · [多 GPU 设置](/guides/guides_v2-zh/gao-ji/multi-gpu-setup.md)

### 链接

* [Hugging Face 上的 GLM-5.2](https://huggingface.co/zai-org/GLM-5.2) · [FP8](https://huggingface.co/zai-org/GLM-5.2-FP8) · [GGUF](https://huggingface.co/unsloth/GLM-5.2-GGUF)
* [Z.ai 博客](https://z.ai/blog/glm-5.2) · [GLM-5 GitHub](https://github.com/zai-org/GLM-5)
* [vLLM 配置示例](https://recipes.vllm.ai/zai-org/GLM-5.2) · [SGLang 代码示例](https://cookbook.sglang.io/autoregressive/GLM/GLM-5.2)
* **租用 GPU：** [RTX 5090](https://clore.ai/rent-5090.html) · [市场](https://clore.ai/marketplace) · [裸机](https://clore.ai/bare-metal)


---

# 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://docs.clore.ai/guides/guides_v2-zh/yu-yan-mo-xing/glm-5-2.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.
