Instructions to use zai-org/GLM-5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/GLM-5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zai-org/GLM-5") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zai-org/GLM-5") model = AutoModelForCausalLM.from_pretrained("zai-org/GLM-5") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use zai-org/GLM-5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zai-org/GLM-5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zai-org/GLM-5
- SGLang
How to use zai-org/GLM-5 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "zai-org/GLM-5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "zai-org/GLM-5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-5", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zai-org/GLM-5 with Docker Model Runner:
docker model run hf.co/zai-org/GLM-5
fine-tune
#52
by m-hasnain-sabqi - opened
- .eval_results/MathArena--aime_2026.yaml +0 -8
- .eval_results/MathArena--hmmt_feb_2026.yaml +0 -8
- .eval_results/swe_bench_verified.yaml +0 -19
- .eval_results/terminal_bench.yaml +0 -11
- .eval_results/terminal_bench_2.yaml +0 -10
- .eval_results/yc-bench.yaml +0 -9
- README.md +37 -32
- chat_template.jinja +2 -2
.eval_results/MathArena--aime_2026.yaml
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
- dataset:
|
| 2 |
-
id: MathArena/aime_2026
|
| 3 |
-
task_id: MathArena/aime_2026
|
| 4 |
-
value: 95.83
|
| 5 |
-
date: '2026-02-18'
|
| 6 |
-
source:
|
| 7 |
-
url: https://matharena.ai/?comp=aime--aime_2026
|
| 8 |
-
name: Official MathArena Evaluation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.eval_results/MathArena--hmmt_feb_2026.yaml
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
- dataset:
|
| 2 |
-
id: MathArena/hmmt_feb_2026
|
| 3 |
-
task_id: MathArena/hmmt_feb_2026
|
| 4 |
-
value: 86.36
|
| 5 |
-
date: '2026-02-23'
|
| 6 |
-
source:
|
| 7 |
-
url: https://matharena.ai/?comp=hmmt--hmmt_feb_2026
|
| 8 |
-
name: Official MathArena Evaluation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.eval_results/swe_bench_verified.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
- dataset:
|
| 2 |
-
id: SWE-bench/SWE-bench_Verified
|
| 3 |
-
task_id: swe_bench_%_resolved
|
| 4 |
-
value: 72.80
|
| 5 |
-
source:
|
| 6 |
-
url: https://www.swebench.com/
|
| 7 |
-
name: SWE-Bench official evaluation
|
| 8 |
-
user: nielsr
|
| 9 |
-
notes: high reasoning, official
|
| 10 |
-
|
| 11 |
-
- dataset:
|
| 12 |
-
id: SWE-bench/SWE-bench_Verified
|
| 13 |
-
task_id: swe_bench_%_resolved
|
| 14 |
-
value: 77.8
|
| 15 |
-
source:
|
| 16 |
-
url: https://huggingface.co/zai-org/GLM-5/
|
| 17 |
-
name: Model card
|
| 18 |
-
user: nielsr
|
| 19 |
-
notes: Z.ai reported number
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.eval_results/terminal_bench.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
- dataset:
|
| 2 |
-
id: harborframework/terminal-bench-2.0
|
| 3 |
-
task_id: terminal_bench
|
| 4 |
-
value: 52.4
|
| 5 |
-
date: '2026-02-23'
|
| 6 |
-
source:
|
| 7 |
-
url: https://www.tbench.ai/leaderboard/terminal-bench/2.0
|
| 8 |
-
name: Terminal-Bench Leaderboard
|
| 9 |
-
user: burtenshaw
|
| 10 |
-
notes: "agent: Terminus 2"
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.eval_results/terminal_bench_2.yaml
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
- dataset:
|
| 2 |
-
id: harborframework/terminal-bench-2.0
|
| 3 |
-
task_id: terminalbench_2
|
| 4 |
-
value: 52.4
|
| 5 |
-
date: '2026-02-23'
|
| 6 |
-
source:
|
| 7 |
-
url: https://www.tbench.ai/leaderboard/terminal-bench/2.0
|
| 8 |
-
name: Terminal-Bench Leaderboard
|
| 9 |
-
user: SaylorTwift
|
| 10 |
-
notes: "agent: Terminus 2"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.eval_results/yc-bench.yaml
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
- dataset:
|
| 2 |
-
id: collinear-ai/yc-bench
|
| 3 |
-
task_id: medium
|
| 4 |
-
value: 1208190
|
| 5 |
-
date: "2026-03-24"
|
| 6 |
-
source:
|
| 7 |
-
url: https://github.com/collinear-ai/yc-bench
|
| 8 |
-
name: "YC-Bench eval"
|
| 9 |
-
notes: "avg final funds (USD) across seeds 1,2,3. GLM-5 (via OpenRouter z-ai/glm-5)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
-
- en
|
| 4 |
-
- zh
|
| 5 |
library_name: transformers
|
| 6 |
license: mit
|
| 7 |
pipeline_tag: text-generation
|
|
@@ -22,11 +22,6 @@ pipeline_tag: text-generation
|
|
| 22 |
👉 One click to <a href="https://chat.z.ai">GLM-5</a>.
|
| 23 |
</p>
|
| 24 |
|
| 25 |
-
<p align="center">
|
| 26 |
-
[<a href="https://huggingface.co/papers/2602.15763" target="_blank">Paper</a>]
|
| 27 |
-
[<a href="https://github.com/zai-org/GLM-5" target="_blank">GitHub</a>]
|
| 28 |
-
</p>
|
| 29 |
-
|
| 30 |
## Introduction
|
| 31 |
|
| 32 |
We are launching GLM-5, targeting complex systems engineering and long-horizon agentic tasks. Scaling is still one of the most important ways to improve the intelligence efficiency of Artificial General Intelligence (AGI). Compared to GLM-4.5, GLM-5 scales from 355B parameters (32B active) to 744B parameters (40B active), and increases pre-training data from 23T to 28.5T tokens. GLM-5 also integrates DeepSeek Sparse Attention (DSA), largely reducing deployment cost while preserving long-context capacity.
|
|
@@ -78,28 +73,50 @@ See footnote for more evaluation details.
|
|
| 78 |
|
| 79 |
### Prepare environment
|
| 80 |
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
-
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
### Deploy
|
| 90 |
|
| 91 |
+ vLLM
|
| 92 |
|
| 93 |
```shell
|
| 94 |
-
vllm serve zai-org/GLM-5 \
|
| 95 |
--tensor-parallel-size 8 \
|
| 96 |
--gpu-memory-utilization 0.85 \
|
| 97 |
--speculative-config.method mtp \
|
| 98 |
-
--speculative-config.num_speculative_tokens
|
| 99 |
--tool-call-parser glm47 \
|
| 100 |
--reasoning-parser glm45 \
|
| 101 |
--enable-auto-tool-choice \
|
| 102 |
-
--served-model-name glm-5
|
| 103 |
```
|
| 104 |
|
| 105 |
Check the [recipes](https://github.com/vllm-project/recipes/blob/main/GLM/GLM5.md) for more details.
|
|
@@ -107,8 +124,8 @@ The following open-source frameworks support local deployment of GLM-5:
|
|
| 107 |
+ SGLang
|
| 108 |
|
| 109 |
```shell
|
| 110 |
-
|
| 111 |
-
--model-path zai-org/GLM-5 \
|
| 112 |
--tp-size 8 \
|
| 113 |
--tool-call-parser glm47 \
|
| 114 |
--reasoning-parser glm45 \
|
|
@@ -117,7 +134,7 @@ The following open-source frameworks support local deployment of GLM-5:
|
|
| 117 |
--speculative-eagle-topk 1 \
|
| 118 |
--speculative-num-draft-tokens 4 \
|
| 119 |
--mem-fraction-static 0.85 \
|
| 120 |
-
--served-model-name glm-5
|
| 121 |
```
|
| 122 |
|
| 123 |
Check the [sglang cookbook](https://cookbook.sglang.io/autoregressive/GLM/GLM-5) for more details.
|
|
@@ -132,16 +149,4 @@ The following open-source frameworks support local deployment of GLM-5:
|
|
| 132 |
|
| 133 |
## Citation
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
```bibtex
|
| 138 |
-
@misc{glm5team2026glm5vibecodingagentic,
|
| 139 |
-
title={GLM-5: from Vibe Coding to Agentic Engineering},
|
| 140 |
-
author={GLM-5-Team and : and Aohan Zeng and Xin Lv and Zhenyu Hou and Zhengxiao Du and Qinkai Zheng and Bin Chen and Da Yin and Chendi Ge and Chenghua Huang and Chengxing Xie and Chenzheng Zhu and Congfeng Yin and Cunxiang Wang and Gengzheng Pan and Hao Zeng and Haoke Zhang and Haoran Wang and Huilong Chen and Jiajie Zhang and Jian Jiao and Jiaqi Guo and Jingsen Wang and Jingzhao Du and Jinzhu Wu and Kedong Wang and Lei Li and Lin Fan and Lucen Zhong and Mingdao Liu and Mingming Zhao and Pengfan Du and Qian Dong and Rui Lu and Shuang-Li and Shulin Cao and Song Liu and Ting Jiang and Xiaodong Chen and Xiaohan Zhang and Xuancheng Huang and Xuezhen Dong and Yabo Xu and Yao Wei and Yifan An and Yilin Niu and Yitong Zhu and Yuanhao Wen and Yukuo Cen and Yushi Bai and Zhongpei Qiao and Zihan Wang and Zikang Wang and Zilin Zhu and Ziqiang Liu and Zixuan Li and Bojie Wang and Bosi Wen and Can Huang and Changpeng Cai and Chao Yu and Chen Li and Chengwei Hu and Chenhui Zhang and Dan Zhang and Daoyan Lin and Dayong Yang and Di Wang and Ding Ai and Erle Zhu and Fangzhou Yi and Feiyu Chen and Guohong Wen and Hailong Sun and Haisha Zhao and Haiyi Hu and Hanchen Zhang and Hanrui Liu and Hanyu Zhang and Hao Peng and Hao Tai and Haobo Zhang and He Liu and Hongwei Wang and Hongxi Yan and Hongyu Ge and Huan Liu and Huanpeng Chu and Jia'ni Zhao and Jiachen Wang and Jiajing Zhao and Jiamin Ren and Jiapeng Wang and Jiaxin Zhang and Jiayi Gui and Jiayue Zhao and Jijie Li and Jing An and Jing Li and Jingwei Yuan and Jinhua Du and Jinxin Liu and Junkai Zhi and Junwen Duan and Kaiyue Zhou and Kangjian Wei and Ke Wang and Keyun Luo and Laiqiang Zhang and Leigang Sha and Liang Xu and Lindong Wu and Lintao Ding and Lu Chen and Minghao Li and Nianyi Lin and Pan Ta and Qiang Zou and Rongjun Song and Ruiqi Yang and Shangqing Tu and Shangtong Yang and Shaoxiang Wu and Shengyan Zhang and Shijie Li and Shuang Li and Shuyi Fan and Wei Qin and Wei Tian and Weining Zhang and Wenbo Yu and Wenjie Liang and Xiang Kuang and Xiangmeng Cheng and Xiangyang Li and Xiaoquan Yan and Xiaowei Hu and Xiaoying Ling and Xing Fan and Xingye Xia and Xinyuan Zhang and Xinze Zhang and Xirui Pan and Xu Zou and Xunkai Zhang and Yadi Liu and Yandong Wu and Yanfu Li and Yidong Wang and Yifan Zhu and Yijun Tan and Yilin Zhou and Yiming Pan and Ying Zhang and Yinpei Su and Yipeng Geng and Yong Yan and Yonglin Tan and Yuean Bi and Yuhan Shen and Yuhao Yang and Yujiang Li and Yunan Liu and Yunqing Wang and Yuntao Li and Yurong Wu and Yutao Zhang and Yuxi Duan and Yuxuan Zhang and Zezhen Liu and Zhengtao Jiang and Zhenhe Yan and Zheyu Zhang and Zhixiang Wei and Zhuo Chen and Zhuoer Feng and Zijun Yao and Ziwei Chai and Ziyuan Wang and Zuzhou Zhang and Bin Xu and Minlie Huang and Hongning Wang and Juanzi Li and Yuxiao Dong and Jie Tang},
|
| 141 |
-
year={2026},
|
| 142 |
-
eprint={2602.15763},
|
| 143 |
-
archivePrefix={arXiv},
|
| 144 |
-
primaryClass={cs.LG},
|
| 145 |
-
url={https://arxiv.org/abs/2602.15763},
|
| 146 |
-
}
|
| 147 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
+
- en
|
| 4 |
+
- zh
|
| 5 |
library_name: transformers
|
| 6 |
license: mit
|
| 7 |
pipeline_tag: text-generation
|
|
|
|
| 22 |
👉 One click to <a href="https://chat.z.ai">GLM-5</a>.
|
| 23 |
</p>
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
## Introduction
|
| 26 |
|
| 27 |
We are launching GLM-5, targeting complex systems engineering and long-horizon agentic tasks. Scaling is still one of the most important ways to improve the intelligence efficiency of Artificial General Intelligence (AGI). Compared to GLM-4.5, GLM-5 scales from 355B parameters (32B active) to 744B parameters (40B active), and increases pre-training data from 23T to 28.5T tokens. GLM-5 also integrates DeepSeek Sparse Attention (DSA), largely reducing deployment cost while preserving long-context capacity.
|
|
|
|
| 73 |
|
| 74 |
### Prepare environment
|
| 75 |
|
| 76 |
+
vLLM, SGLang, KTransformers, and xLLM all support local deployment of GLM-5. A simple deployment guide is provided here.
|
| 77 |
+
|
| 78 |
+
+ vLLM
|
| 79 |
+
|
| 80 |
+
Using Docker as:
|
| 81 |
+
|
| 82 |
+
```shell
|
| 83 |
+
docker pull vllm/vllm-openai:nightly
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
or using pip:
|
| 87 |
|
| 88 |
+
```shell
|
| 89 |
+
pip install -U vllm --pre --index-url https://pypi.org/simple --extra-index-url https://wheels.vllm.ai/nightly
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
then upgrade transformers:
|
| 93 |
+
|
| 94 |
+
```
|
| 95 |
+
pip install git+https://github.com/huggingface/transformers.git
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
+ SGLang
|
| 99 |
+
|
| 100 |
+
Using Docker as:
|
| 101 |
+
```bash
|
| 102 |
+
docker pull lmsysorg/sglang:glm5-hopper # For Hopper GPU
|
| 103 |
+
docker pull lmsysorg/sglang:glm5-blackwell # For Blackwell GPU
|
| 104 |
+
```
|
| 105 |
|
| 106 |
### Deploy
|
| 107 |
|
| 108 |
+ vLLM
|
| 109 |
|
| 110 |
```shell
|
| 111 |
+
vllm serve zai-org/GLM-5-FP8 \
|
| 112 |
--tensor-parallel-size 8 \
|
| 113 |
--gpu-memory-utilization 0.85 \
|
| 114 |
--speculative-config.method mtp \
|
| 115 |
+
--speculative-config.num_speculative_tokens 1 \
|
| 116 |
--tool-call-parser glm47 \
|
| 117 |
--reasoning-parser glm45 \
|
| 118 |
--enable-auto-tool-choice \
|
| 119 |
+
--served-model-name glm-5-fp8
|
| 120 |
```
|
| 121 |
|
| 122 |
Check the [recipes](https://github.com/vllm-project/recipes/blob/main/GLM/GLM5.md) for more details.
|
|
|
|
| 124 |
+ SGLang
|
| 125 |
|
| 126 |
```shell
|
| 127 |
+
python3 -m sglang.launch_server \
|
| 128 |
+
--model-path zai-org/GLM-5-FP8 \
|
| 129 |
--tp-size 8 \
|
| 130 |
--tool-call-parser glm47 \
|
| 131 |
--reasoning-parser glm45 \
|
|
|
|
| 134 |
--speculative-eagle-topk 1 \
|
| 135 |
--speculative-num-draft-tokens 4 \
|
| 136 |
--mem-fraction-static 0.85 \
|
| 137 |
+
--served-model-name glm-5-fp8
|
| 138 |
```
|
| 139 |
|
| 140 |
Check the [sglang cookbook](https://cookbook.sglang.io/autoregressive/GLM/GLM-5) for more details.
|
|
|
|
| 149 |
|
| 150 |
## Citation
|
| 151 |
|
| 152 |
+
Our technical report is coming soon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chat_template.jinja
CHANGED
|
@@ -32,10 +32,10 @@ For each function call, output the function name and arguments within the follow
|
|
| 32 |
{%- set ns = namespace(last_user_index=-1) %}
|
| 33 |
{%- for m in messages %}
|
| 34 |
{%- if m.role == 'user' %}
|
| 35 |
-
{%
|
| 36 |
{%- endif %}
|
| 37 |
{%- endfor %}
|
| 38 |
-
{%
|
| 39 |
{%- if m.role == 'user' -%}<|user|>{{ visible_text(m.content) }}
|
| 40 |
{%- elif m.role == 'assistant' -%}
|
| 41 |
<|assistant|>
|
|
|
|
| 32 |
{%- set ns = namespace(last_user_index=-1) %}
|
| 33 |
{%- for m in messages %}
|
| 34 |
{%- if m.role == 'user' %}
|
| 35 |
+
{% set ns.last_user_index = loop.index0 -%}
|
| 36 |
{%- endif %}
|
| 37 |
{%- endfor %}
|
| 38 |
+
{% for m in messages %}
|
| 39 |
{%- if m.role == 'user' -%}<|user|>{{ visible_text(m.content) }}
|
| 40 |
{%- elif m.role == 'assistant' -%}
|
| 41 |
<|assistant|>
|