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

# GLM-5：如何本地运行指南

在你自己的本地设备上运行 Z.ai 的新 GLM-5 模型！

GLM-5 是 Z.ai 最新的推理模型，在编码、智能体和对话性能上均强于 [GLM-4.7](/docs/zh/mo-xing/tutorials/glm-4.7.md)，并且专为长上下文推理而设计。它在 Humanity's Last Exam 上将性能提升至 50.4%（+7.6%）、BrowseComp 75.9%（+8.4%）以及 Terminal-Bench-2.0 61.1%（+28.3%）。

完整的 744B 参数（40B 激活）模型具有 **200K 上下文** 窗口，并在 28.5T 个 token 上进行了预训练。完整的 GLM-5 模型需要 **1.65TB** 的磁盘空间，而 Unsloth Dynamic 2-bit GGUF 将大小缩减到 **241GB** **(-85%)**，以及动态 **1-bit 为 176GB（-89%）：** [**GLM-5-GGUF**](https://huggingface.co/unsloth/GLM-5-GGUF)

所有上传都使用 Unsloth [Dynamic 2.0](/docs/zh/ji-chu-zhi-shi/dynamic-3.0-ggufs.md) 以获得最先进的量化性能——因此 1-bit 将重要层上转为 8 位或 16 位。感谢 Z.ai 为 Unsloth 提供首发日访问权限。

### :gear: 使用指南

2-bit 动态量化 UD-IQ2\_XXS 使用 **241GB** 的磁盘空间——这可以直接放在一台 **256GB 统一内存的 Mac**，并且在 **1x24GB 显卡和 256GB 内存** 配合 MoE 卸载也能良好运行。该 **1-bit** 量化版本可放入 180GB 内存，而 8-bit 需要 805GB 内存。

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

### 推荐设置

针对不同用例使用不同设置：

| 默认设置（大多数任务）                | SWE Bench Verified         |
| -------------------------- | -------------------------- |
| temperature = 1.0          | temperature = 0.7          |
| top\_p = 0.95              | top\_p = 1.0               |
| max new tokens = 131072    | max new tokens = 16384     |
| repeat penalty = 已禁用 或 1.0 | repeat penalty = 已禁用 或 1.0 |

* `Min_P = 0.01` （llama.cpp 的默认值为 0.05）
* **最大上下文窗口：** `202,752`.
* 对于多轮智能体任务（τ²-Bench 和 Terminal Bench 2），请开启保留\
  思考模式。

## 运行 GLM-5 教程：

#### ✨ 在 llama.cpp 中运行

{% 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` 直接加载模型，你可以使用下面的方法：(:IQ2\_XXS) 是量化类型。你也可以通过 Hugging Face 下载（见第 3 点）。这类似于 `ollama run` 。使用 `export LLAMA_CACHE="folder"` 来强制 `llama.cpp` 保存到指定位置。请记住，该模型的最大上下文长度只有 200K。

以下内容适用于 **通用说明** 使用场景：

```bash
export LLAMA_CACHE="unsloth/GLM-5-GGUF"
./llama.cpp/llama-cli \\
    -hf unsloth/GLM-5-GGUF:UD-IQ2_XXS \\
    --ctx-size 16384 \
    --flash-attn on \\
    --temp 0.7 \\
    --top-p 1.0 \\
    --min-p 0.01
```

以下内容适用于 **工具调用** 使用场景：

```bash
export LLAMA_CACHE="unsloth/GLM-5-GGUF"
./llama.cpp/llama-cli \\
    -hf unsloth/GLM-5-GGUF:UD-IQ2_XXS \\
    --ctx-size 16384 \
    --flash-attn on \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --min-p 0.01
```

{% endstep %}

{% step %}
通过以下方式下载模型（在安装 `pip install huggingface_hub hf_transfer` 之后）。你可以选择 `UD-Q2_K_XL` （动态 2bit 量化）或其他量化版本，例如 `UD-Q4_K_XL` . 我们 <mark style="background-color:green;">**推荐使用我们的 2bit 动态量化**</mark><mark style="background-color:green;">**&#x20;**</mark><mark style="background-color:green;">**`UD-Q2_K_XL`**</mark><mark style="background-color:green;">**&#x20;**</mark><mark style="background-color:green;">**以平衡体积和准确率**</mark>。如果下载卡住，请查看 [Hugging Face Hub、XET 调试](/docs/zh/ji-chu-zhi-shi/troubleshooting-and-faqs/hugging-face-hub-xet-debugging.md)

```bash
pip install -U huggingface_hub
hf download unsloth/GLM-5-GGUF \\
    --local-dir unsloth/GLM-5-GGUF \\
    --include "*UD-IQ2_XXS*" # 动态 1bit 请使用 "*UD-TQ1_0*"
```

{% endstep %}

{% step %}
你可以修改 `--threads 32` CPU 线程数， `--ctx-size 16384` 用于上下文长度， `--n-gpu-layers 2` 用于 GPU 卸载的层数。如果你的 GPU 显存不足，请尝试调整它。如果你只使用 CPU 推理，也请将其移除。

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \\
    --model unsloth/GLM-5-GGUF/UD-IQ2_XXS/GLM-5-UD-IQ2_XXS-00001-of-00006.gguf \\
    --temp 1.0 \\
    --top-p 0.95 \\
    --min-p 0.01 \
    --ctx-size 16384 \
    --seed 3407
```

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

### 🦙 Llama-server 服务与 OpenAI 的补全库

要将 GLM-5 部署到生产环境，我们使用 `llama-server` 在新的终端中，例如通过 tmux，使用以下方式部署模型：

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-server \\
    --model unsloth/GLM-5-GGUF/UD-IQ2_XXS/GLM-5-UD-IQ2_XXS-00001-of-00006.gguf \\
    --alias "unsloth/GLM-5" \\
    --prio 3 \
    --temp 1.0 \\
    --top-p 0.95 \\
    --ctx-size 16384 \
    --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/GLM-5",
    messages = [{"role": "user", "content": "创建一个贪吃蛇游戏。"},],
)
print(completion.choices[0].message.content)
```

{% endcode %}

你将得到以下贪吃蛇游戏示例：

{% columns %}
{% column width="58.333333333333336%" %}
{% code expandable="true" %}

````markdown
这里是一个完整、可玩的贪吃蛇游戏，包含在单个 HTML 文件中。你可以复制这段代码，将其保存为 `.html` 文件（例如 `snake.html`），然后在浏览器中打开即可游玩。

### 代码

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>经典贪吃蛇游戏</title>
    <style>
        body {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #222;
            color: white;
            font-family: Arial, sans-serif;
        }

        #gameCanvas {
            border: 2px solid #fff;
            background-color: #000;
        }

        h1 {
            margin-bottom: 10px;
        }

        #scoreBoard {
            font-size: 20px;
            margin-bottom: 10px;
        }

        #gameOverMenu {
            position: absolute;
            display: none;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: rgba(0, 0, 0, 0.85);
            padding: 20px;
            border-radius: 10px;
            border: 2px solid red;
        }

        button {
            margin-top: 15px;
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
        }
        
        button:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>

    <h1>贪吃蛇游戏</h1>
    <div id="scoreBoard">得分：0</div>
    <canvas id="gameCanvas" width="400" height="400"></canvas>

    <div id="gameOverMenu">
        <h2 style="color: red; margin: 0;">游戏结束！</h2>
        <p id="finalScore">最终得分：0</p>
        <button onclick="resetGame()">再玩一次</button>
    </div>

    <script>
        // 游戏常量
        const canvas = document.getElementById('gameCanvas');
        const ctx = canvas.getContext('2d');
        const scoreBoard = document.getElementById('scoreBoard');
        const gameOverMenu = document.getElementById('gameOverMenu');
        const finalScoreDisplay = document.getElementById('finalScore');

        const gridSize = 20; // 每个方块的大小
        const tileCount = canvas.width / gridSize; // 每行/每列的方块数

        // 游戏变量
        let dx = 0; // 水平速度
        let dy = 0; // 垂直速度
        let score = 0;
        let snake = [];
        let foodX, foodY;
        let gameInterval;
        let isGameRunning = false;

        // 初始化游戏
        function initGame() {
            snake = [
                {x: 10, y: 10}, 
                {x: 9, y: 10}, 
                {x: 8, y: 10}
            ];
            score = 0;
            scoreBoard.innerText = '得分：' + score;
            dx = 1; // 立即开始向右移动
            dy = 0;
            placeFood();
            isGameRunning = true;
            gameOverMenu.style.display = 'none';
            
            // 开始游戏循环
            if (gameInterval) clearInterval(gameInterval);
            gameInterval = setInterval(gameLoop, 100); // 每 100ms 运行一次游戏循环
        }

        // 主游戏循环
        function gameLoop() {
            if (!isGameRunning) return;

            moveSnake();
            if (checkGameOver()) {
                endGame();
                return;
            }
            checkFoodCollision();
            draw();
        }

        // 移动蛇
        function moveSnake() {
            // 根据当前方向创建新的蛇头
            const head = {x: snake[0].x + dx, y: snake[0].y + dy};
            
            // 将新蛇头添加到数组开头
            snake.unshift(head);

            // 除非吃到食物，否则移除尾巴（最后一个元素）
            // 注意：我们在 checkFoodCollision 中处理移除尾巴
            snake.pop(); 
        }

        // 检查蛇是否吃到食物
        function checkFoodCollision() {
            const head = snake[0];
            
            if (head.x === foodX && head.y === foodY) {
                // 让蛇变长：添加一个尾部片段（复制最后一个）
                snake.push({...snake[snake.length - 1]});
                score += 10;
                scoreBoard.innerText = '得分：' + score;
                placeFood();
            }
        }

        // 检查碰撞（墙壁或自身）
        function checkGameOver() {
            const head = snake[0];

            // 墙壁碰撞
            if (head.x < 0 || head.x >= tileCount || head.y < 0 || head.y >= tileCount) {
                return true;
            }

            // 自身碰撞（从第 4 个片段开始检查，因为蛇头不可能撞到前 3 段）
            for (let i = 4; i < snake.length; i++) {
                if (head.x === snake[i].x && head.y === snake[i].y) {
                    return true;
                }
            }

            return false;
        }

        // 绘制所有内容
        function draw() {
            // 清空画布
            ctx.fillStyle = 'black';
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            // 绘制食物
            ctx.fillStyle = 'red';
            ctx.fillRect(foodX * gridSize, foodY * gridSize, gridSize - 2, gridSize - 2);

            // 绘制蛇
            ctx.fillStyle = 'lime';
            for (let i = 0; i < snake.length; i++) {
                // 蛇头可以稍微不同，或者保持默认样式
                const part = snake[i];
                ctx.fillRect(part.x * gridSize, part.y * gridSize, gridSize - 2, gridSize - 2);
            }
        }

        // 在随机位置放置食物
        function placeFood() {
            foodX = Math.floor(Math.random() * tileCount);
            foodY = Math.floor(Math.random() * tileCount);

            // 确保食物不会生成在蛇身上
            for (let part of snake) {
                if (part.x === foodX && part.y === foodY) {
                    placeFood(); // 递归查找新位置
                    return;
                }
            }
        }

        // 结束游戏逻辑
        function endGame() {
            isGameRunning = false;
            clearInterval(gameInterval);
            finalScoreDisplay.innerText = '最终得分：' + score;
            gameOverMenu.style.display = 'flex';
        }

        // 重置游戏逻辑
        function resetGame() {
            initGame();
        }

        // 键盘控制
        document.addEventListener('keydown', (e) => {
            // 防止反向移动（向右时不能直接向左）
            switch(e.key) {
                case 'ArrowUp':
                    if (dy !== 1) { dx = 0; dy = -1; }
                    break;
                case 'ArrowDown':
                    if (dy !== -1) { dx = 0; dy = 1; }
                    break;
                case 'ArrowLeft':
                    if (dx !== 1) { dx = -1; dy = 0; }
                    break;
                case 'ArrowRight':
                    if (dx !== -1) { dx = 1; dy = 0; }
                    break;
                case ' ':
                    if (!isGameRunning && gameOverMenu.style.display !== 'flex') {
                        initGame();
                    }
                    break;
            }
        });

        // 页面加载时开始游戏
        initGame();
    </script>
</body>
</html>
```

### 如何游玩
1.  **复制上面的代码**。
2.  在你的电脑上创建一个名为 `snake.html` 的新文件。
3.  **将代码粘贴** 到该文件中并保存。
4.  **双击 `snake.html`** 以在浏览器中打开。

### 控制方式
*   **方向键**：向上、向下、向左、向右移动。
*   **空格键**：开始游戏（如果尚未开始）。
*   **再玩一次按钮**：当你撞毁后会出现，用于重新开始游戏。

### 此版本的特性
*   **基于网格的移动**：经典复古风格。
*   **分数追踪**：实时更新。
*   **游戏结束界面**：显示你的最终得分，并允许你轻松重新开始。
*   **碰撞检测**：当你撞到墙或自己时结束游戏。
*   **自碰撞安全**：由于简单教程中常见的“跳过尾巴”逻辑，该代码可防止蛇在吃到食物后立即意外咬到自己。
````

{% endcode %}
{% endcolumn %}

{% column width="41.666666666666664%" %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FsdUp9wbpqDx0Lhp00xZ0%2Fimage.png?alt=media&amp;token=a5e67ac2-65bf-43e0-8c13-4aef9a7d269e" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### :computer: vLLM 部署

你现在可以通过 vLLM 提供 Z.ai 的 FP8 版本模型服务。你需要 860GB 或更多 VRAM，因此至少建议使用 8xH200（141x8 = 1128GB）。8xB200 也表现良好。首先，安装 vllm nightly：

{% code overflow="wrap" %}

```bash
uv pip install --upgrade --force-reinstall vllm --torch-backend=auto --extra-index-url https://wheels.vllm.ai/nightly/cu130
uv pip install --upgrade --force-reinstall git+https://github.com/huggingface/transformers.git
uv pip install --force-reinstall numba
```

{% endcode %}

要禁用 FP8 KV Cache（可将内存使用量减少 50%），请移除 `--kv-cache-dtype fp8`

```bash
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False
vllm serve unsloth/GLM-5-FP8 \\
    --served-model-name unsloth/GLM-5-FP8 \\
    --kv-cache-dtype fp8 \\
    --tensor-parallel-size 8 \\
    --tool-call-parser glm47 \\
    --reasoning-parser glm45 \\
    --enable-auto-tool-choice \\
    --dtype bfloat16 \\
    --seed 3407 \
    --max-model-len 200000 \\
    --gpu-memory-utilization 0.93 \\
    --max_num_batched_tokens 4096 \\
    --speculative-config.method mtp \\
    --speculative-config.num_speculative_tokens 1 \\
    --port 8001
```

然后你可以通过 OpenAI API 调用已部署的模型：

```python
from openai import AsyncOpenAI, OpenAI
openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8001/v1"
client = OpenAI( # 或 AsyncOpenAI
    api_key = openai_api_key,
    base_url = openai_api_base,
)
```

### :hammer:GLM 5 工具调用

请看 [Tool Calling Guide](/docs/zh/ji-chu-zhi-shi/tool-calling-guide-for-local-llms.md) 以了解更多关于如何进行工具调用的细节。在一个新终端中（如果使用 tmux，请按 CTRL+B+D），我们创建一些工具，例如加两个数、执行 Python 代码、执行 Linux 函数等等：

{% code expandable="true" %}

```python
import json, subprocess, random
from typing import Any
def add_number(a: float | str, b: float | str) -> float:
    return float(a) + float(b)
def multiply_number(a: float | str, b: float | str) -> float:
    return float(a) * float(b)
def subtract_number(a: float | str, b: float | str) -> float:
    return float(a) - float(b)
def write_a_story() -> str:
    return random.choice([
        "很久很久以前，在一个遥远遥远的星系……",
        "有两个朋友喜欢树懒和代码……",
        "世界正在毁灭，因为每只树懒都进化出了超人的智慧……",
        "其中一位朋友并不知道，另一位朋友不小心编写了一个让树懒进化的程序……",
    ])
def terminal(command: str) -> str:
    if "rm" in command or "sudo" in command or "dd" in command or "chmod" in command:
        msg = "由于这些命令很危险，无法执行 'rm, sudo, dd, chmod' 命令"
        print(msg); return msg
    print(f"正在执行终端命令 `{command}`")
    try:
        return str(subprocess.run(command, capture_output = True, text = True, shell = True, check = True).stdout)
    except subprocess.CalledProcessError as e:
        return f"命令失败：{e.stderr}"
def python(code: str) -> str:
    data = {}
    exec(code, data)
    del data["__builtins__"]
    return str(data)
MAP_FN = {
    "add_number": add_number,
    "multiply_number": multiply_number,
    "subtract_number": subtract_number,
    "write_a_story": write_a_story,
    "terminal": terminal,
    "python": python,
}
tools = [
    {
        "type": "function",
        "function": {
            "name": "add_number",
            "description": "将两个数字相加。",
            "parameters": {
                "type": "object",
                "properties": {
                    "a": {
                        "type": "string",
                        "description": "第一个数字。",
                    },
                    "b": {
                        "type": "string",
                        "description": "第二个数字。",
                    },
                },
                "required": ["a", "b"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "multiply_number",
            "description": "将两个数字相乘。",
            "parameters": {
                "type": "object",
                "properties": {
                    "a": {
                        "type": "string",
                        "description": "第一个数字。",
                    },
                    "b": {
                        "type": "string",
                        "description": "第二个数字。",
                    },
                },
                "required": ["a", "b"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "subtract_number",
            "description": "将两个数字相减。",
            "parameters": {
                "type": "object",
                "properties": {
                    "a": {
                        "type": "string",
                        "description": "第一个数字。",
                    },
                    "b": {
                        "type": "string",
                        "description": "第二个数字。",
                    },
                },
                "required": ["a", "b"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "write_a_story",
            "description": "编写一个随机故事。",
            "parameters": {
                "type": "object",
                "properties": {},
                "required": [],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "terminal",
            "description": "执行终端操作。",
            "parameters": {
                "type": "object",
                "properties": {
                    "command": {
                        "type": "string",
                        "description": "你想要执行的命令，例如 `ls`、`rm`，...",
                    },
                },
                "required": ["command"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "python",
            "description": "使用一些将要运行的 Python 代码调用 Python 解释器。",
            "parameters": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "要运行的 Python 代码",
                    },
                },
                "required": ["code"],
            },
        },
    },
]
```

{% endcode %}

然后我们使用下面这些函数（复制、粘贴并执行），它们会自动解析函数调用，并针对任何模型调用 OpenAI 端点：

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

```python
from openai import OpenAI
def unsloth_inference(
    messages,
    temperature = 1.0,
    top_p = 0.95,
    top_k = -1,
    min_p = 0.01,
    repetition_penalty = 1.0,
):
    messages = messages.copy()
    openai_client = OpenAI(
        base_url = "http://127.0.0.1:8001/v1",
        api_key = "sk-no-key-required",
    )
    model_name = next(iter(openai_client.models.list())).id
    print(f"正在使用模型 = {model_name}")
    has_tool_calls = True
    original_messages_len = len(messages)
    while has_tool_calls:
        print(f"Current messages = {messages}")
        response = openai_client.chat.completions.create(
            model = model_name,
            messages = messages,
            temperature = temperature,
            top_p = top_p,
            tools = tools if tools else None,
            tool_choice = "auto" if tools else None,
            extra_body = {"top_k": top_k, "min_p": min_p, "repetition_penalty" :repetition_penalty,}
        )
        tool_calls = response.choices[0].message.tool_calls or []
        content = response.choices[0].message.content or ""
        tool_calls_dict = [tc.to_dict() for tc in tool_calls] if tool_calls else tool_calls
        messages.append({"role": "assistant", "tool_calls": tool_calls_dict, "content": content,})
        for tool_call in tool_calls:
            fx, args, _id = tool_call.function.name, tool_call.function.arguments, tool_call.id
            out = MAP_FN[fx](**json.loads(args))
            messages.append({"role": "tool", "tool_call_id": _id, "name": fx, "content": str(out),})
        else:
            has_tool_calls = False
    return messages
```

{% endcode %}

通过以下方式启动 GLM 5 之后 `llama-server` 例如在 [#deploy-with-llama-server-and-openais-completion-library](#deploy-with-llama-server-and-openais-completion-library "mention") 或查看 [Tool Calling Guide](/docs/zh/ji-chu-zhi-shi/tool-calling-guide-for-local-llms.md) 如需更多细节，我们就可以进行一些工具调用。

### 📊 基准测试

你可以在下方以表格形式查看更多基准测试：

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F3QI8akFZoQFXsZ2ojtgK%2Fglm5%20bench.jpg?alt=media&amp;token=0fb5d73f-4dc4-46f5-bd76-206c26ff5e96" alt="" width="375"><figcaption></figcaption></figure>

<table data-full-width="true"><thead><tr><th>基准</th><th>GLM-5</th><th>GLM-4.7</th><th>DeepSeek-V3.2</th><th>Kimi K2.5</th><th>Claude Opus 4.5</th><th>Gemini 3 Pro</th><th>GPT-5.2（xhigh）</th></tr></thead><tbody><tr><td>HLE</td><td>30.5</td><td>24.8</td><td>25.1</td><td>31.5</td><td>28.4</td><td>37.2</td><td>35.4</td></tr><tr><td>HLE（含工具）</td><td>50.4</td><td>42.8</td><td>40.8</td><td>51.8</td><td>43.4*</td><td>45.8*</td><td>45.5*</td></tr><tr><td>AIME 2026 I</td><td>92.7</td><td>92.9</td><td>92.7</td><td>92.5</td><td>93.3</td><td>90.6</td><td>-</td></tr><tr><td>HMMT 2025 年 11 月</td><td>96.9</td><td>93.5</td><td>90.2</td><td>91.1</td><td>91.7</td><td>93.0</td><td>97.1</td></tr><tr><td>IMOAnswerBench</td><td>82.5</td><td>82.0</td><td>78.3</td><td>81.8</td><td>78.5</td><td>83.3</td><td>86.3</td></tr><tr><td>GPQA-Diamond</td><td>86.0</td><td>85.7</td><td>82.4</td><td>87.6</td><td>87.0</td><td>91.9</td><td>92.4</td></tr><tr><td>SWE-bench Verified</td><td>77.8</td><td>73.8</td><td>73.1</td><td>76.8</td><td>80.9</td><td>76.2</td><td>80.0</td></tr><tr><td>SWE-bench 多语言</td><td>73.3</td><td>66.7</td><td>70.2</td><td>73.0</td><td>77.5</td><td>65.0</td><td>72.0</td></tr><tr><td>Terminal-Bench 2.0（Terminus 2）</td><td>56.2 / 60.7 †</td><td>41.0</td><td>39.3</td><td>50.8</td><td>59.3</td><td>54.2</td><td>54.0</td></tr><tr><td>Terminal-Bench 2.0（Claude Code）</td><td>56.2 / 61.1 †</td><td>32.8</td><td>46.4</td><td>-</td><td>57.9</td><td>-</td><td>-</td></tr><tr><td>CyberGym</td><td>43.2</td><td>23.5</td><td>17.3</td><td>41.3</td><td>50.6</td><td>39.9</td><td>-</td></tr><tr><td>BrowseComp</td><td>62.0</td><td>52.0</td><td>51.4</td><td>60.6</td><td>37.0</td><td>37.8</td><td>-</td></tr><tr><td>BrowseComp（带上下文管理）</td><td>75.9</td><td>67.5</td><td>67.6</td><td>74.9</td><td>67.8</td><td>59.2</td><td>65.8</td></tr><tr><td>BrowseComp-Zh</td><td>72.7</td><td>66.6</td><td>65.0</td><td>62.3</td><td>62.4</td><td>66.8</td><td>76.1</td></tr><tr><td>τ²-Bench</td><td>89.7</td><td>87.4</td><td>85.3</td><td>80.2</td><td>91.6</td><td>90.7</td><td>85.5</td></tr><tr><td>MCP-Atlas（公开集）</td><td>67.8</td><td>52.0</td><td>62.2</td><td>63.8</td><td>65.2</td><td>66.6</td><td>68.0</td></tr><tr><td>Tool-Decathlon</td><td>38.0</td><td>23.8</td><td>35.2</td><td>27.8</td><td>43.5</td><td>36.4</td><td>46.3</td></tr><tr><td>Vending Bench 2</td><td>$4,432.12</td><td>$2,376.82</td><td>$1,034.00</td><td>$1,198.46</td><td>$4,967.06</td><td>$5,478.16</td><td>$3,591.33</td></tr></tbody></table>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/zh/mo-xing/tutorials/glm-5.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
