> 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-1.md).

# GLM-5.1（744B MoE，SWE-Bench Pro 第一）

{% hint style="info" %}
**状态（2026年4月）：** GLM-5.1 发布于 **2026年4月7日** 由 Z.ai（前身为 Zhipu AI）发布，作为对 [GLM-5](/guides/guides_v2-zh/yu-yan-mo-xing/glm5.md)。它是首个登顶 **SWE-Bench Pro（58.4%）**，根据厂商公布的数据，略胜 GPT-5.4（57.7）和 Claude Opus 4.6（57.3）。权重可在 [huggingface.co/zai-org/GLM-5.1](https://huggingface.co/zai-org/GLM-5.1) 在以下许可证下发布： **MIT 许可证**.
{% endhint %}

GLM-5.1 是一个 **7440亿参数的混合专家（MoE）** 语言模型，每个 token 仅激活 **每个 token 约 40B 参数**。与其前代相比 [GLM-5](/guides/guides_v2-zh/yu-yan-mo-xing/glm5.md)，5.1 版本保留了相同的 MoE 骨架，但带来了更精细的专家路由、 **20万 token 上下文窗口**，一个 **13.1万 token 最大输出**，并且训练重点放在 **长周期智能体编码** —— 模型经过明确调优，能够在不漂移的情况下持续进行数千次工具调用和数百轮重构。

对于 Clore.ai 用户来说，最有意思的是 **40B 激活** 这个数字：你不需要一整套 8×H200 机架就能部署它。跨 **2×H100 80GB** (FP8) 或 **4×A100 80GB** （BF16 并行切分）进行张量并行就足以获得实用吞吐量——这让前沿级编码能力在市场上也触手可及。 [裸机](https://clore.ai/bare-metal) 在市场上。

### 关键规格

| 属性    | 数值                                             |
| ----- | ---------------------------------------------- |
| 总参数   | 744B（MoE）                                      |
| 激活参数  | 每次前向传播约 40B                                    |
| 上下文窗口 | 20万 token                                      |
| 最大输出  | 131,072 token                                  |
| 许可证   | MIT                                            |
| 发布日期  | 2026年4月7日                                      |
| 组织    | Z.ai（HuggingFace 上的 zai-org）                   |
| 主要工具链 | vLLM、SGLang、llama.cpp（GGUF）、xLLM、KTransformers |

### 为什么选择 GLM-5.1？

* **SWE-Bench Pro 排名第一** —— 厂商宣称 58.4%，领先 GPT-5.4 和 Claude Opus 4.6
* **长周期智能体** —— 在数百轮和数千次工具调用中持续进行优化
* **20万上下文** —— 足以容纳整个中型代码库加测试套件
* **40B 激活 MoE** —— 你支付的是 40B 稠密模型的推理成本，而不是 744B 的
* **MIT 许可证** —— 完全开源权重，商业使用或微调均无限制
* **开放训练栈** —— Z.ai 发布了该模型，据称训练时未使用 Nvidia 数据中心 GPU

***

## 需求

{% hint style="warning" %}
**Clore.ai 市场上未列出多 GPU 的 80GB 级机型。** 目前列出的最大配置是 4× RTX PRO 6000 Blackwell（每张 96GB，共 380GB）以及 8–11× RTX 5090（每张 32GB）。A100 / H200 / B200 容量可按 [裸机](https://clore.ai/bare-metal) 需求提供。部署前请查看 [GPU 价格与可用性](/guides/guides_v2-zh/ru-men-zhi-nan/pricing.md) 。
{% endhint %}

{% hint style="warning" %}
**仍然是个大模型。** 虽然“40B 激活”听起来很友好，但完整的 744B 权重必须加载到 VRAM 中（或卸载到别处）。FP8 权重约 860GB；BF16 约 1.5TB。请据此规划。
{% endhint %}

| 组件     | 最低配置（Q4 GGUF，offload） | 推荐（FP8）               | 完整 BF16       |
| ------ | --------------------- | --------------------- | ------------- |
| GPU 显存 | 约 80GB（Q4 + RAM 卸载）   | 2× H100 80GB 在用，8× 总计 | 8× H200 141GB |
| 内存     | 256GB                 | 256GB                 | 512GB         |
| 磁盘     | 500GB NVMe            | 1TB NVMe              | 2TB NVMe      |
| CUDA   | 12.8+                 | 12.8+                 | 12.8+         |

**Clore.ai 选择：** 对于大多数团队来说，使用激进卸载的 2× H100 80GB 跑 FP8 检查点是最优选择（约 2.08 美元/小时）。如果你需要完整 BF16 吞吐量，就升级到 8× H200，或者在偶尔调用时使用 Z.ai API。

***

## 方案 A —— Ollama / GGUF（量化版，社区构建）

{% hint style="warning" %}
**提醒：** 社区 GGUF 量化版本通常会在 Z.ai 发布后 1–2 周出现。如果 `ollama pull` 失败，请检查 [huggingface.co/models?search=glm-5.1+gguf](https://huggingface.co/models?search=glm-5.1+gguf) ，并将 llama.cpp 直接指向该文件。
{% endhint %}

```bash
# 一旦 Q4_K_M 构建版本可用
docker exec ollama ollama pull glm-5.1:q4_K_M
docker exec ollama ollama run glm-5.1:q4_K_M

# 或直接用 llama.cpp 运行 GGUF 文件
docker run --gpus all -it --rm -p 8080:8080 \
  -v $(pwd)/models:/models \
  ghcr.io/ggerganov/llama.cpp:server-cuda \
  -m /models/glm-5.1-q4_k_m.gguf \\
  --n-gpu-layers 80 --ctx-size 32768 \\
  --port 8080 --host 0.0.0.0
```

***

## 选项 B —— vLLM（生产 API，推荐）

vLLM 是 Z.ai 的一线服务目标。FP8 检查点（`zai-org/GLM-5.1-FP8`）就是你要的——质量与 BF16 相同，内存占用大约减半。

```yaml
version: "3.8"
services:
  vllm:
    image: vllm/vllm-openai:latest
    ports:
      - "8000:8000"
    volumes:
      - hf_cache:/root/.cache/huggingface
    command: >
      --model zai-org/GLM-5.1-FP8
      --tensor-parallel-size 8
      --max-model-len 65536
      --gpu-memory-utilization 0.88
      --tool-call-parser glm47
      --reasoning-parser glm45
      --enable-auto-tool-choice
      --served-model-name glm-5.1
      --trust-remote-code
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    shm_size: "16gb"

volumes:
  hf_cache:
```

```bash
# 测试 API
curl http://localhost:8000/v1/chat/completions \\
  -H "Content-Type: application/json" \\
  -d '{
    "model": "glm-5.1",
    "messages": [
      {"role": "system", "content": "你是一名高级软件工程师。"},
      {"role": "user", "content": "重构这个 Go 处理程序，使其正确使用 context.Context，并添加重试。"}
    ],
    "max_tokens": 4096,
    "temperature": 1.0
  }'
```

{% hint style="info" %}
使用 `--tensor-parallel-size 2` 如果 GPU 数量吃紧，可在 2× H100 上运行，但要为 200K 上下文的更慢预填充做好准备。 `--enable-chunked-prefill` 帮助很大。
{% endhint %}

***

## 选项 C —— SGLang（替代方案，通常在 Hopper 上更快）

```bash
docker pull lmsysorg/sglang:latest

python3 -m sglang.launch_server \\
  --model-path zai-org/GLM-5.1-FP8 \\
  --tp-size 8 \\
  --tool-call-parser glm47 \\
  --reasoning-parser glm45 \\
  --speculative-algorithm EAGLE \\
  --speculative-num-steps 3 \\
  --speculative-eagle-topk 1 \\
  --speculative-num-draft-tokens 4 \\
  --mem-fraction-static 0.88 \\
  --context-length 65536 \\
  --served-model-name glm-5.1
```

SGLang 的 EAGLE 投机解码通常能让长编码补全的吞吐量提升 1.5–2 倍。

***

## Clore.ai GPU 推荐

| 配置            | 显存      | 预期性能                   | Clore.ai 成本                       |
| ------------- | ------- | ---------------------- | --------------------------------- |
| 2× H100 80GB  | 160GB   | 带卸载的 FP8，约 15–25 tok/s | 约 $2.08/小时                        |
| 4× A100 80GB  | 320GB   | 分片 BF16，约 20–30 tok/s  | [裸机](https://clore.ai/bare-metal) |
| 8× H100 80GB  | 640GB   | 完整 FP8，约 60+ tok/s     | 约 $8.32/小时                        |
| 8× H200 141GB | 1,128GB | 完整 BF16，最大吞吐量          | [裸机](https://clore.ai/bare-metal) |

{% hint style="success" %}
**最佳性价比：** 使用 FP8 检查点的 2× H100 80GB。你能以大致相当于 Claude Opus 订阅价格的成本，获得前沿级编码性能——而且权重留在你自己的机器上。
{% endhint %}

***

## 应用场景

* **自治 SWE 智能体** —— GLM-5.1 经过明确训练，适用于长时间工具调用循环；可将其与 SWE-agent 或 OpenHands 之类的工具搭配使用
* **代码库理解** —— 将 10 万+ token 的 Go/Rust/Python 放入上下文，并请求架构评审
* **长上下文 RAG** —— 20 万上下文可一次性处理整个产品文档 + 支持工单
* **重构流水线** —— 在数百次文件编辑中保持持续正确性
* **智能体编排** —— 用 GLM-5.1 作为规划器，较小的模型（Qwen3.5-35B、GLM-4.7）作为执行者

***

## 基准

{% hint style="warning" %}
**这是厂商声称——请独立核实。** 以下数字来自 Z.ai 于 2026 年 4 月 7 日的公告。SWE-Bench Pro 上的独立复现结果仍在陆续出现。
{% endhint %}

| 基准                 | GLM-5.1   | GPT-5.4 | Claude Opus 4.6 | GLM-5 |
| ------------------ | --------- | ------- | --------------- | ----- |
| SWE-Bench Pro      | **58.4%** | 57.7%   | 57.3%           | \~52% |
| SWE-Bench Verified | \~79%     | \~78%   | \~80%           | 77.8% |
| HumanEval          | \~94%     | \~95%   | \~94%           | \~93% |
| LiveCodeBench      | \~72%     | \~73%   | \~70%           | \~68% |

***

## 故障排查

| 问题                     | 解决方案                                                                                                   |
| ---------------------- | ------------------------------------------------------------------------------------------------------ |
| `OutOfMemoryError` 加载时 | FP8 检查点总共需要约 860GB VRAM。请使用 8× H100/H200，或者降级到带 RAM 卸载的 GGUF Q4。                                       |
| HuggingFace 下载很慢       | 使用 `huggingface-cli download zai-org/GLM-5.1-FP8 --local-dir ./weights --resume-download`。预计需要 800GB+。 |
| 工具调用被静默丢弃              | 确保 `--tool-call-parser glm47` 以及 `--enable-auto-tool-choice` 都在 vLLM 中设置。                              |
| 思考模式为空                 | 需要 `temperature=1.0` —— 零温度采样会破坏推理轨迹。                                                                  |
| vLLM 拒绝该配置             | GLM-5.1 需要 vLLM ≥ 0.7.x（2026 年 4 月版本）。如果你使用的是旧版本，请用 `pip install -U vllm --pre` 。                      |
| 200K 上下文 OOM           | 从 `--max-model-len 65536` 并添加 `--enable-chunked-prefill`；稳定后再提高。                                       |

***

## 下一步

* **前代：** [GLM-5](/guides/guides_v2-zh/yu-yan-mo-xing/glm5.md) —— 相同的 MoE 形态，但更少侧重编码
* **更便宜的替代方案：** [Qwen3.5](/guides/guides_v2-zh/yu-yan-mo-xing/qwen35.md) —— 35B 稠密模型可在单张 RTX 4090 上运行
* **超大上下文替代方案：** [DeepSeek V4](/guides/guides_v2-zh/yu-yan-mo-xing/deepseek-v4.md) —— 100万上下文，多模态，约 1T 参数
* **Clore.ai 市场：** [clore.ai/marketplace](https://clore.ai/marketplace) —— 从……租用 H100/H200/A100 [裸机](https://clore.ai/bare-metal)

### 链接

* [HuggingFace 上的 GLM-5.1](https://huggingface.co/zai-org/GLM-5.1)
* [Z.ai 博客 —— GLM-5.1 公告](https://z.ai/blog/glm-5.1)
* [Z.ai 平台（托管 API）](https://chat.z.ai)
* [vLLM 文档](https://docs.vllm.ai)
* [SGLang 仓库](https://github.com/sgl-project/sglang)


---

# 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-1.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.
