[Doc] Host model recipes in recipes/ (#61302)
Signed-off-by: esmeetu <jasonailu87@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f98ae6a9fd
commit
b515648641
@@ -0,0 +1,190 @@
|
||||
meta:
|
||||
title: "GLM-4.5"
|
||||
slug: "glm-4.5"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-4.5 MoE language model (~358B total parameters, BF16) with built-in MTP layers for speculative decoding and native tool calling"
|
||||
date_added: 2025-08-12
|
||||
date_updated: 2026-09-14
|
||||
tasks:
|
||||
- text
|
||||
performance_headline: "GLM-4.X series MoE model with native FP8 and BF16 support and MTP speculative decoding"
|
||||
related_recipes: []
|
||||
hardware:
|
||||
h200: verified
|
||||
mi300x: verified
|
||||
mi325x: verified
|
||||
mi355x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-4.5"
|
||||
min_vllm_version: "0.11.0"
|
||||
default_frontend: rust
|
||||
architecture: moe
|
||||
parameter_count: "358B"
|
||||
active_parameters: "32B"
|
||||
context_length: 131072
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
base_env: {}
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.5 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm45"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "GLM-4.5 reasoning parser for chain-of-thought extraction"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm45"
|
||||
spec_decoding:
|
||||
description: "Multi-Token Prediction speculative decoding using the model's built-in MTP layers"
|
||||
args:
|
||||
- "--speculative-config.method"
|
||||
- "mtp"
|
||||
- "--speculative-config.num_speculative_tokens"
|
||||
- "1"
|
||||
|
||||
opt_in_features:
|
||||
- spec_decoding
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 859
|
||||
description: "Full precision BF16 on 8xH200 or equivalent"
|
||||
fp8:
|
||||
model_id: "zai-org/GLM-4.5-FP8"
|
||||
precision: fp8
|
||||
vram_minimum_gb: 430
|
||||
description: "Native FP8 checkpoint with minimal accuracy loss — recommended for cost-efficient serving"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- single_node_dep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_dep
|
||||
- multi_node_tep
|
||||
- pd_cluster
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides: {}
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-4.5 is a Mixture-of-Experts language model from Z-AI with ~358B total parameters.
|
||||
The checkpoint ships in both BF16 and native FP8 formats. FP8 models have minimal
|
||||
accuracy loss, so unless you need strict reproducibility for benchmarking, FP8 is the
|
||||
recommended precision for lower-cost serving. All GLM-4.X models include built-in
|
||||
Multi-Token Prediction (MTP) layers that enable speculative decoding for higher
|
||||
generation throughput.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** >= 0.11.0 (latest stable recommended)
|
||||
- **Hardware:** 8x H200 (BF16) or 4x-8x H200 (FP8), AMD MI300X / MI325X / MI355X for ROCm
|
||||
- **Python:** 3.10 - 3.13 (3.12 required for ROCm wheels)
|
||||
|
||||
### Install vLLM (NVIDIA)
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --torch-backend auto
|
||||
```
|
||||
|
||||
### Install vLLM (AMD ROCm)
|
||||
|
||||
```bash
|
||||
uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm
|
||||
```
|
||||
|
||||
The vLLM wheel for ROCm requires Python 3.12, ROCm 7.0, and glibc >= 2.35.
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### Tensor Parallel (FP8 on 8 GPUs)
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-4.5-FP8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice
|
||||
```
|
||||
|
||||
### Enabling MTP Speculative Decoding
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-4.5-FP8 \
|
||||
--tensor-parallel-size 4 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 1 \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice
|
||||
```
|
||||
|
||||
Use `--speculative-config.num_speculative_tokens 1` for optimal throughput. Higher
|
||||
values increase mean acceptance length but drop acceptance rate significantly.
|
||||
|
||||
### Tuning Tips
|
||||
|
||||
- `--max-model-len=65536` works well for most scenarios; max is 128K.
|
||||
- `--max-num-batched-tokens=32768` is a good default for prompt-heavy workloads.
|
||||
Reduce to 16K/8K to cut activation memory and latency.
|
||||
- Set `--gpu-memory-utilization=0.95` to maximize KV cache headroom.
|
||||
|
||||
## Client Usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
resp = client.chat.completions.create(
|
||||
model="zai-org/GLM-4.5-FP8",
|
||||
messages=[{"role": "user", "content": "Explain MTP speculative decoding."}],
|
||||
max_tokens=512,
|
||||
)
|
||||
print(resp.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
Disable prefix caching with `--no-enable-prefix-caching` on the server command,
|
||||
then:
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--model zai-org/GLM-4.5-FP8 \
|
||||
--dataset-name random \
|
||||
--random-input-len 8000 \
|
||||
--random-output-len 1000 \
|
||||
--request-rate 10000 \
|
||||
--num-prompts 16 \
|
||||
--ignore-eos
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Tool calling not firing:** Ensure `--tool-call-parser glm45 --enable-auto-tool-choice`
|
||||
are both present.
|
||||
- **MTP memory overhead:** MTP adds memory for draft computations. Monitor GPU memory
|
||||
and reduce `--max-model-len` or `--max-num-batched-tokens` if you OOM.
|
||||
- **Low MTP acceptance:** If acceptance rate is below ~90%, drop speculative tokens to 1.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-4.5)
|
||||
- [FP8 checkpoint](https://huggingface.co/zai-org/GLM-4.5-FP8)
|
||||
- [vLLM docs](https://docs.vllm.ai/)
|
||||
@@ -0,0 +1,219 @@
|
||||
meta:
|
||||
title: "GLM-4.5V"
|
||||
slug: "glm-4.5v"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-4.5 vision-language MoE model (~107B parameters, BF16) with image-text-to-text capability, 64K context, expert parallelism, and native FP8"
|
||||
date_added: 2025-08-12
|
||||
date_updated: 2026-04-17
|
||||
tasks:
|
||||
- multimodal
|
||||
performance_headline: "Multimodal GLM-4.5V with native FP8 and expert parallelism, deploys on 4xH100"
|
||||
related_recipes: []
|
||||
hardware:
|
||||
h100: verified
|
||||
h200: verified
|
||||
mi300x: verified
|
||||
mi325x: verified
|
||||
mi355x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-4.5V"
|
||||
min_vllm_version: "0.12.0"
|
||||
architecture: moe
|
||||
parameter_count: "107B"
|
||||
active_parameters: "12B"
|
||||
context_length: 65536
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
- "--enable-expert-parallel"
|
||||
- "--allowed-local-media-path"
|
||||
- "/"
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
- "--mm-processor-cache-type"
|
||||
- "shm"
|
||||
base_env: {}
|
||||
|
||||
dependencies:
|
||||
- note: "GLM-V requires Transformers >= 5.0.0 for tokenizer and multimodal config compatibility."
|
||||
command: 'uv pip install "transformers>=5.0.0"'
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.5 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm45"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "GLM-4.5 reasoning parser"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm45"
|
||||
text_only:
|
||||
description: "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache. Mutually exclusive with encoder_parallel."
|
||||
args:
|
||||
- "--language-model-only"
|
||||
encoder_parallel:
|
||||
description: "Run the vision encoder in data-parallel mode — avoids TP comm overhead on the small encoder. Mutually exclusive with text_only."
|
||||
args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
|
||||
opt_in_features:
|
||||
- text_only
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 257
|
||||
description: "Full precision BF16 — runs on 4xH100/H200"
|
||||
fp8:
|
||||
model_id: "zai-org/GLM-4.5V-FP8"
|
||||
precision: fp8
|
||||
vram_minimum_gb: 128
|
||||
description: "Native FP8 checkpoint with minimal accuracy loss — recommended for cost-efficient serving"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- single_node_dep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_tep
|
||||
- multi_node_dep
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides:
|
||||
amd:
|
||||
# Requires transformers >= 5.0.0; see dependencies.
|
||||
extra_args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
- "--allowed-local-media-path"
|
||||
- "/"
|
||||
extra_env:
|
||||
VLLM_ROCM_USE_AITER: "1"
|
||||
SAFETENSORS_FAST_GPU: "1"
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-4.5V is the vision-language variant of GLM-4.5. It is an MoE model with ~107B
|
||||
total parameters that accepts image and text inputs. FP8 models have minimal accuracy
|
||||
loss versus BF16 and are recommended for cost-efficient serving. GLM-4.5V supports a
|
||||
64K context length (use GLM-4.6V for 128K).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** >= 0.12.0
|
||||
- **Hardware:** 4x H100/H200 (BF16 or FP8), or 4x MI300X/MI325X/MI355X with ROCm
|
||||
- **Python:** 3.10+ for NVIDIA; Python 3.12 with ROCm 7.0 and glibc >= 2.35 for AMD ROCm wheels
|
||||
|
||||
### Install vLLM (NVIDIA)
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --torch-backend auto
|
||||
```
|
||||
|
||||
### Install vLLM (AMD ROCm)
|
||||
|
||||
```bash
|
||||
uv venv --python 3.12
|
||||
source .venv/bin/activate
|
||||
uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm
|
||||
uv pip install "transformers>=5.0.0"
|
||||
```
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### Tensor Parallel + Expert Parallel (FP8 on 4 GPUs)
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-4.5V-FP8 \
|
||||
--tensor-parallel-size 4 \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice \
|
||||
--enable-expert-parallel \
|
||||
--allowed-local-media-path / \
|
||||
--mm-encoder-tp-mode data \
|
||||
--mm-processor-cache-type shm
|
||||
```
|
||||
|
||||
### AMD ROCm (4xMI300x/MI325x/MI355x))
|
||||
|
||||
```bash
|
||||
export VLLM_ROCM_USE_AITER=1
|
||||
|
||||
vllm serve zai-org/GLM-4.5V-FP8 \
|
||||
--tensor-parallel-size 4 \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice \
|
||||
--enable-expert-parallel \
|
||||
--allowed-local-media-path / \
|
||||
--mm-encoder-tp-mode data \
|
||||
--mm-processor-cache-type shm
|
||||
```
|
||||
|
||||
### Tuning Tips
|
||||
|
||||
- `--max-model-len=65536` is near the model's max context (64K).
|
||||
- `--max-num-batched-tokens=32768` for prompt-heavy workloads.
|
||||
- `--gpu-memory-utilization=0.95` maximizes KV cache.
|
||||
- Use `uv pip install "transformers>=5.0.0"` before serving GLM-V checkpoints.
|
||||
- `--mm-encoder-tp-mode data` runs the vision encoder data-parallel — preferable to TP
|
||||
since the encoder is small and TP adds communication overhead.
|
||||
- `--mm-processor-cache-type shm` enables shared-memory caching for repeated image inputs.
|
||||
|
||||
## Client Usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
resp = client.chat.completions.create(
|
||||
model="zai-org/GLM-4.5V-FP8",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
|
||||
{"type": "text", "text": "Describe the image."}
|
||||
]
|
||||
}],
|
||||
max_tokens=512,
|
||||
)
|
||||
print(resp.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--backend openai-chat \
|
||||
--endpoint /v1/chat/completions \
|
||||
--model zai-org/GLM-4.5V-FP8 \
|
||||
--dataset-name hf \
|
||||
--dataset-path lmarena-ai/VisionArena-Chat \
|
||||
--num-prompts 1000 \
|
||||
--request-rate 20
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Vision encoder overhead:** Use `--mm-encoder-tp-mode data` unless TP-sharded encoder is known-good for your config.
|
||||
- **Context length errors:** GLM-4.5V max is 64K; use GLM-4.6V if you need 128K.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-4.5V)
|
||||
- [FP8 checkpoint](https://huggingface.co/zai-org/GLM-4.5V-FP8)
|
||||
- [vLLM multimodal inputs guide](https://docs.vllm.ai/en/latest/features/multimodal_inputs.html)
|
||||
@@ -0,0 +1,203 @@
|
||||
meta:
|
||||
title: "GLM-4.6"
|
||||
slug: "glm-4.6"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-4.6 MoE language model (~357B total parameters, BF16) with MTP speculative decoding, native tool calling and reasoning"
|
||||
date_added: 2025-12-20
|
||||
date_updated: 2026-09-14
|
||||
tasks:
|
||||
- text
|
||||
performance_headline: "Updated GLM-4.X series MoE model with native FP8 and BF16, MTP speculative decoding"
|
||||
related_recipes: []
|
||||
hardware:
|
||||
h200: verified
|
||||
mi300x: verified
|
||||
mi325x: verified
|
||||
mi355x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-4.6"
|
||||
min_vllm_version: "0.11.0"
|
||||
default_frontend: rust
|
||||
architecture: moe
|
||||
parameter_count: "357B"
|
||||
active_parameters: "32B"
|
||||
context_length: 202752
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
base_env: {}
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.5 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm45"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "GLM-4.5 reasoning parser for chain-of-thought extraction"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm45"
|
||||
spec_decoding:
|
||||
description: "Multi-Token Prediction speculative decoding using the model's built-in MTP layers"
|
||||
args:
|
||||
- "--speculative-config.method"
|
||||
- "mtp"
|
||||
- "--speculative-config.num_speculative_tokens"
|
||||
- "1"
|
||||
|
||||
opt_in_features:
|
||||
- spec_decoding
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 857
|
||||
description: "Full precision BF16 on 8xH200 or equivalent"
|
||||
fp8:
|
||||
model_id: "zai-org/GLM-4.6-FP8"
|
||||
precision: fp8
|
||||
vram_minimum_gb: 428
|
||||
description: "Native FP8 checkpoint with minimal accuracy loss — recommended for cost-efficient serving"
|
||||
|
||||
redhat_fp8:
|
||||
model_id: "RedHatAI/GLM-4.6-FP8-dynamic"
|
||||
precision: fp8
|
||||
label: "FP8 Dynamic (RedHat)"
|
||||
vram_minimum_gb: 429
|
||||
description: "RedHatAI FP8 (E4M3) with dynamic per-token activation quantization"
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8"
|
||||
|
||||
redhat_fp8_plain:
|
||||
model_id: "RedHatAI/GLM-4.6-FP8"
|
||||
precision: fp8
|
||||
label: "FP8 (RedHat)"
|
||||
vram_minimum_gb: 429
|
||||
description: "RedHatAI FP8 quantization"
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8"
|
||||
|
||||
nvfp4:
|
||||
model_id: "RedHatAI/GLM-4.6-NVFP4"
|
||||
precision: nvfp4
|
||||
vram_minimum_gb: 223
|
||||
description: "RedHatAI NVFP4 quantization"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- single_node_dep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_dep
|
||||
- multi_node_tep
|
||||
- pd_cluster
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides: {}
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-4.6 is the successor to GLM-4.5 with ~357B total parameters. It retains the
|
||||
MoE architecture and built-in Multi-Token Prediction (MTP) layers used for
|
||||
speculative decoding. FP8 is the recommended precision for cost-efficient
|
||||
serving with minimal accuracy loss relative to BF16.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** >= 0.11.0 (latest stable recommended)
|
||||
- **Hardware:** 8x H200 (BF16) or 4x-8x H200 (FP8), AMD MI300X / MI325X / MI355X for ROCm
|
||||
- **Python:** 3.10 - 3.13 (3.12 required for ROCm wheels)
|
||||
|
||||
### Install vLLM (NVIDIA)
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --torch-backend auto
|
||||
```
|
||||
|
||||
### Install vLLM (AMD ROCm)
|
||||
|
||||
```bash
|
||||
uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm
|
||||
```
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### Tensor Parallel (FP8)
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-4.6-FP8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice
|
||||
```
|
||||
|
||||
### Enabling MTP Speculative Decoding
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-4.6-FP8 \
|
||||
--tensor-parallel-size 4 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 1 \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice
|
||||
```
|
||||
|
||||
### Tuning Tips
|
||||
|
||||
- `--max-model-len=65536` works well for most scenarios; max is 128K.
|
||||
- `--max-num-batched-tokens=32768` is a good default for prompt-heavy workloads.
|
||||
- `--gpu-memory-utilization=0.95` maximizes KV cache headroom.
|
||||
|
||||
## Client Usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
resp = client.chat.completions.create(
|
||||
model="zai-org/GLM-4.6-FP8",
|
||||
messages=[{"role": "user", "content": "Summarize MTP speculative decoding."}],
|
||||
max_tokens=512,
|
||||
)
|
||||
print(resp.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--model zai-org/GLM-4.6-FP8 \
|
||||
--dataset-name random \
|
||||
--random-input-len 8000 \
|
||||
--random-output-len 1000 \
|
||||
--request-rate 10000 \
|
||||
--num-prompts 16 \
|
||||
--ignore-eos
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **MTP memory overhead:** Monitor GPU memory and tune batch size when enabling MTP.
|
||||
- **Tool calling not firing:** Ensure `--tool-call-parser glm45 --enable-auto-tool-choice`
|
||||
are both present.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-4.6)
|
||||
- [FP8 checkpoint](https://huggingface.co/zai-org/GLM-4.6-FP8)
|
||||
- [vLLM docs](https://docs.vllm.ai/)
|
||||
@@ -0,0 +1,215 @@
|
||||
meta:
|
||||
title: "GLM-4.6V"
|
||||
slug: "glm-4.6v"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-4.6 vision-language MoE model — image-text-to-text with 128K context, native FP8 checkpoint, and expert parallelism"
|
||||
date_added: 2025-12-07
|
||||
date_updated: 2026-04-17
|
||||
tasks:
|
||||
- multimodal
|
||||
performance_headline: "Updated GLM-V series with 128K context length and native FP8"
|
||||
related_recipes: []
|
||||
hardware:
|
||||
h100: verified
|
||||
h200: verified
|
||||
mi300x: verified
|
||||
mi325x: verified
|
||||
mi355x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-4.6V"
|
||||
min_vllm_version: "0.12.0"
|
||||
architecture: moe
|
||||
parameter_count: "107B"
|
||||
active_parameters: "12B"
|
||||
context_length: 131072
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
- "--enable-expert-parallel"
|
||||
- "--allowed-local-media-path"
|
||||
- "/"
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
- "--mm-processor-cache-type"
|
||||
- "shm"
|
||||
base_env: {}
|
||||
|
||||
dependencies:
|
||||
- note: "GLM-V requires Transformers >= 5.0.0 for tokenizer and multimodal config compatibility."
|
||||
command: 'uv pip install "transformers>=5.0.0"'
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.5 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm45"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "GLM-4.5 reasoning parser"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm45"
|
||||
text_only:
|
||||
description: "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache. Mutually exclusive with encoder_parallel."
|
||||
args:
|
||||
- "--language-model-only"
|
||||
encoder_parallel:
|
||||
description: "Run the vision encoder in data-parallel mode — avoids TP comm overhead on the small encoder. Mutually exclusive with text_only."
|
||||
args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
|
||||
opt_in_features:
|
||||
- text_only
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 257
|
||||
description: "Full precision BF16 — runs on 4xH100/H200"
|
||||
fp8:
|
||||
model_id: "zai-org/GLM-4.6V-FP8"
|
||||
precision: fp8
|
||||
vram_minimum_gb: 128
|
||||
description: "Native FP8 checkpoint with minimal accuracy loss"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- single_node_dep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_tep
|
||||
- multi_node_dep
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides:
|
||||
amd:
|
||||
extra_args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
- "--allowed-local-media-path"
|
||||
- "/"
|
||||
extra_env:
|
||||
VLLM_ROCM_USE_AITER: "1"
|
||||
SAFETENSORS_FAST_GPU: "1"
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-4.6V is an updated vision-language MoE model from Z-AI. It supports a 128K
|
||||
context length (vs 64K for GLM-4.5V). Native FP8 is recommended for cost-efficient
|
||||
serving, matching BF16 accuracy to within a small margin.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** >= 0.12.0
|
||||
- **Hardware:** 4x H100/H200 (BF16 or FP8), or 4x MI300X/MI325X/MI355X with ROCm
|
||||
- **Python:** 3.10+ for NVIDIA; Python 3.12 with ROCm 7.0 and glibc >= 2.35 for AMD ROCm wheels
|
||||
|
||||
### Install vLLM (NVIDIA)
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --torch-backend auto
|
||||
```
|
||||
|
||||
### Install vLLM (AMD ROCm)
|
||||
|
||||
```bash
|
||||
uv venv --python 3.12
|
||||
source .venv/bin/activate
|
||||
uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm
|
||||
uv pip install "transformers>=5.0.0"
|
||||
```
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### Tensor Parallel + Expert Parallel (FP8 on 4 GPUs)
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-4.6V-FP8 \
|
||||
--tensor-parallel-size 4 \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice \
|
||||
--enable-expert-parallel \
|
||||
--allowed-local-media-path / \
|
||||
--mm-encoder-tp-mode data \
|
||||
--mm-processor-cache-type shm
|
||||
```
|
||||
|
||||
### AMD ROCm (FP8 on 4 GPUs)
|
||||
|
||||
```bash
|
||||
export SAFETENSORS_FAST_GPU=1
|
||||
export VLLM_ROCM_USE_AITER=1
|
||||
|
||||
vllm serve zai-org/GLM-4.6V-FP8 \
|
||||
--tensor-parallel-size 4 \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice \
|
||||
--enable-expert-parallel \
|
||||
--allowed-local-media-path / \
|
||||
--mm-encoder-tp-mode data \
|
||||
--mm-processor-cache-type shm
|
||||
```
|
||||
|
||||
### Tuning Tips
|
||||
|
||||
- `--max-model-len=65536` is a common default; you can push to 131072.
|
||||
- `--max-num-batched-tokens=32768` for prompt-heavy workloads.
|
||||
- `--mm-encoder-tp-mode data` + `--mm-processor-cache-type shm` for efficient vision processing.
|
||||
- Use `uv pip install "transformers>=5.0.0"` before serving GLM-V checkpoints.
|
||||
|
||||
## Client Usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
resp = client.chat.completions.create(
|
||||
model="zai-org/GLM-4.6V-FP8",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
|
||||
{"type": "text", "text": "Describe the image."}
|
||||
]
|
||||
}],
|
||||
max_tokens=512,
|
||||
)
|
||||
print(resp.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--backend openai-chat \
|
||||
--endpoint /v1/chat/completions \
|
||||
--model zai-org/GLM-4.6V-FP8 \
|
||||
--dataset-name hf \
|
||||
--dataset-path lmarena-ai/VisionArena-Chat \
|
||||
--num-prompts 1000 \
|
||||
--request-rate 20
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Vision encoder overhead:** Prefer `--mm-encoder-tp-mode data` over TP for the encoder.
|
||||
- **Long-context memory:** At 128K context, tune `--max-num-batched-tokens` and
|
||||
`--gpu-memory-utilization` to prevent OOM.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-4.6V)
|
||||
- [vLLM multimodal inputs guide](https://docs.vllm.ai/en/latest/features/multimodal_inputs.html)
|
||||
@@ -0,0 +1,196 @@
|
||||
meta:
|
||||
title: "GLM-4.7"
|
||||
slug: "glm-4.7"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-4.7 MoE language model (~358B total parameters) with MTP speculative decoding, updated tool call parser, and reasoning support"
|
||||
date_added: 2025-12-20
|
||||
date_updated: 2026-09-18
|
||||
tasks:
|
||||
- text
|
||||
performance_headline: "Latest GLM-4.X release with updated glm47 tool call parser and MTP speculative decoding"
|
||||
related_recipes: []
|
||||
hardware:
|
||||
h200: verified
|
||||
mi300x: verified
|
||||
mi325x: verified
|
||||
mi355x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-4.7"
|
||||
min_vllm_version: "0.24.0"
|
||||
default_frontend: rust
|
||||
architecture: moe
|
||||
parameter_count: "358B"
|
||||
active_parameters: "32B"
|
||||
context_length: 202752
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
base_env: {}
|
||||
|
||||
dependencies:
|
||||
- note: "GLM-4.7 requires the nightly vllm wheel"
|
||||
command: "uv pip install -U vllm --pre --extra-index-url https://wheels.vllm.ai/nightly"
|
||||
- note: "transformers from source — GLM-4.7 tokenizer is newer than any release"
|
||||
command: "uv pip install git+https://github.com/huggingface/transformers.git"
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.7 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm47"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "GLM-4.7 reasoning parser for chain-of-thought extraction"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm47"
|
||||
spec_decoding:
|
||||
description: "Multi-Token Prediction speculative decoding using the model's built-in MTP layers"
|
||||
args:
|
||||
- "--speculative-config.method"
|
||||
- "mtp"
|
||||
- "--speculative-config.num_speculative_tokens"
|
||||
- "1"
|
||||
|
||||
opt_in_features:
|
||||
- spec_decoding
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 859
|
||||
description: "Full precision BF16 on 8xH200 or equivalent"
|
||||
fp8:
|
||||
model_id: "zai-org/GLM-4.7-FP8"
|
||||
precision: fp8
|
||||
vram_minimum_gb: 430
|
||||
description: "Native FP8 checkpoint with minimal accuracy loss"
|
||||
nvfp4:
|
||||
model_id: "nvidia/GLM-4.7-NVFP4"
|
||||
precision: nvfp4
|
||||
vram_minimum_gb: 215
|
||||
description: "NVIDIA NVFP4 quantized weights for Blackwell GPUs"
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- single_node_dep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_dep
|
||||
- multi_node_tep
|
||||
- pd_cluster
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides: {}
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-4.7 is the latest GLM-4.X MoE release from Z-AI. It introduces the `glm47`
|
||||
tool call parser and uses the matching `glm47` reasoning parser. Built-in
|
||||
Multi-Token Prediction (MTP) layers enable speculative decoding for throughput
|
||||
gains on decode-heavy workloads.
|
||||
|
||||
A smaller `zai-org/GLM-4.7-Flash` variant is also available for lower-latency
|
||||
scenarios.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** nightly recommended for GLM-4.7 (until packaged in a stable release)
|
||||
- **Hardware:** 4x-8x H200 (FP8), AMD MI300X / MI325X / MI355X for ROCm
|
||||
- **Python:** 3.10 - 3.13 (3.12 required for ROCm wheels)
|
||||
|
||||
### Install vLLM (NVIDIA, nightly)
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --pre --extra-index-url https://wheels.vllm.ai/nightly
|
||||
uv pip install git+https://github.com/huggingface/transformers.git
|
||||
```
|
||||
|
||||
### Install vLLM (AMD ROCm)
|
||||
|
||||
```bash
|
||||
uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm
|
||||
```
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### Tensor Parallel + MTP (FP8 on 4xH200)
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-4.7-FP8 \
|
||||
--tensor-parallel-size 4 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 1 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice
|
||||
```
|
||||
|
||||
### AMD ROCm
|
||||
|
||||
```bash
|
||||
SAFETENSORS_FAST_GPU=1 \
|
||||
vllm serve zai-org/GLM-4.7 \
|
||||
--tensor-parallel-size 8 \
|
||||
--gpu-memory-utilization 0.9 \
|
||||
--no-enable-prefix-caching \
|
||||
--trust-remote-code
|
||||
```
|
||||
|
||||
### Tuning Tips
|
||||
|
||||
- `--max-model-len=65536` is a sensible default; max is 128K.
|
||||
- `--max-num-batched-tokens=32768` for prompt-heavy workloads; reduce to 8K-16K for latency-sensitive.
|
||||
- Use `--gpu-memory-utilization=0.95` to maximize KV cache.
|
||||
|
||||
## Client Usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
resp = client.chat.completions.create(
|
||||
model="zai-org/GLM-4.7-FP8",
|
||||
messages=[{"role": "user", "content": "Hello!"}],
|
||||
max_tokens=512,
|
||||
)
|
||||
print(resp.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--model zai-org/GLM-4.7-FP8 \
|
||||
--dataset-name random \
|
||||
--random-input-len 8000 \
|
||||
--random-output-len 1000 \
|
||||
--request-rate 10000 \
|
||||
--num-prompts 16 \
|
||||
--ignore-eos
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Parser mismatch:** GLM-4.7 uses `--tool-call-parser glm47` and `--reasoning-parser glm47`.
|
||||
- **MTP acceptance:** 1 speculative token gives ~90%+ acceptance and best throughput.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-4.7)
|
||||
- [FP8 checkpoint](https://huggingface.co/zai-org/GLM-4.7-FP8)
|
||||
- [GLM-4.7-Flash](https://huggingface.co/zai-org/GLM-4.7-Flash)
|
||||
- [vLLM docs](https://docs.vllm.ai/)
|
||||
@@ -0,0 +1,290 @@
|
||||
meta:
|
||||
title: "GLM-5.1"
|
||||
slug: "glm-5.1"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-5.1 refreshed version of GLM-5 — frontier-scale MoE language model (~744B total parameters) with MTP speculative decoding and thinking mode"
|
||||
date_added: 2026-03-28
|
||||
date_updated: 2026-10-05
|
||||
tasks:
|
||||
- text
|
||||
performance_headline: "Refreshed GLM-5 series MoE with improved reasoning, coding, and agentic performance"
|
||||
related_recipes: []
|
||||
hardware:
|
||||
h200: verified
|
||||
mi325x: verified
|
||||
mi350x: verified
|
||||
mi355x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-5.1"
|
||||
min_vllm_version: "0.24.0"
|
||||
default_frontend: rust
|
||||
architecture: moe
|
||||
parameter_count: "744B"
|
||||
active_parameters: "40B"
|
||||
context_length: 202752
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
- "--chat-template-content-format=string"
|
||||
base_env: {}
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.7 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm47"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "GLM-4.7 reasoning parser — thinking mode enabled by default on requests"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm47"
|
||||
spec_decoding:
|
||||
description: "Multi-Token Prediction speculative decoding (3 draft tokens) — not yet supported on the AMD MXFP4 checkpoint"
|
||||
default_mode: mtp
|
||||
modes:
|
||||
mtp:
|
||||
label: "MTP"
|
||||
description: "Built-in Multi-Token Prediction, 3 draft tokens."
|
||||
hardware:
|
||||
mi355x: unsupported
|
||||
args:
|
||||
- "--speculative-config.method"
|
||||
- "mtp"
|
||||
- "--speculative-config.num_speculative_tokens"
|
||||
- "3"
|
||||
|
||||
opt_in_features:
|
||||
- spec_decoding
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 1786
|
||||
description: "Full precision BF16 — requires multi-node deployment"
|
||||
fp8:
|
||||
model_id: "zai-org/GLM-5.1-FP8"
|
||||
precision: fp8
|
||||
vram_minimum_gb: 893
|
||||
description: "Native FP8 checkpoint — 8xH200/H20 (141GB × 8) single-node serving"
|
||||
hardware_overrides:
|
||||
mi325x:
|
||||
docker_image: "vllm/vllm-openai-rocm:nightly-92044241a02f05de51420d654daf669de20b4691"
|
||||
mi350x:
|
||||
docker_image: "vllm/vllm-openai-rocm:nightly-92044241a02f05de51420d654daf669de20b4691"
|
||||
nvfp4:
|
||||
model_id: "nvidia/GLM-5.1-NVFP4"
|
||||
precision: nvfp4
|
||||
vram_minimum_gb: 446
|
||||
description: "NVIDIA NVFP4 quantized weights for Blackwell GPUs"
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8"
|
||||
mxfp4:
|
||||
model_id: "amd/GLM-5.1-MXFP4"
|
||||
precision: mxfp4
|
||||
vram_minimum_gb: 447
|
||||
min_vllm_version: "0.24.0"
|
||||
supported_hardware:
|
||||
- mi355x
|
||||
description: "AMD Quark MXFP4 checkpoint — MoE weights quantized for MI355X (gfx950)"
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8_e4m3"
|
||||
- "-cc.pass_config.fuse_allreduce_rms=False"
|
||||
- "--block-size=1"
|
||||
- "--enable-prefix-caching"
|
||||
- "--max-num-seqs"
|
||||
- "64"
|
||||
hardware_overrides:
|
||||
mi355x:
|
||||
extra_env:
|
||||
VLLM_USE_V2_MODEL_RUNNER: "1"
|
||||
VLLM_ROCM_USE_AITER_FP8BMM: "0"
|
||||
VLLM_ROCM_USE_AITER_FP4BMM: "0"
|
||||
VLLM_ROCM_USE_AITER_RMSNORM: "0"
|
||||
VLLM_ROCM_QUICK_REDUCE_QUANTIZATION: "INT4"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_tep
|
||||
- multi_node_dep
|
||||
- pd_cluster
|
||||
|
||||
# Mooncake untested on MI355X so far — opt out until verified (the schema
|
||||
# only recognizes the literal "unsupported" value here). LMCache is left
|
||||
# fail-open (no hardware-scoped gate exists for it); see the MXFP4 guide
|
||||
# note below instead.
|
||||
kv_cache_strategy_hardware:
|
||||
kv_store_distributed_mooncake:
|
||||
mi355x: unsupported
|
||||
kv_store_centralized_mooncake:
|
||||
mi355x: unsupported
|
||||
|
||||
hardware_overrides:
|
||||
amd:
|
||||
extra_args:
|
||||
- "--linear-backend"
|
||||
- "aiter"
|
||||
- "--moe-backend"
|
||||
- "aiter"
|
||||
extra_env:
|
||||
VLLM_ROCM_USE_AITER: "1"
|
||||
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS: "1"
|
||||
# Loading the FP8 checkpoint on 8x MI325X can outlast the Rust
|
||||
# frontend's 600 s default wait for the engine.
|
||||
VLLM_ENGINE_READY_TIMEOUT_S: "3600"
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-5.1 is a refreshed version of GLM-5, the 744B parameter frontier MoE model from Z-AI.
|
||||
It keeps the asynchronous RL training recipe and delivers best-in-class open-source
|
||||
performance on reasoning, coding, and agentic benchmarks. Both BF16 and native FP8
|
||||
checkpoints are published.
|
||||
|
||||
Thinking mode is enabled by default; disable it by passing
|
||||
`"chat_template_kwargs": {"enable_thinking": false}` in request extras.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** >= 0.24.0 for the `glm47` reasoning parser.
|
||||
Use the latest main branch if you need tool calling + MTP simultaneously.
|
||||
- **Hardware (FP8):** 8xH200 or 8xH20 (141GB × 8)
|
||||
- **DeepGEMM (FP8, NVIDIA):** install via `install_deepgemm.sh` from vLLM repo
|
||||
- **Hardware (FP8, AMD):** 8x MI325X (256GB × 8) or 8x MI350X (288GB × 8), `vllm/vllm-openai-rocm:nightly-92044241a02f05de51420d654daf669de20b4691`; uses AITER, not DeepGEMM
|
||||
- **Hardware (MXFP4):** 8x MI355X (gfx950), vLLM >= 0.24.0, `vllm/vllm-openai-rocm:latest`
|
||||
|
||||
### Using Docker
|
||||
|
||||
```bash
|
||||
docker run --gpus all \
|
||||
-p 8000:8000 \
|
||||
--ipc=host \
|
||||
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
||||
vllm/vllm-openai:latest zai-org/GLM-5.1-FP8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--chat-template-content-format=string \
|
||||
--served-model-name glm-5.1-fp8
|
||||
```
|
||||
|
||||
Use `vllm/vllm-openai:latest-cu129` for CUDA 12.x.
|
||||
|
||||
### Install vLLM from Source
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install "vllm==0.24.0" --torch-backend=auto
|
||||
uv pip install "transformers>=5.4.0"
|
||||
```
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### FP8 on 8xH200 with MTP
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5.1-FP8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 3 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--chat-template-content-format=string \
|
||||
--served-model-name glm-5.1-fp8
|
||||
```
|
||||
|
||||
### FP8 on AMD MI325X and MI350X
|
||||
|
||||
Select **MI325X** or **MI350X** and the **FP8** variant in the command builder above. The
|
||||
generated command adds `VLLM_ROCM_USE_AITER=1`, `VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1`,
|
||||
`--linear-backend aiter` and `--moe-backend aiter`, and raises `VLLM_ENGINE_READY_TIMEOUT_S`
|
||||
because loading the weights can take longer than the Rust frontend's 600 s default. The
|
||||
Docker command uses the nightly build
|
||||
`vllm/vllm-openai-rocm:nightly-92044241a02f05de51420d654daf669de20b4691`.
|
||||
|
||||
On 8x MI325X that command, with MTP enabled, serves the full 202,752-token context with a
|
||||
1,292,544-token KV cache (6.38x maximum concurrency) and an MTP mean acceptance length of
|
||||
2.72 with 3 draft tokens on a ~380-token greedy generation.
|
||||
|
||||
On 8x MI350X the same command serves the full context with a 1,587,312-token KV cache (7.83x
|
||||
maximum concurrency) and an MTP mean acceptance length of 3.13 with 3 draft tokens on a
|
||||
512-token greedy generation.
|
||||
|
||||
## Client Usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
|
||||
# Thinking ON (default)
|
||||
resp_on = client.chat.completions.create(
|
||||
model="glm-5.1-fp8",
|
||||
messages=[{"role": "user", "content": "Summarize GLM-5.1 in one sentence."}],
|
||||
temperature=1,
|
||||
max_tokens=4096,
|
||||
)
|
||||
print(resp_on.choices[0].message.reasoning)
|
||||
|
||||
# Thinking OFF
|
||||
resp_off = client.chat.completions.create(
|
||||
model="glm-5.1-fp8",
|
||||
messages=[{"role": "user", "content": "Summarize GLM-5.1 in one sentence."}],
|
||||
temperature=1,
|
||||
max_tokens=4096,
|
||||
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
|
||||
)
|
||||
```
|
||||
|
||||
### cURL (Thinking ON)
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "glm-5.1-fp8",
|
||||
"messages": [
|
||||
{"role": "user", "content": "Summarize GLM-5.1 in one sentence."}
|
||||
],
|
||||
"temperature": 1,
|
||||
"max_tokens": 4096
|
||||
}'
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--model zai-org/GLM-5.1-FP8 \
|
||||
--dataset-name random \
|
||||
--random-input 8000 \
|
||||
--random-output 1024 \
|
||||
--request-rate 10 \
|
||||
--num-prompts 32 \
|
||||
--ignore-eos
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Accuracy drift:** Prefer the 0.19.0 stable release for best accuracy.
|
||||
- **Tool calling + MTP:** If both are needed, use the latest vLLM main branch.
|
||||
- **FP8 installation (NVIDIA):** DeepGEMM required for FP8 performance.
|
||||
- **MXFP4 (MI355X):** MTP speculative decoding isn't yet supported on this checkpoint/kernel path. Mooncake and LMCache KV-store offload are still untested on MI355X — worth a check before leaning on them in production.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-5.1)
|
||||
- [FP8 checkpoint](https://huggingface.co/zai-org/GLM-5.1-FP8)
|
||||
- [MXFP4 checkpoint](https://huggingface.co/amd/GLM-5.1-MXFP4)
|
||||
- [DeepGEMM install script](https://github.com/vllm-project/vllm/blob/v0.16.0rc0/tools/install_deepgemm.sh)
|
||||
@@ -0,0 +1,471 @@
|
||||
meta:
|
||||
title: "GLM-5.2"
|
||||
slug: "glm-5.2"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-5.2 — frontier-scale MoE language model (~743B total parameters, 39B active) with up to 5-token MTP speculative decoding and thinking mode"
|
||||
date_added: 2026-06-16
|
||||
date_updated: 2026-10-03
|
||||
tasks:
|
||||
- text
|
||||
performance_headline: "Latest GLM-5 series MoE with extended MTP (5 draft tokens), improved reasoning and agentic performance"
|
||||
related_recipes:
|
||||
- "zai-org/GLM-5"
|
||||
- "zai-org/GLM-5.1"
|
||||
hardware:
|
||||
b300: verified
|
||||
b200: verified
|
||||
mi300x: verified
|
||||
mi325x: verified
|
||||
mi350x: verified
|
||||
mi355x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-5.2"
|
||||
min_vllm_version: "0.24.0"
|
||||
default_frontend: rust
|
||||
docker_image:
|
||||
nvidia: "vllm/vllm-openai:v0.28.0"
|
||||
amd: "vllm/vllm-openai-rocm:nightly"
|
||||
architecture: moe
|
||||
parameter_count: "743B"
|
||||
active_parameters: "39B"
|
||||
context_length: 1048576
|
||||
base_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8_e4m3"
|
||||
base_env: {}
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.7 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm47"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "GLM-4.7 reasoning parser — thinking mode enabled by default on requests"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm47"
|
||||
spec_decoding:
|
||||
description: "Multi-Token Prediction speculative decoding (up to 7 draft tokens)"
|
||||
default_mode: mtp
|
||||
modes:
|
||||
mtp:
|
||||
label: "MTP"
|
||||
description: "Built-in Multi-Token Prediction, 5 draft tokens."
|
||||
variants:
|
||||
- default
|
||||
- nvfp4
|
||||
- redhat_nvfp4
|
||||
- bf16
|
||||
- mxfp4
|
||||
- redhat_fp8
|
||||
- redhat_nvfp4_plain
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"method":"mtp","num_speculative_tokens":5}'
|
||||
dspark:
|
||||
label: "DSpark"
|
||||
description: "DSpark drafting with an externally trained 7-token draft model; the served GLM checkpoint is unchanged."
|
||||
variants:
|
||||
- default
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"model": "RedHatAI/GLM-5.2-speculator.dspark","num_speculative_tokens": 7,"method": "dspark"}'
|
||||
|
||||
opt_in_features:
|
||||
- spec_decoding
|
||||
|
||||
variants:
|
||||
default:
|
||||
model_id: "zai-org/GLM-5.2-FP8"
|
||||
precision: fp8
|
||||
vram_minimum_gb: 893
|
||||
description: "Native FP8 checkpoint — 8xH200/H20 (141GB × 8) single-node serving"
|
||||
mxfp4:
|
||||
model_id: "amd/GLM-5.2-MXFP4"
|
||||
precision: mxfp4
|
||||
vram_minimum_gb: 446
|
||||
supported_hardware:
|
||||
- mi355x
|
||||
description: "AMD Quark MXFP4 checkpoint — MoE weights quantized for MI355X (gfx950)"
|
||||
hardware_overrides:
|
||||
mi355x:
|
||||
extra_args:
|
||||
- "--trust-remote-code"
|
||||
extra_env:
|
||||
VLLM_USE_V2_MODEL_RUNNER: "1"
|
||||
VLLM_ROCM_USE_AITER_FP8BMM: "0"
|
||||
VLLM_ROCM_USE_AITER_FP4BMM: "0"
|
||||
nvfp4:
|
||||
model_id: "nvidia/GLM-5.2-NVFP4"
|
||||
precision: nvfp4
|
||||
vram_minimum_gb: 558
|
||||
description: "NVIDIA modelopt NVFP4 checkpoint — only MoE expert linears are quantized to NVFP4; shared experts, attention, embeddings, and the early dense layers stay FP8/BF16, with FP8 KV cache. Blackwell GPUs (B200/B300) only."
|
||||
redhat_nvfp4:
|
||||
model_id: "RedHatAI/GLM-5.2-NVFP4-FP8"
|
||||
precision: nvfp4
|
||||
label: "NVFP4+FP8 (RedHat)"
|
||||
vram_minimum_gb: 558
|
||||
description: "RedHatAI NVFP4+FP8 mixed-precision checkpoint (MoE expert linears NVFP4, attention/embeddings FP8) for Blackwell GPUs"
|
||||
bf16:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 1786
|
||||
description: "Full precision BF16 — requires multi-node deployment"
|
||||
|
||||
redhat_fp8:
|
||||
model_id: "RedHatAI/GLM-5.2-FP8"
|
||||
precision: fp8
|
||||
label: "FP8 (RedHat)"
|
||||
vram_minimum_gb: 892
|
||||
description: "RedHatAI FP8 quantization"
|
||||
|
||||
redhat_nvfp4_plain:
|
||||
model_id: "RedHatAI/GLM-5.2-NVFP4"
|
||||
precision: nvfp4
|
||||
label: "NVFP4 (RedHat)"
|
||||
vram_minimum_gb: 477
|
||||
description: "RedHatAI NVFP4 quantization"
|
||||
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_tep
|
||||
- multi_node_dep
|
||||
- pd_cluster
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides:
|
||||
hopper:
|
||||
# H100/H200 use plain fp8 KV cache; Blackwell keeps base_args' fp8_e4m3,H20 do not use kvcache fp8
|
||||
# The synthesizer's last-wins dedupe lets this shadow --kv-cache-dtype.
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8"
|
||||
amd:
|
||||
extra_args:
|
||||
- "--linear-backend"
|
||||
- "aiter"
|
||||
- "--moe-backend"
|
||||
- "aiter"
|
||||
extra_env:
|
||||
VLLM_ROCM_USE_AITER: "1"
|
||||
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS: "1"
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-5.2 is the newest model in the GLM-5 series — a ~743B-parameter MoE (39B active) from
|
||||
Z-AI. The
|
||||
headline change over GLM-5 / 5.1 is that **Multi-Token Prediction (MTP) is extended from 3 to
|
||||
5 draft tokens**, lifting end-to-end throughput on reasoning, coding, and agentic workloads.
|
||||
It ships as BF16, native-FP8, and AMD Quark MXFP4 checkpoints, and keeps the GLM
|
||||
thinking-mode behavior.
|
||||
|
||||
This recipe targets the **FP8** checkpoint, the practical default: it fits on a single
|
||||
8xH200 / 8xH20 node and — with FP8 KV cache — reaches the full 1M-token context on 8xB200.
|
||||
On AMD MI355X hardware, use the **MXFP4** variant when HBM footprint is the priority.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM >= 0.24.0** for the `glm47` reasoning parser. If you need tool calling and MTP at the same time, use the latest
|
||||
`main` branch.
|
||||
- **GPU:** 8xH200 or 8xH20 (141 GB each) for single-node FP8; 8xB200 (180 GB each) for the
|
||||
full 1M context.
|
||||
- **MXFP4:** use the AMD Quark checkpoint on MI355X with ROCm and AITER enabled.
|
||||
TP=8 is recommended for the full MXFP4 model on an 8x MI355X node; TP=4 is
|
||||
also supported when memory headroom allows.
|
||||
|
||||
## Installation
|
||||
|
||||
### Docker
|
||||
|
||||
```bash
|
||||
docker run --gpus all \
|
||||
-p 8000:8000 \
|
||||
--ipc=host \
|
||||
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
||||
vllm/vllm-openai:v0.28.0 zai-org/GLM-5.2-FP8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--served-model-name glm-5.2-fp8 \
|
||||
--max-model-len 131072
|
||||
```
|
||||
|
||||
On CUDA 12.x, swap the image for `vllm/vllm-openai:v0.28.0-cu129`.
|
||||
|
||||
### From source
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install "vllm==0.28.0" --torch-backend=auto
|
||||
uv pip install "transformers>=5.9.0"
|
||||
```
|
||||
|
||||
## Launching the server
|
||||
|
||||
### FP8 on 8xH200 (standard)
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5.2-FP8 \
|
||||
--kv-cache-dtype fp8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 5 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--served-model-name glm-5.2-fp8
|
||||
```
|
||||
### FP8 on 8xH20 (dspark with best practices)
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5.2-FP8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--max-model-len 200000 \
|
||||
--max-num-seqs 16 \
|
||||
--max-num-batched-tokens 32768 \
|
||||
--speculative-config '{"model": "RedHatAI/GLM-5.2-speculator.dspark","num_speculative_tokens": 7,"method": "dspark"}' \
|
||||
--served-model-name glm-5.2-fp8
|
||||
```
|
||||
tps up to 70+ for single request
|
||||
|
||||
### FP8 on AMD MI300X/MI325X/MI350X/MI355X (full 1M context)
|
||||
|
||||
GLM-5.2 has a native 1M-token window. Whether the full window fits on ROCm is a
|
||||
KV-cache VRAM question, so the levers are `--max-model-len` and `--max-num-seqs`.
|
||||
Start with the values below, then scale them with your node's HBM and workload:
|
||||
raise the context window when startup reports KV-cache headroom, or lower the
|
||||
sequence cap if long prompts OOM under concurrency.
|
||||
|
||||
```bash
|
||||
VLLM_ROCM_USE_AITER=1 \
|
||||
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1 \
|
||||
vllm serve zai-org/GLM-5.2-FP8 \
|
||||
--kv-cache-dtype fp8_e4m3 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 5 \
|
||||
--tool-call-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--reasoning-parser glm47 \
|
||||
--gpu-memory-utilization 0.80 \
|
||||
--max-model-len 524288 \
|
||||
--max-num-seqs 32 \
|
||||
--linear-backend aiter \
|
||||
--moe-backend aiter
|
||||
```
|
||||
|
||||
- **`--max-model-len`** — caps the served context window; raise it toward the native
|
||||
1M window when your HBM budget and workload leave KV-cache headroom.
|
||||
- **`--max-num-seqs 32`** — the main knob for fitting long context under concurrency;
|
||||
start at 32 and tune it to your HBM (up on headroom, down on OOM).
|
||||
- **`--gpu-memory-utilization 0.80`** — leaves ROCm runtime headroom for MTP graph capture
|
||||
and inference; raise it only after a representative concurrent smoke test.
|
||||
- **`--speculative-config.num_speculative_tokens 5`** — enables GLM-5.2's 5-token MTP
|
||||
path; reduce it if your workload shows low acceptance or higher latency.
|
||||
- **`VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1`** — enables the shared-expert fused
|
||||
MoE path. `VLLM_ROCM_USE_AITER_LINEAR` and `VLLM_ROCM_USE_AITER_MOE` default to enabled
|
||||
when `VLLM_ROCM_USE_AITER=1`.
|
||||
|
||||
On 8x MI325X this command serves the full `--max-model-len 524288` at
|
||||
`--gpu-memory-utilization 0.80`, reporting a 1,564,016-token KV cache and 2.98x maximum
|
||||
concurrency. MTP is healthy there: a mean acceptance length of 4.00 out of 5 drafted
|
||||
tokens on a short greedy generation.
|
||||
|
||||
On 8x MI350X it reports a 2,205,424-token KV cache and 4.21x maximum concurrency at the
|
||||
same settings, and MTP's mean acceptance length is 3.62 out of 5 drafted tokens on a
|
||||
512-token greedy generation.
|
||||
|
||||
### MXFP4 on AMD MI355X
|
||||
|
||||
The AMD Quark MXFP4 checkpoint quantizes the MoE weights while leaving non-MoE modules in
|
||||
higher precision. The recipe UI only enables this variant for supported AMD MI355X
|
||||
hardware. Use ROCm AITER kernels:
|
||||
|
||||
```bash
|
||||
export HIP_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
|
||||
export VLLM_ROCM_USE_AITER=1
|
||||
export VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1
|
||||
export VLLM_USE_V2_MODEL_RUNNER=1
|
||||
export VLLM_ROCM_USE_AITER_FP8BMM=0
|
||||
export VLLM_ROCM_USE_AITER_FP4BMM=0
|
||||
|
||||
vllm serve amd/GLM-5.2-MXFP4 \
|
||||
--trust-remote-code \
|
||||
--kv-cache-dtype fp8_e4m3 \
|
||||
--tensor-parallel-size 8 \
|
||||
--gpu-memory-utilization 0.90 \
|
||||
--max-model-len 32768 \
|
||||
--tool-call-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--reasoning-parser glm47 \
|
||||
--no-enable-prefix-caching \
|
||||
--served-model-name glm-5.2-mxfp4
|
||||
```
|
||||
|
||||
For TP=4 validation runs, use `HIP_VISIBLE_DEVICES=0,1,2,3` and
|
||||
`--tensor-parallel-size 4`.
|
||||
|
||||
### FP8 on 8xB200 (full 1M context)
|
||||
|
||||
GLM-5.2 has a native 1M-token window. Whether the full window fits is a KV-cache VRAM
|
||||
question, so the lever is `--max-num-seqs` — it bounds how many sequences share the KV budget
|
||||
at once, leaving room for each to hold a long context. **Start at 32** and scale with your
|
||||
node's VRAM: raise it on larger trays (e.g. 8xB300) or short-prompt traffic, lower it if you
|
||||
OOM at full context. FP8 KV cache (`--kv-cache-dtype fp8_e4m3`, already in the base flags)
|
||||
roughly halves that budget, which is what makes 1M reachable at all.
|
||||
|
||||
```bash
|
||||
VLLM_DEEP_GEMM_WARMUP=skip vllm serve zai-org/GLM-5.2-FP8 \
|
||||
--kv-cache-dtype fp8_e4m3 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 5 \
|
||||
--max-num-seqs 32 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--served-model-name glm-5.2-fp8
|
||||
```
|
||||
|
||||
- **`--max-num-seqs 32`** — the single knob for fitting 1M context; start at 32 and tune it to
|
||||
your VRAM (up on headroom, down on OOM).
|
||||
- **`VLLM_DEEP_GEMM_WARMUP=skip`** — skips DeepGEMM JIT warmup for a faster startup; the first
|
||||
few requests compile kernels on demand instead.
|
||||
- **BF16** needs multi-node plus an extra loader flag — see [Troubleshooting](#troubleshooting).
|
||||
|
||||
### NVFP4 on Blackwell (B200/B300)
|
||||
|
||||
The `nvidia/GLM-5.2-NVFP4` variant is NVIDIA's modelopt re-quantization: only the MoE
|
||||
expert linears drop to NVFP4 while shared experts, attention, embeddings, and the early
|
||||
dense layers stay FP8/BF16, with FP8 KV cache. The ~465 GB checkpoint fits comfortably on
|
||||
Blackwell — vLLM auto-detects the quantization from the checkpoint, so no `--quantization`
|
||||
flag is needed. Select the **NVFP4** variant above (Blackwell-only) or run NVIDIA's command:
|
||||
|
||||
```bash
|
||||
vllm serve nvidia/GLM-5.2-NVFP4 \
|
||||
--tensor-parallel-size 8 \
|
||||
--enable-expert-parallel \
|
||||
--reasoning-parser glm47 \
|
||||
--tool-call-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--kv-cache-dtype fp8_e4m3 \
|
||||
--served-model-name glm-5.2-nvfp4
|
||||
```
|
||||
|
||||
## Reasoning modes
|
||||
|
||||
Thinking is **on by default**. GLM-5.2 reuses the DeepSeek-V4 `reasoning_effort` mechanism,
|
||||
with two effort levels driven by the `reasoning_effort` field:
|
||||
|
||||
| Mode | How to request | Behavior |
|
||||
|------|----------------|----------|
|
||||
| **Think Max** (default) | omit `reasoning_effort`, or set `"max"` | Deepest reasoning — hard math, multi-step planning, agentic tasks. Highest token cost. |
|
||||
| **Think High** | `"reasoning_effort": "high"` | Balanced depth and latency. |
|
||||
| **Non-think** | `chat_template_kwargs.enable_thinking: false` | Fast, no chain-of-thought. |
|
||||
|
||||
The chat template resolves effort to **`max` unless `reasoning_effort` is explicitly `"high"`**,
|
||||
so Max is the default and High is opt-in. Pass it through `chat_template_kwargs` (the
|
||||
DeepSeek-V4 path) or the top-level OpenAI `reasoning_effort` field; it has no effect when
|
||||
thinking is disabled.
|
||||
|
||||
## Client usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
msgs = [{"role": "user", "content": "Summarize GLM-5.2 in one sentence."}]
|
||||
|
||||
# Think Max (default) — just omit reasoning_effort
|
||||
client.chat.completions.create(model="glm-5.2-fp8", messages=msgs, max_tokens=4096)
|
||||
|
||||
# Think High — explicitly request reasoning_effort: "high"
|
||||
client.chat.completions.create(
|
||||
model="glm-5.2-fp8",
|
||||
messages=msgs,
|
||||
max_tokens=4096,
|
||||
extra_body={"chat_template_kwargs": {"reasoning_effort": "high"}},
|
||||
)
|
||||
|
||||
# Non-think
|
||||
client.chat.completions.create(
|
||||
model="glm-5.2-fp8",
|
||||
messages=msgs,
|
||||
max_tokens=4096,
|
||||
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
|
||||
)
|
||||
```
|
||||
|
||||
### cURL — Think High
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "glm-5.2-fp8",
|
||||
"messages": [{"role": "user", "content": "Summarize GLM-5.2 in one sentence."}],
|
||||
"temperature": 1,
|
||||
"max_tokens": 4096,
|
||||
"chat_template_kwargs": {"reasoning_effort": "high"}
|
||||
}'
|
||||
```
|
||||
|
||||
### cURL — non-think
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "glm-5.2-fp8",
|
||||
"messages": [{"role": "user", "content": "Summarize GLM-5.2 in one sentence."}],
|
||||
"temperature": 1,
|
||||
"max_tokens": 4096,
|
||||
"chat_template_kwargs": {"enable_thinking": false}
|
||||
}'
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
Add `--no-enable-prefix-caching` to the server command for a clean measurement.
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--model zai-org/GLM-5.2-FP8 \
|
||||
--dataset-name random \
|
||||
--random-input 8000 \
|
||||
--random-output 1024 \
|
||||
--request-rate 10 \
|
||||
--num-prompts 32 \
|
||||
--ignore-eos
|
||||
```
|
||||
|
||||
> **Note:** pure throughput benchmarks tend to under-report real speed, because MTP's
|
||||
> acceptance rate is usually low in synthetic runs.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **FP8 performance:** DeepGEMM is required — install via `install_deepgemm.sh`.
|
||||
- **MTP performance:** We fixed some MTP acceptance rate issue in [This PR](https://github.com/vllm-project/vllm/pull/45895). If you encounter MTP acceptance rate issue, please update your branch or refer to [GLM-5.2 Docker Image](https://hub.docker.com/r/vllm/vllm-openai/tags?name=glm52).
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-5.2)
|
||||
- [FP8 checkpoint](https://huggingface.co/zai-org/GLM-5.2-FP8)
|
||||
- [MXFP4 checkpoint](https://huggingface.co/amd/GLM-5.2-MXFP4)
|
||||
- [NVFP4 checkpoint (NVIDIA)](https://huggingface.co/nvidia/GLM-5.2-NVFP4)
|
||||
@@ -0,0 +1,516 @@
|
||||
meta:
|
||||
title: "GLM-5.3-Flash"
|
||||
slug: "glm-5.3-flash"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-5.3-Flash is a 320B-total / 18B-active multimodal MoE with hybrid KDA and sparse MLA attention, native FP8 weights, MTP, and a 1M-token context window."
|
||||
date_added: 2026-08-27
|
||||
date_updated: 2026-10-08
|
||||
tasks:
|
||||
- text
|
||||
- multimodal
|
||||
performance_headline: "320B MoE with 18B active parameters and 1M-token context"
|
||||
hardware:
|
||||
h100: verified
|
||||
b200: verified
|
||||
gb200: verified
|
||||
mi355x: verified
|
||||
ascend_950pr_8x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-5.3-Flash"
|
||||
min_vllm_version: "0.29.0"
|
||||
nightly_required: true
|
||||
docker_image:
|
||||
nvidia: "vllm/vllm-openai:nightly"
|
||||
amd: "vllm/vllm-openai-rocm:nightly"
|
||||
install:
|
||||
docker:
|
||||
note: "NVIDIA: use vllm/vllm-openai:glm53-flash until support lands in the standard image. AMD: use the official vllm/vllm-openai-rocm:nightly image, which includes merged GLM-5.3-Flash support. Ascend 950PR: pin quay.io/ascend/vllm-ascend:nightly-main-a5 (same as GLM-5.3) with GLM-5.3-Flash overlays vLLM#53906 and vllm-ascend#15127."
|
||||
pip: false
|
||||
architecture: moe
|
||||
parameter_count: "321B"
|
||||
active_parameters: "18B"
|
||||
context_length: 1048576
|
||||
base_env:
|
||||
VLLM_ENGINE_READY_TIMEOUT_S: "3600"
|
||||
|
||||
dependencies: []
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM tool-call parsing with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm47"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "Extract reasoning content with the GLM reasoning parser"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm47"
|
||||
spec_decoding:
|
||||
description: "Built-in MTP or an external DFlash2 drafter. Pick one method — only that --speculative-config is emitted."
|
||||
default_mode: mtp
|
||||
modes:
|
||||
mtp:
|
||||
label: "MTP"
|
||||
description: "Use the checkpoint's MTP layer to draft 5 tokens."
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"method":"mtp","num_speculative_tokens":5}'
|
||||
dflash:
|
||||
label: "DFlash2"
|
||||
description: "External DFlash2 drafter (incoai/GLM-5.3-Flash-DFlash2). method is dflash; DFlash2 is selected by the draft architecture. num_speculative_tokens must be 7 (block_size 8 minus one)."
|
||||
hardware:
|
||||
amd: unsupported
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"method":"dflash","model":"incoai/GLM-5.3-Flash-DFlash2","num_speculative_tokens":7}'
|
||||
|
||||
opt_in_features:
|
||||
- spec_decoding
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: fp8
|
||||
vram_minimum_gb: 386
|
||||
description: "Default native FP8 checkpoint (zai-org/GLM-5.3-Flash)"
|
||||
hardware_overrides:
|
||||
# Exact-GPU pin: computeDockerMeta has no Huawei brand, so a model-level
|
||||
# docker_image string would only affect NVIDIA. Hide pip — official
|
||||
# wheels have no NPU kernels.
|
||||
ascend_950pr_8x:
|
||||
docker_image: "quay.io/ascend/vllm-ascend:nightly-main-a5"
|
||||
install:
|
||||
pip: false
|
||||
mi350x: &gfx950_aiter
|
||||
extra_env:
|
||||
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS: "1"
|
||||
VLLM_ROCM_USE_AITER_TRITON_SPARSE_MLA: "1"
|
||||
mi355x: *gfx950_aiter
|
||||
nvfp4:
|
||||
model_id: "RedHatAI/GLM-5.3-Flash-NVFP4"
|
||||
precision: nvfp4
|
||||
vram_minimum_gb: 229
|
||||
description: "NVFP4 checkpoint (RedHatAI/GLM-5.3-Flash-NVFP4) — MoE experts quantized to 4-bit; requires Blackwell"
|
||||
bf16:
|
||||
model_id: "zai-org/GLM-5.3-Flash-BF16"
|
||||
precision: bf16
|
||||
vram_minimum_gb: 772
|
||||
description: "Official BF16 checkpoint; requires substantially more GPU memory"
|
||||
hardware_overrides:
|
||||
mi350x: *gfx950_aiter
|
||||
mi355x: *gfx950_aiter
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- single_node_dep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_tep
|
||||
- multi_node_dep
|
||||
- pd_cluster
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
strategy_hardware:
|
||||
single_node_tep:
|
||||
npu: unsupported
|
||||
single_node_dep:
|
||||
npu: unsupported
|
||||
multi_node_tp:
|
||||
npu: unsupported
|
||||
multi_node_tp_pp:
|
||||
npu: unsupported
|
||||
multi_node_tep:
|
||||
npu: unsupported
|
||||
multi_node_dep:
|
||||
npu: unsupported
|
||||
pd_cluster:
|
||||
npu: unsupported
|
||||
|
||||
hardware_overrides:
|
||||
hopper:
|
||||
extra_args:
|
||||
- "--no-enable-flashinfer-autotune"
|
||||
blackwell:
|
||||
# FP8 KV cache only works on Blackwell for this model; Hopper runs BF16 KV.
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8"
|
||||
amd:
|
||||
extra_args:
|
||||
- "--max-num-seqs"
|
||||
- "512"
|
||||
- "--attention-backend"
|
||||
- "ROCM_AITER_MLA_SPARSE"
|
||||
extra_env:
|
||||
VLLM_ROCM_USE_AITER: "1"
|
||||
# Shared by 950PR 8x (8×128 GB). SFA / kpool indexer needs --block-size 512.
|
||||
npu:
|
||||
extra_args:
|
||||
- "--trust-remote-code"
|
||||
- "--block-size"
|
||||
- "512"
|
||||
- "--max-model-len"
|
||||
- "131072"
|
||||
- "--max-num-seqs"
|
||||
- "16"
|
||||
- "--max-num-batched-tokens"
|
||||
- "8192"
|
||||
- "--gpu-memory-utilization"
|
||||
- "0.90"
|
||||
extra_env:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
HCCL_BUFFSIZE: "512"
|
||||
HCCL_OP_EXPANSION_MODE: "AIV"
|
||||
HCCL_CONNECT_TIMEOUT: "7200"
|
||||
|
||||
hardware_notes:
|
||||
mi350x: &cdna4_indexer_topk_notes
|
||||
title: "Long-context indexer top-k opt-in"
|
||||
body: "When serving long contexts (>=64k), add `--sparse-indexer-topk-backend aiter` for improved decode performance."
|
||||
mi355x: *cdna4_indexer_topk_notes
|
||||
ascend_950pr_8x:
|
||||
title: "vLLM Ascend A5 image required"
|
||||
body: "Single-node TP8 on 8×950PR. Pin quay.io/ascend/vllm-ascend:nightly-main-a5 and overlay vLLM#53906 / vllm-ascend#15127. Do not pass --quantization ascend. --block-size 512 is required (kpool indexer). EP is not available on this interconnect."
|
||||
|
||||
strategy_overrides:
|
||||
pd_cluster:
|
||||
# KDA conv-state / KV-cache layouts must match on both pools for NIXL
|
||||
# transfer; UCX is needed on the decode side too (strategy sets it on
|
||||
# prefill only).
|
||||
env:
|
||||
VLLM_SSM_CONV_STATE_LAYOUT: "DS"
|
||||
VLLM_KV_CACHE_LAYOUT: "HND"
|
||||
UCX_NET_DEVICES: "all"
|
||||
prefill:
|
||||
vllm_args:
|
||||
- "--no-disable-hybrid-kv-cache-manager"
|
||||
# LM stays eager (strategy default) but keep CUDA graphs on the
|
||||
# multimodal encoder.
|
||||
- "--compilation-config"
|
||||
- '{"cudagraph_mm_encoder": true}'
|
||||
decode:
|
||||
vllm_args:
|
||||
- "--no-disable-hybrid-kv-cache-manager"
|
||||
- "--max-num-seqs"
|
||||
- "512"
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-5.3-Flash is a multimodal mixture-of-experts model with approximately 321B
|
||||
total parameters and 18B active parameters per token. Its 45-layer language model
|
||||
combines KDA linear-attention layers with NoPE sparse MLA layers, routes each token
|
||||
through 8 of 288 experts, and supports image and video inputs. The checkpoint declares
|
||||
a maximum context length of 1,048,576 tokens and includes one MTP draft layer.
|
||||
|
||||
The implementation supports NVIDIA Hopper and newer GPUs, AMD Instinct
|
||||
gfx950 via ROCm, and Huawei Ascend 950PR (8 NPUs, one node) via vLLM
|
||||
Ascend. On NVIDIA/AMD it can scale with tensor, pipeline, expert, or
|
||||
data+expert parallelism. The Ascend path is validated as single-node TP=8
|
||||
only.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **Weights:** about 306 GiB for the default native FP8 checkpoint before runtime
|
||||
and KV-cache overhead; the BF16 variant requires roughly twice the weight memory
|
||||
- **vLLM:** use docker before the integration is included in the public repo
|
||||
- **FlashInfer:** 0.6.17 or newer is required for NoPE sparse MLA
|
||||
|
||||
The default model ID, `zai-org/GLM-5.3-Flash`, is the FP8 checkpoint. Select the BF16
|
||||
variant to serve `zai-org/GLM-5.3-Flash-BF16`, or the NVFP4 variant to serve
|
||||
`RedHatAI/GLM-5.3-Flash-NVFP4`. Its MoE experts are quantized to 4-bit (NVFP4),
|
||||
and it requires NVIDIA Blackwell GPUs.
|
||||
|
||||
## Launching the server
|
||||
|
||||
### FP8 with TP4 and MTP on one GB200 tray
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5.3-Flash \
|
||||
--tensor-parallel-size 4 \
|
||||
--kv-cache-dtype fp8 \
|
||||
--speculative-config '{"method":"mtp","num_speculative_tokens":5}' \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--served-model-name zai-org/GLM-5.3-Flash
|
||||
```
|
||||
|
||||
### Prefill/Decode disaggregation (single node, TP4 + TP4)
|
||||
|
||||
Split one 8-GPU node into a prefill pool (GPUs 0-3) and a decode pool (GPUs 4-7),
|
||||
bridged by NIXL KV transfer. The KDA conv-state and KV-cache layouts must be pinned
|
||||
identically on both pools, and MTP drafts run on both sides. On Blackwell you can add
|
||||
`--kv-cache-dtype fp8` to both pools; Hopper does not support FP8 KV cache for this
|
||||
model and must run BF16 KV.
|
||||
|
||||
> Note: `num_speculative_tokens` must be the same in prefill and decode instance
|
||||
|
||||
```bash
|
||||
# Prefill pool
|
||||
CUDA_VISIBLE_DEVICES=0,1,2,3 \
|
||||
VLLM_SSM_CONV_STATE_LAYOUT=DS \
|
||||
VLLM_KV_CACHE_LAYOUT=HND \
|
||||
UCX_NET_DEVICES=all \
|
||||
VLLM_NIXL_SIDE_CHANNEL_PORT=5557 \
|
||||
vllm serve zai-org/GLM-5.3-Flash \
|
||||
--port 8001 \
|
||||
--tensor-parallel-size 4 \
|
||||
--kv-transfer-config '{"kv_connector":"NixlConnector","kv_role":"kv_producer"}' \
|
||||
--speculative-config '{"method":"mtp","num_speculative_tokens":5}' \
|
||||
--compilation-config '{"cudagraph_mm_encoder": true}' \
|
||||
--enforce-eager \
|
||||
--no-disable-hybrid-kv-cache-manager \
|
||||
--served-model-name zai-org/GLM-5.3-Flash
|
||||
|
||||
# Decode pool
|
||||
CUDA_VISIBLE_DEVICES=4,5,6,7 \
|
||||
VLLM_SSM_CONV_STATE_LAYOUT=DS \
|
||||
VLLM_KV_CACHE_LAYOUT=HND \
|
||||
UCX_NET_DEVICES=all \
|
||||
VLLM_NIXL_SIDE_CHANNEL_PORT=5558 \
|
||||
vllm serve zai-org/GLM-5.3-Flash \
|
||||
--port 8002 \
|
||||
--tensor-parallel-size 4 \
|
||||
--kv-transfer-config '{"kv_connector":"NixlConnector","kv_role":"kv_consumer"}' \
|
||||
--speculative-config '{"method":"mtp","num_speculative_tokens":5}' \
|
||||
--max-num-seqs 512 \
|
||||
--no-disable-hybrid-kv-cache-manager \
|
||||
--served-model-name zai-org/GLM-5.3-Flash
|
||||
|
||||
# Router
|
||||
vllm-router --policy round_robin --vllm-pd-disaggregation \
|
||||
--prefill http://127.0.0.1:8001 \
|
||||
--decode http://127.0.0.1:8002 \
|
||||
--host 0.0.0.0 --port 8000 \
|
||||
--intra-node-data-parallel-size 1
|
||||
```
|
||||
|
||||
## Reasoning modes
|
||||
|
||||
Thinking is always on — the generation prompt opens a `<think>` block unconditionally.
|
||||
GLM-5.3-Flash offers **three reasoning effort levels** driven by the `reasoning_effort`
|
||||
field; the default is **`max`**:
|
||||
|
||||
| Mode | How to request | Behavior |
|
||||
|------|----------------|----------|
|
||||
| **Think Max** (default) | omit `reasoning_effort`, or set `"max"` | Deepest reasoning — hard math, multi-step planning, agentic tasks. Highest token cost. |
|
||||
| **Think High** | `"reasoning_effort": "high"` | Balanced depth and latency. |
|
||||
| **Think Low** | `"reasoning_effort": "low"` | Lightest reasoning — simple Q&A, lowest latency and token cost. |
|
||||
|
||||
The chat template resolves effort to **`max` unless `reasoning_effort` is explicitly
|
||||
`"low"` or `"high"`** (any other value falls back to `max`), then injects
|
||||
`Reasoning Effort: Low|High|Max` into the system prompt. Pass it through
|
||||
`chat_template_kwargs` or the top-level OpenAI `reasoning_effort` field.
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
msgs = [{"role": "user", "content": "Summarize sparse attention in one sentence."}]
|
||||
|
||||
# Think Max (default) — just omit reasoning_effort
|
||||
client.chat.completions.create(model="zai-org/GLM-5.3-Flash", messages=msgs, max_tokens=4096)
|
||||
|
||||
# Think High / Think Low — explicitly request the effort level
|
||||
client.chat.completions.create(
|
||||
model="zai-org/GLM-5.3-Flash",
|
||||
messages=msgs,
|
||||
max_tokens=4096,
|
||||
extra_body={"chat_template_kwargs": {"reasoning_effort": "low"}},
|
||||
)
|
||||
```
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "zai-org/GLM-5.3-Flash",
|
||||
"messages": [{"role": "user", "content": "Summarize sparse attention in one sentence."}],
|
||||
"temperature": 1,
|
||||
"max_tokens": 4096,
|
||||
"chat_template_kwargs": {"reasoning_effort": "high"}
|
||||
}'
|
||||
```
|
||||
|
||||
## Client usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
response = client.chat.completions.create(
|
||||
model="zai-org/GLM-5.3-Flash",
|
||||
messages=[{"role": "user", "content": "Summarize sparse attention in one sentence."}],
|
||||
temperature=1.0,
|
||||
max_tokens=256,
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
### Multimodal input (image / video)
|
||||
|
||||
Standard OpenAI multi-part content — list `image_url` / `video_url` items alongside the
|
||||
text. The chat template expands each into its `<|begin_of_image|>…` / `<|begin_of_video|>…`
|
||||
placeholder tokens, and the same image token is reused for video frames (frame spans are
|
||||
delimited by the video start/end tokens).
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
|
||||
# Image
|
||||
client.chat.completions.create(
|
||||
model="zai-org/GLM-5.3-Flash",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
|
||||
{"type": "text", "text": "Describe the image."},
|
||||
],
|
||||
}],
|
||||
max_tokens=512,
|
||||
)
|
||||
```
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
|
||||
# Video
|
||||
client.chat.completions.create(
|
||||
model="zai-org/GLM-5.3-Flash",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "video_url", "video_url": {"url": "https://example.com/clip.mp4"}},
|
||||
{"type": "text", "text": "What happens in this video?"},
|
||||
],
|
||||
}],
|
||||
max_tokens=512,
|
||||
)
|
||||
```
|
||||
|
||||
```bash
|
||||
# Image
|
||||
curl http://localhost:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "zai-org/GLM-5.3-Flash",
|
||||
"messages": [{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
|
||||
{"type": "text", "text": "Describe the image."}
|
||||
]
|
||||
}],
|
||||
"max_tokens": 512
|
||||
}'
|
||||
```
|
||||
|
||||
```bash
|
||||
# Video
|
||||
curl http://localhost:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "zai-org/GLM-5.3-Flash",
|
||||
"messages": [{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "video_url", "video_url": {"url": "https://example.com/clip.mp4"}},
|
||||
{"type": "text", "text": "What happens in this video?"}
|
||||
]
|
||||
}],
|
||||
"max_tokens": 512
|
||||
}'
|
||||
```
|
||||
|
||||
## Running on AMD Instinct
|
||||
|
||||
Use the official `vllm/vllm-openai-rocm:nightly` image. GLM-5.3-Flash support
|
||||
landed in [vLLM #53906](https://github.com/vllm-project/vllm/pull/53906).
|
||||
|
||||
```bash
|
||||
export VLLM_ROCM_USE_AITER=1
|
||||
# gfx950 (MI350X/MI355X) only
|
||||
export VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1
|
||||
export VLLM_ROCM_USE_AITER_TRITON_SPARSE_MLA=1
|
||||
vllm serve zai-org/GLM-5.3-Flash \
|
||||
--served-model-name zai-org/GLM-5.3-Flash \
|
||||
--tensor-parallel-size 4 \
|
||||
--max-num-seqs 512 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--attention-backend ROCM_AITER_MLA_SPARSE
|
||||
```
|
||||
|
||||
At TP=4 the FP8 checkpoint reports a 14.92M-token KV pool and ~113.81x max
|
||||
concurrency at 128K context; the BF16 checkpoint reports an 8.87M-token KV
|
||||
pool at the same TP and context.
|
||||
|
||||
MTP speculative decoding is supported on MI355X by vLLM builds containing
|
||||
[vLLM #55239](https://github.com/vllm-project/vllm/pull/55239), validated on 4×MI355X
|
||||
with TP=4 and MTP5. Enable **Spec Decoding** and select **MTP** in the command builder
|
||||
to add the required configuration.
|
||||
|
||||
### Long-context indexer top-k (gfx950)
|
||||
|
||||
If your traffic is mostly long context (>=64k tokens) and using gfx950
|
||||
(MI350X/MI355X), using the topk indexer backend from AITER is recommended:
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5.3-Flash \
|
||||
--attention-backend ROCM_AITER_MLA_SPARSE \
|
||||
--sparse-indexer-topk-backend aiter
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--backend vllm \
|
||||
--model zai-org/GLM-5.3-Flash \
|
||||
--served-model-name zai-org/GLM-5.3-Flash \
|
||||
--dataset-name random \
|
||||
--random-input-len 8192 \
|
||||
--random-output-len 1024 \
|
||||
--max-concurrency 16 \
|
||||
--num-prompts 64
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Sparse-MLA initialization error:** verify that the image contains FlashInfer
|
||||
0.6.18 or newer.
|
||||
|
||||
## KV cache offloading
|
||||
|
||||
Offloading requires a build containing [vllm-project/vllm#57145](https://github.com/vllm-project/vllm/pull/57145).
|
||||
Validation used [zai-org/GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash) on 4×H200 (TP4),
|
||||
vLLM commit `d1b4028d7e`, the Python frontend, `--enforce-eager`,
|
||||
`--max-model-len 16384`, `--max-num-seqs 16` and `--max-num-batched-tokens 8192`.
|
||||
Validation used `TieringOffloadingSpec`: 8 GiB total CPU tier, `blocks_per_chunk: 1`,
|
||||
a persistent filesystem `root_dir`, eight read/write threads and `PYTHONHASHSEED=0`.
|
||||
Three CPU-tier reloads and three filesystem reloads after restarting the server passed.
|
||||
GLM returned matching final answers; its arithmetic reasoning field varied on filesystem reload.
|
||||
The five-shot GSM8K diagnostic scored 31/32; this is a small sample, not the full benchmark.
|
||||
These results cover this text-only configuration, not the builder's larger tier/chunk defaults or other variants.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-5.3-Flash)
|
||||
- [vLLM](https://github.com/vllm-project/vllm)
|
||||
- [ROCm MTP sparse-MLA fix](https://github.com/vllm-project/vllm/pull/55239)
|
||||
- **FlashInfer:** 0.6.17 or newer is required for NoPE sparse MLA
|
||||
- **Ascend 950PR:** native FP8 checkpoint (~306 GiB). On 950 the block
|
||||
scales are re-grouped to MXFP8 at load (weights stay 1 byte/element).
|
||||
Do not pass `--quantization ascend`. `--block-size 512` is required
|
||||
(kpool indexer). A2/A3 and the official BF16 checkpoint are not
|
||||
validated in this recipe.
|
||||
@@ -0,0 +1,465 @@
|
||||
meta:
|
||||
title: "GLM-5.3"
|
||||
slug: "glm-5.3"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-5.3 — Frontier Coding with Emergent Cyber Capabilities"
|
||||
date_added: 2026-08-28
|
||||
date_updated: 2026-10-15
|
||||
tasks:
|
||||
- text
|
||||
performance_headline: "Latest GLM-5 series MoE — native FP8 by default, 5-token MTP, 1M context"
|
||||
related_recipes:
|
||||
- "zai-org/GLM-5.2"
|
||||
- "zai-org/GLM-5.3-Flash"
|
||||
# FP8 + DFlash2 ran end-to-end on 8-GPU HGX B300 (TEP8) and on H200.
|
||||
default_hardware: b300
|
||||
hardware:
|
||||
b300: verified
|
||||
h200: verified
|
||||
# FP8 + 5-token MTP validated 2026-09-30 on 8×MI325X (TP8).
|
||||
mi325x: verified
|
||||
# FP8 + 5-token MTP validated 2026-10-03 on 8×MI350X (TP8).
|
||||
mi350x: verified
|
||||
# Validated 2026-08-30 on one Atlas A5 node (8×950PR, TP8, graph mode).
|
||||
# Native FP8 path needs vllm-ascend#15346.
|
||||
ascend_950pr_8x: verified
|
||||
# NVFP4 + --cpu-offload-gb on 1× GB300 (252 GB HBM + unified host RAM).
|
||||
# Do not raise taxonomy vram_gb — host RAM is recipe-specific, not HBM.
|
||||
dgx_station_gb300: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-5.3"
|
||||
# Opt in to SMG gRPC PD; parsing runs on the router, not vLLM.
|
||||
smg_grpc:
|
||||
reasoning_parser: glm45
|
||||
tool_call_parser: glm47_moe
|
||||
min_vllm_version: "0.29.0"
|
||||
default_frontend: rust
|
||||
docker_image:
|
||||
amd: "vllm/vllm-openai-rocm:v0.29.0"
|
||||
architecture: moe
|
||||
parameter_count: "743B"
|
||||
active_parameters: "39B"
|
||||
context_length: 1048576
|
||||
base_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8_e4m3"
|
||||
base_env: {}
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.7 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm47"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "Extract reasoning content with the GLM reasoning parser — thinking is always on; effort is set per request via reasoning_effort (max by default)"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm47"
|
||||
spec_decoding:
|
||||
description: "Speculative decoding — pick native MTP, DFlash2, or DSpark (external drafts)."
|
||||
default_mode: mtp
|
||||
modes:
|
||||
mtp:
|
||||
label: "MTP"
|
||||
description: "Native multi-token prediction head. 5 draft tokens on NVIDIA/AMD, 4 on DGX Station (FlashInfer TRT-LLM MoE), 1 on Ascend (draft stays eager)."
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"method":"mtp","num_speculative_tokens":5}'
|
||||
hardware_overrides:
|
||||
npu:
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"method":"mtp","num_speculative_tokens":1,"enforce_eager":true}'
|
||||
dgx_station_gb300:
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"method":"mtp","num_speculative_tokens":4,"moe_backend":"flashinfer_trtllm"}'
|
||||
dflash:
|
||||
label: "DFlash2"
|
||||
description: "External DFlash2 drafter (incoai/GLM-5.3-DFlash2). method is dflash; DFlash2 is selected by the draft architecture. num_speculative_tokens must be 7 (block_size 8 minus one)."
|
||||
variants: [default]
|
||||
hardware:
|
||||
amd: unsupported
|
||||
npu: unsupported
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"method":"dflash","model":"incoai/GLM-5.3-DFlash2","num_speculative_tokens":7}'
|
||||
dspark:
|
||||
label: "DSpark"
|
||||
description: "External DSpark drafter (RedHatAI/GLM-5.3-speculator.dspark), with a Markov head and confidence head. The model card specifies 8 draft tokens."
|
||||
variants: [default]
|
||||
args:
|
||||
- "--speculative-config"
|
||||
- '{"method":"dspark","model":"RedHatAI/GLM-5.3-speculator.dspark","num_speculative_tokens":8}'
|
||||
|
||||
opt_in_features:
|
||||
- spec_decoding
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: fp8
|
||||
vram_minimum_gb: 893
|
||||
description: "Native FP8 checkpoint (zai-org/GLM-5.3) — 8xH200/H20 (141GB × 8) single-node serving"
|
||||
hardware_overrides:
|
||||
# 8x H200 (1128 GB) leaves ~23 GiB/GPU for KV after the 704 GB FP8
|
||||
# weights — vLLM estimates ~450K max tokens, so the 1M default fails
|
||||
# at startup ("KV cache is needed"). Cap at 256K.
|
||||
h200:
|
||||
extra_args:
|
||||
- "--max-model-len"
|
||||
- "262144"
|
||||
# Exact-GPU pin: computeDockerMeta has no Huawei brand, so a model-level
|
||||
# docker_image string would only affect NVIDIA. Hide pip — official
|
||||
# wheels have no NPU kernels.
|
||||
ascend_950pr_8x:
|
||||
docker_image: "quay.io/ascend/vllm-ascend:nightly-main-a5"
|
||||
install:
|
||||
pip: false
|
||||
nvfp4:
|
||||
model_id: "Inferact/GLM-5.3-NVFP4"
|
||||
precision: nvfp4
|
||||
vram_minimum_gb: 558
|
||||
description: "Inferact NVFP4 checkpoint — only MoE expert linears are quantized to NVFP4; shared experts, attention, embeddings, and the early dense layers stay FP8/BF16, with FP8 KV cache. Blackwell GPUs (B200/B300) only. On DGX Station, weights CPU-offload into unified system RAM."
|
||||
hardware_overrides:
|
||||
# Exact-GPU: GPU-resident fit stays ≤ 252 GB HBM. Taxonomy vram_gb is
|
||||
# unchanged — host RAM is only this variant's --cpu-offload-gb path.
|
||||
dgx_station_gb300:
|
||||
# The Rust frontend only registers the glm47 reasoning parser in v0.30.0+.
|
||||
docker_image: "vllm/vllm-openai:v0.30.0-ubuntu2404"
|
||||
vram_minimum_gb: 252
|
||||
extra_env:
|
||||
VLLM_WEIGHT_OFFLOADING_DISABLE_PIN_MEMORY: "1"
|
||||
VLLM_ENGINE_READY_TIMEOUT_S: "900"
|
||||
extra_args:
|
||||
- "--trust-remote-code"
|
||||
- "--gpu-memory-utilization"
|
||||
- "0.97"
|
||||
- "--max-model-len"
|
||||
- "262144"
|
||||
- "--max-num-seqs"
|
||||
- "8"
|
||||
- "--offload-backend"
|
||||
- "uva"
|
||||
- "--cpu-offload-gb"
|
||||
- "222"
|
||||
- "--cpu-offload-params"
|
||||
- "w13_weight"
|
||||
- "w2_weight"
|
||||
- "--load-format"
|
||||
- "fastsafetensors"
|
||||
- "--no-enable-flashinfer-autotune"
|
||||
- "--moe-backend"
|
||||
- "flashinfer_trtllm"
|
||||
w4a8:
|
||||
model_id: "gpustack/GLM-5.3-W4A8"
|
||||
precision: int4
|
||||
label: "W4A8"
|
||||
vram_minimum_gb: 447
|
||||
precision_hardware:
|
||||
brand: NVIDIA
|
||||
generation: hopper
|
||||
supported_hardware: [h100, h200]
|
||||
extra_args:
|
||||
- "--enable-expert-parallel"
|
||||
- "--trust-remote-code"
|
||||
hardware_overrides:
|
||||
hopper:
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8_ds_mla"
|
||||
description: "GPUStack Hopper-native W4A8 (gpustack/GLM-5.3-W4A8). Routed experts are INT4 group-128; non-expert layers stay FP8. Weights drop from 704 GB to 372 GB, roughly doubling KV cache on 8×H200/H20 with no measurable accuracy drop vs official FP8. CUTLASS W4A8 is SM90-only — H100/H200/H20; Blackwell and AMD are unsupported."
|
||||
bf16:
|
||||
model_id: "zai-org/GLM-5.3-BF16"
|
||||
precision: bf16
|
||||
vram_minimum_gb: 1786
|
||||
description: "Full precision BF16 — requires multi-node deployment"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_tep
|
||||
- multi_node_dep
|
||||
- pd_cluster
|
||||
|
||||
# EP/MC2 cannot acquire HCCL links on Atlas 350 (950PR). Multi-node and PD
|
||||
# were not validated. Only single-node TP8 is offered on NPU.
|
||||
strategy_hardware:
|
||||
single_node_tep:
|
||||
npu: unsupported
|
||||
multi_node_tp:
|
||||
npu: unsupported
|
||||
multi_node_tp_pp:
|
||||
npu: unsupported
|
||||
multi_node_tep:
|
||||
npu: unsupported
|
||||
multi_node_dep:
|
||||
npu: unsupported
|
||||
pd_cluster:
|
||||
npu: unsupported
|
||||
|
||||
hardware_overrides:
|
||||
hopper:
|
||||
# H100/H200 use plain fp8 KV cache; Blackwell keeps base_args' fp8_e4m3.
|
||||
# The synthesizer's last-wins dedupe lets this shadow --kv-cache-dtype.
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8"
|
||||
amd:
|
||||
extra_args:
|
||||
- "--linear-backend"
|
||||
- "aiter"
|
||||
- "--moe-backend"
|
||||
- "aiter"
|
||||
extra_env:
|
||||
VLLM_ROCM_USE_AITER: "1"
|
||||
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS: "1"
|
||||
# Shared by 950PR 8x (8×128 GB). last-wins shadows --kv-cache-dtype fp8_e4m3
|
||||
# from base_args; SFA on 950 needs --block-size 512.
|
||||
npu:
|
||||
extra_args:
|
||||
- "--trust-remote-code"
|
||||
- "--kv-cache-dtype"
|
||||
- "auto"
|
||||
- "--block-size"
|
||||
- "512"
|
||||
- "--max-model-len"
|
||||
- "131072"
|
||||
- "--max-num-seqs"
|
||||
- "16"
|
||||
- "--gpu-memory-utilization"
|
||||
- "0.9"
|
||||
extra_env:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
OMP_PROC_BIND: "false"
|
||||
OMP_NUM_THREADS: "1"
|
||||
TASK_QUEUE_ENABLE: "1"
|
||||
HCCL_BUFFSIZE: "1024"
|
||||
HCCL_OP_EXPANSION_MODE: "AIV"
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
hardware_notes:
|
||||
ascend_950pr_8x:
|
||||
title: "vLLM Ascend A5 image required"
|
||||
body: "Single-node TP8 on 8×950PR. Pin quay.io/ascend/vllm-ascend:nightly-main-a5 and overlay vllm-ascend#15346 for native FP8. EP is not available on this interconnect. Set HCCL_BUFFSIZE=1024 before launch."
|
||||
dgx_station_gb300:
|
||||
title: "CPU weight offload (NVFP4)"
|
||||
body: "1× GB300 (252 GB HBM) plus unified host RAM. NVFP4 offloads MoE expert weights (w13_weight, w2_weight) with --offload-backend uva and --cpu-offload-gb 222. Set VLLM_WEIGHT_OFFLOADING_DISABLE_PIN_MEMORY=1. Context is capped at 262K / 8 seqs. FP8/BF16 still do not fit this box."
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
**GLM-5.3** is the newest model in the GLM-5 series — a ~743B-parameter MoE (39B active) from **Z-AI**.
|
||||
Architecture and serving flags are identical to GLM-5.2; the packaging change is that the
|
||||
**default `zai-org/GLM-5.3` checkpoint is now native FP8** — BF16 weights live under the suffixed `zai-org/GLM-5.3-BF16` repo.
|
||||
|
||||
The FP8 checkpoint fits on a single 8xH200 / 8xH20 node and — with FP8 KV cache — reaches the full 1M-token context on 8xB200.
|
||||
An NVFP4 checkpoint for Blackwell is published by Inferact (`Inferact/GLM-5.3-NVFP4`).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM 0.28.0** or newer.
|
||||
- **GPU:** 8xH200 or 8xH20 (141 GB each) for single-node FP8; 8xB200 (180 GB each) for the full 1M context.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install "vllm==0.28.0" --torch-backend=auto
|
||||
uv pip install "transformers>=5.15.0"
|
||||
```
|
||||
|
||||
## Launching the server
|
||||
|
||||
### FP8 on 8xH200 (standard)
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5.3 \
|
||||
--kv-cache-dtype fp8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 5 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--served-model-name glm-5.3
|
||||
```
|
||||
|
||||
### FP8 on AMD MI300X/MI325X/MI350X/MI355X
|
||||
|
||||
```bash
|
||||
VLLM_ROCM_USE_AITER=1 \
|
||||
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1 \
|
||||
vllm serve zai-org/GLM-5.3 \
|
||||
--kv-cache-dtype fp8_e4m3 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 5 \
|
||||
--tool-call-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--reasoning-parser glm47 \
|
||||
--gpu-memory-utilization 0.80 \
|
||||
--max-model-len 524288 \
|
||||
--max-num-seqs 32 \
|
||||
--linear-backend aiter \
|
||||
--moe-backend aiter
|
||||
```
|
||||
|
||||
On 8x MI325X with `vllm/vllm-openai-rocm:v0.29.0`, this command serves the full
|
||||
`--max-model-len 524288` at `--gpu-memory-utilization 0.80`, reporting a 1,477,168-token
|
||||
KV cache and 2.82x maximum concurrency. MTP is healthy there: a mean acceptance length of
|
||||
2.77 with 5 tokens drafted per step on a ~500-token greedy generation.
|
||||
|
||||
On 8x MI350X with the same image and settings, it reports a 2,013,072-token KV cache and
|
||||
3.84x maximum concurrency, and MTP's mean acceptance length is 3.19 with 5 tokens drafted
|
||||
per step on a 512-token greedy generation.
|
||||
|
||||
### FP8 on 8xB200 (full 1M context)
|
||||
|
||||
GLM-5.3 has a native 1M-token window. Whether the full window fits is a KV-cache VRAM
|
||||
question, so the lever is `--max-num-seqs` — it bounds how many sequences share the KV
|
||||
budget at once. **Start at 32** and scale with your node's VRAM. FP8 KV cache
|
||||
(`--kv-cache-dtype fp8_e4m3`, already in the base flags) roughly halves that budget.
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5.3 \
|
||||
--kv-cache-dtype fp8_e4m3 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 5 \
|
||||
--max-num-seqs 32 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--served-model-name glm-5.3
|
||||
```
|
||||
|
||||
- **`--max-num-seqs 32`** — the single knob for fitting 1M context; start at 32 and tune it
|
||||
to your VRAM (up on headroom, down on OOM).
|
||||
- **BF16** weights are served from `zai-org/GLM-5.3-BF16` and need multi-node deployment.
|
||||
|
||||
### NVFP4 on Blackwell (B200/B300)
|
||||
|
||||
The `Inferact/GLM-5.3-NVFP4` variant is Inferact's NVFP4 re-quantization : only the MoE expert linears drop to NVFP4 while shared experts,
|
||||
attention, embeddings, and the early dense layers stay BF16. The ~465 GB checkpoint fits comfortably on Blackwell
|
||||
Select the **NVFP4** variant above (Blackwell-only) or run:
|
||||
|
||||
```bash
|
||||
vllm serve Inferact/GLM-5.3-NVFP4 \
|
||||
--tensor-parallel-size 8 \
|
||||
--enable-expert-parallel \
|
||||
--reasoning-parser glm47 \
|
||||
--tool-call-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--kv-cache-dtype fp8_e4m3 \
|
||||
--served-model-name glm-5.3-nvfp4
|
||||
```
|
||||
|
||||
### DSpark (opt-in)
|
||||
|
||||
DSpark is an external confidence-scheduled drafter. Serve `zai-org/GLM-5.3` and attach
|
||||
[RedHatAI/GLM-5.3-speculator.dspark](https://huggingface.co/RedHatAI/GLM-5.3-speculator.dspark)
|
||||
with eight speculative tokens:
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5.3 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config '{"method":"dspark","model":"RedHatAI/GLM-5.3-speculator.dspark","num_speculative_tokens":8}'
|
||||
```
|
||||
|
||||
## Reasoning modes
|
||||
|
||||
Thinking is always on — the generation prompt opens a `<think>` block unconditionally.
|
||||
GLM-5.3 offers **three reasoning effort levels** driven by the `reasoning_effort`
|
||||
field; the default is **`max`**:
|
||||
|
||||
| Mode | How to request | Behavior |
|
||||
|------|----------------|----------|
|
||||
| **Think Max** (default) | omit `reasoning_effort`, or set `"max"` | Deepest reasoning — hard math, multi-step planning, agentic tasks. Highest token cost. |
|
||||
| **Think High** | `"reasoning_effort": "high"` | Balanced depth and latency. |
|
||||
| **Think Low** | `"reasoning_effort": "low"` | Lightest reasoning — simple Q&A, lowest latency and token cost. |
|
||||
|
||||
The chat template resolves effort to **`max` unless `reasoning_effort` is explicitly
|
||||
`"low"` or `"high"`** (any other value falls back to `max`), then injects
|
||||
`Reasoning Effort: Low|High|Max` into the system prompt. Pass it through
|
||||
`chat_template_kwargs` or the top-level OpenAI `reasoning_effort` field.
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
msgs = [{"role": "user", "content": "Summarize GLM-5.3 in one sentence."}]
|
||||
|
||||
# Think Max (default) — just omit reasoning_effort
|
||||
client.chat.completions.create(model="glm-5.3", messages=msgs, max_tokens=4096)
|
||||
|
||||
# Think High / Think Low — explicitly request the effort level
|
||||
client.chat.completions.create(
|
||||
model="glm-5.3",
|
||||
messages=msgs,
|
||||
max_tokens=4096,
|
||||
extra_body={"chat_template_kwargs": {"reasoning_effort": "low"}},
|
||||
)
|
||||
```
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "glm-5.3",
|
||||
"messages": [{"role": "user", "content": "Summarize GLM-5.3 in one sentence."}],
|
||||
"temperature": 1,
|
||||
"max_tokens": 4096,
|
||||
"chat_template_kwargs": {"reasoning_effort": "high"}
|
||||
}'
|
||||
```
|
||||
|
||||
## Client usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
response = client.chat.completions.create(
|
||||
model="glm-5.3",
|
||||
messages=[{"role": "user", "content": "Summarize GLM-5.3 in one sentence."}],
|
||||
temperature=1.0,
|
||||
max_tokens=256,
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
Add `--no-enable-prefix-caching` to the server command for a clean measurement.
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--model zai-org/GLM-5.3 \
|
||||
--dataset-name random \
|
||||
--random-input-len 8000 \
|
||||
--random-output-len 1024 \
|
||||
--request-rate 10 \
|
||||
--num-prompts 32 \
|
||||
--ignore-eos
|
||||
```
|
||||
|
||||
> **Note:** pure throughput benchmarks tend to under-report real speed, because MTP's
|
||||
> acceptance rate is usually low in synthetic runs.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **FP8 performance:** DeepGEMM is required — install via `install_deepgemm.sh`.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-5.3)
|
||||
- [BF16 checkpoint](https://huggingface.co/zai-org/GLM-5.3-BF16)
|
||||
- [NVFP4 checkpoint (Inferact)](https://huggingface.co/Inferact/GLM-5.3-NVFP4)
|
||||
- [DSpark draft](https://huggingface.co/RedHatAI/GLM-5.3-speculator.dspark)
|
||||
@@ -0,0 +1,234 @@
|
||||
meta:
|
||||
title: "GLM-5"
|
||||
slug: "glm-5"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-5 frontier-scale MoE language model (~744B total parameters, 28.5T training tokens) with asynchronous RL infrastructure for reasoning, coding, and agentic tasks"
|
||||
date_added: 2026-02-09
|
||||
date_updated: 2026-10-05
|
||||
tasks:
|
||||
- text
|
||||
performance_headline: "Frontier-scale MoE with 744B parameters, best-in-class open-source performance on reasoning/coding/agents"
|
||||
related_recipes: []
|
||||
hardware:
|
||||
h200: verified
|
||||
mi325x: verified
|
||||
mi350x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-5"
|
||||
min_vllm_version: "0.24.0"
|
||||
default_frontend: rust
|
||||
docker_image:
|
||||
# No ROCm release can run this yet: v0.31.0 fails to load the shared
|
||||
# experts without vLLM #58904. Switch to the first release that has it.
|
||||
amd: "vllm/vllm-openai-rocm:nightly-0cbac6cd1305f710e12193596b27488397bcb205"
|
||||
architecture: moe
|
||||
parameter_count: "744B"
|
||||
active_parameters: "40B"
|
||||
context_length: 202752
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
- "--chat-template-content-format=string"
|
||||
base_env: {}
|
||||
|
||||
features:
|
||||
tool_calling:
|
||||
description: "GLM-4.7 tool call parser with automatic tool choice"
|
||||
args:
|
||||
- "--tool-call-parser"
|
||||
- "glm47"
|
||||
- "--enable-auto-tool-choice"
|
||||
reasoning:
|
||||
description: "GLM-4.7 reasoning parser — thinking mode enabled by default on requests"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm47"
|
||||
spec_decoding:
|
||||
description: "Multi-Token Prediction speculative decoding (3 draft tokens)"
|
||||
args:
|
||||
- "--speculative-config.method"
|
||||
- "mtp"
|
||||
- "--speculative-config.num_speculative_tokens"
|
||||
- "3"
|
||||
|
||||
opt_in_features:
|
||||
- spec_decoding
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 1786
|
||||
description: "Full precision BF16 — requires multi-node deployment"
|
||||
fp8:
|
||||
model_id: "zai-org/GLM-5-FP8"
|
||||
precision: fp8
|
||||
vram_minimum_gb: 893
|
||||
description: "Native FP8 checkpoint — 8xH200/H20 (141GB x 8) single-node serving"
|
||||
nvfp4:
|
||||
model_id: "nvidia/GLM-5-NVFP4"
|
||||
precision: nvfp4
|
||||
vram_minimum_gb: 446
|
||||
description: "NVIDIA NVFP4 quantized weights for Blackwell GPUs"
|
||||
extra_args:
|
||||
- "--kv-cache-dtype"
|
||||
- "fp8"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- single_node_tep
|
||||
- multi_node_tp
|
||||
- multi_node_tp_pp
|
||||
- multi_node_tep
|
||||
- multi_node_dep
|
||||
- pd_cluster
|
||||
|
||||
hardware_overrides:
|
||||
amd:
|
||||
extra_args:
|
||||
- "--linear-backend"
|
||||
- "aiter"
|
||||
- "--moe-backend"
|
||||
- "aiter"
|
||||
extra_env:
|
||||
# Without AITER, the ROCm sparse-attention indexer only runs on gfx950/gfx11.
|
||||
VLLM_ROCM_USE_AITER: "1"
|
||||
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS: "1"
|
||||
# Loading the FP8 checkpoint on 8x MI325X can outlast the Rust
|
||||
# frontend's 600 s default wait for the engine.
|
||||
VLLM_ENGINE_READY_TIMEOUT_S: "3600"
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-5 is a significantly scaled-up language model with 744B parameters, trained on
|
||||
28.5T tokens using novel asynchronous RL infrastructure. It delivers best-in-class
|
||||
open-source performance on reasoning, coding, and agentic tasks, rivaling frontier
|
||||
closed-source models. GLM-5 is available in both BF16 and native FP8 precisions.
|
||||
|
||||
Thinking mode is enabled by default; disable it by passing
|
||||
`"chat_template_kwargs": {"enable_thinking": false}` in request extras.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** >= 0.24.0 for the `glm47` reasoning parser
|
||||
- **Hardware (FP8):** 8xH200 or 8xH20 (141GB × 8)
|
||||
- **DeepGEMM (FP8, NVIDIA):** install via `install_deepgemm.sh` from the vLLM repo
|
||||
- **Hardware (FP8, AMD):** 8x MI325X (256GB × 8) or 8x MI350X (288GB × 8), `vllm/vllm-openai-rocm:nightly-0cbac6cd1305f710e12193596b27488397bcb205`; uses AITER, not DeepGEMM
|
||||
|
||||
### Using Docker
|
||||
|
||||
```bash
|
||||
docker run --gpus all \
|
||||
-p 8000:8000 \
|
||||
--ipc=host \
|
||||
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
||||
vllm/vllm-openai:latest zai-org/GLM-5-FP8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--chat-template-content-format=string
|
||||
```
|
||||
|
||||
Use `vllm/vllm-openai:latest-cu129` for CUDA 12.x.
|
||||
|
||||
### Install vLLM from Source
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install "vllm==0.24.0" --torch-backend=auto
|
||||
uv pip install "transformers>=5.4.0"
|
||||
```
|
||||
|
||||
On NVIDIA, install DeepGEMM using `install_deepgemm.sh` from the vLLM tools directory.
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### FP8 on 8xH200 with MTP
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-5-FP8 \
|
||||
--tensor-parallel-size 8 \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 3 \
|
||||
--tool-call-parser glm47 \
|
||||
--reasoning-parser glm47 \
|
||||
--enable-auto-tool-choice \
|
||||
--chat-template-content-format=string \
|
||||
--served-model-name glm-5-fp8
|
||||
```
|
||||
|
||||
### FP8 on AMD MI325X and MI350X
|
||||
|
||||
Select **MI325X** or **MI350X** and the **FP8** variant in the command builder above. The
|
||||
generated command adds `VLLM_ROCM_USE_AITER=1`, `VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=1`,
|
||||
`--linear-backend aiter` and `--moe-backend aiter`, and raises `VLLM_ENGINE_READY_TIMEOUT_S`
|
||||
because loading the weights can take longer than the Rust frontend's 600 s default. The
|
||||
Docker command uses the nightly build
|
||||
`vllm/vllm-openai-rocm:nightly-0cbac6cd1305f710e12193596b27488397bcb205`.
|
||||
|
||||
On 8x MI325X that command, with MTP enabled, serves the full 202,752-token context with a
|
||||
1,292,544-token KV cache (6.38x maximum concurrency) and an MTP mean acceptance length of
|
||||
2.74 with 3 draft tokens on a ~380-token greedy generation.
|
||||
|
||||
On 8x MI350X the same command serves the full context with a 1,587,312-token KV cache (7.83x
|
||||
maximum concurrency) and an MTP mean acceptance length of 2.95 with 3 draft tokens on a
|
||||
512-token greedy generation.
|
||||
|
||||
## Client Usage
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
|
||||
# Thinking ON (default)
|
||||
resp_on = client.chat.completions.create(
|
||||
model="glm-5-fp8",
|
||||
messages=[{"role": "user", "content": "Summarize GLM-5 in one sentence."}],
|
||||
temperature=1,
|
||||
max_tokens=4096,
|
||||
)
|
||||
print("thinking=on, think content:\n", resp_on.choices[0].message.reasoning)
|
||||
|
||||
# Thinking OFF
|
||||
resp_off = client.chat.completions.create(
|
||||
model="glm-5-fp8",
|
||||
messages=[{"role": "user", "content": "Summarize GLM-5 in one sentence."}],
|
||||
temperature=1,
|
||||
max_tokens=4096,
|
||||
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
|
||||
)
|
||||
print("thinking=off:\n", resp_off.choices[0].message.reasoning)
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--model zai-org/GLM-5-FP8 \
|
||||
--dataset-name random \
|
||||
--random-input 8000 \
|
||||
--random-output 1024 \
|
||||
--request-rate 10 \
|
||||
--num-prompts 32 \
|
||||
--ignore-eos
|
||||
```
|
||||
|
||||
The MTP acceptance rate can be relatively low in pure benchmarks; measured throughput
|
||||
may underestimate real-world speed.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Accuracy drift:** Prefer the 0.19.0 stable release over nightly for best accuracy.
|
||||
- **Tool calling + MTP:** If you need both, use the latest vLLM main branch.
|
||||
- **FP8 installation (NVIDIA):** DeepGEMM is required for FP8 performance.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-5)
|
||||
- [FP8 checkpoint](https://huggingface.co/zai-org/GLM-5-FP8)
|
||||
- [DeepGEMM install script](https://github.com/vllm-project/vllm/blob/v0.16.0rc0/tools/install_deepgemm.sh)
|
||||
@@ -0,0 +1,170 @@
|
||||
meta:
|
||||
title: "GLM-ASR-Nano-2512"
|
||||
slug: "glm-asr-nano-2512"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "Open-source speech recognition model (~2B) with strong dialect support (Cantonese and others) and robust low-volume speech transcription"
|
||||
date_added: 2026-01-26
|
||||
date_updated: 2026-04-17
|
||||
tasks:
|
||||
- multimodal
|
||||
performance_headline: "Outperforms Whisper V3 on multiple benchmarks at compact 1.5B active / 2B total size"
|
||||
related_recipes: []
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-ASR-Nano-2512"
|
||||
min_vllm_version: "0.14.1"
|
||||
architecture: dense
|
||||
parameter_count: "2.3B"
|
||||
active_parameters: "1.5B"
|
||||
context_length: 8192
|
||||
base_args: []
|
||||
base_env: {}
|
||||
|
||||
dependencies:
|
||||
- note: "Audio extras required for ASR (requires vllm>=0.14.1)"
|
||||
command: 'uv pip install -U "vllm[audio]" --torch-backend auto'
|
||||
- note: "Install transformers from source for GLM-ASR tokenizer support"
|
||||
command: "uv pip install git+https://github.com/huggingface/transformers.git"
|
||||
|
||||
features: {}
|
||||
|
||||
opt_in_features: []
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 11
|
||||
description: "Full precision BF16 — single-GPU deployment"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- multi_node_tp
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides: {}
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-ASR-Nano-2512 is an open-source automatic speech recognition model with 1.5B
|
||||
active parameters (2B total). It outperforms OpenAI Whisper V3 on multiple benchmarks
|
||||
while remaining compact enough for single-GPU deployment.
|
||||
|
||||
### Key Capabilities
|
||||
|
||||
- **Dialect support:** Beyond standard Mandarin and English, strong on Cantonese
|
||||
(粤语) and other Chinese dialects.
|
||||
- **Low-volume speech:** Specifically trained for "whisper/quiet speech" scenarios.
|
||||
- **SOTA accuracy:** Lowest average error rate (4.10) among comparable open-source
|
||||
models, strong on Wenet Meeting, Aishell-1, and similar Chinese benchmarks.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** >= 0.14.1 (with `[audio]` extras)
|
||||
- **Transformers:** install from source for latest
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install git+https://github.com/huggingface/transformers.git
|
||||
uv pip install -U "vllm[audio]" --torch-backend auto
|
||||
```
|
||||
|
||||
## Launching the Server
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-ASR-Nano-2512
|
||||
```
|
||||
|
||||
## Client Usage
|
||||
|
||||
### OpenAI SDK (Audio URL)
|
||||
|
||||
```python
|
||||
import base64
|
||||
import httpx
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
|
||||
|
||||
audio_url = "https://github.com/zai-org/GLM-ASR/raw/main/examples/example_en.wav"
|
||||
audio_data = base64.b64encode(httpx.get(audio_url).content).decode("utf-8")
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="zai-org/GLM-ASR-Nano-2512",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [{
|
||||
"type": "input_audio",
|
||||
"input_audio": {"data": audio_data, "format": "wav"}
|
||||
}]
|
||||
}],
|
||||
max_tokens=500,
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
### Transcribe Endpoint
|
||||
|
||||
```python
|
||||
import httpx
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
|
||||
|
||||
audio_file = httpx.get("https://github.com/zai-org/GLM-ASR/raw/main/examples/example_en.wav").content
|
||||
|
||||
response = client.audio.transcriptions.create(
|
||||
model="zai-org/GLM-ASR-Nano-2512",
|
||||
file=("audio.wav", audio_file),
|
||||
)
|
||||
print(response.text)
|
||||
```
|
||||
|
||||
### cURL (Transcribe)
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/v1/audio/transcriptions \
|
||||
-H "Authorization: Bearer EMPTY" \
|
||||
-F "model=zai-org/GLM-ASR-Nano-2512" \
|
||||
-F "file=@your_audio.wav"
|
||||
```
|
||||
|
||||
### Local Audio File (chat API)
|
||||
|
||||
```python
|
||||
import base64
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
|
||||
|
||||
with open("your_audio.mp3", "rb") as f:
|
||||
audio_data = base64.b64encode(f.read()).decode("utf-8")
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="zai-org/GLM-ASR-Nano-2512",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [{"type": "input_audio", "input_audio": {"data": audio_data, "format": "mp3"}}]
|
||||
}],
|
||||
max_tokens=500,
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Transformers version:** Requires `transformers >= 5.0.0` for best compatibility.
|
||||
- **Audio formats:** Supports wav, mp3, flac, and other common formats.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-ASR-Nano-2512)
|
||||
- [GitHub repo](https://github.com/zai-org/GLM-ASR)
|
||||
@@ -0,0 +1,161 @@
|
||||
meta:
|
||||
title: "GLM-GA"
|
||||
slug: "glm-ga"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-GA dense vision-language model (~10B) — image and video understanding with 128K context and dedicated Glmga video processor (fps=2, up to 640 frames)"
|
||||
date_added: 2026-06-03
|
||||
date_updated: 2026-05-27
|
||||
tasks:
|
||||
- multimodal
|
||||
performance_headline: "Dense VLM based on GLM-4.6V-Flash with dedicated video processor supporting long videos up to 640 frames"
|
||||
related_recipes:
|
||||
- zai-org/GLM-4.6V
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-GA"
|
||||
min_vllm_version: "0.21.0"
|
||||
architecture: dense
|
||||
parameter_count: "10B"
|
||||
context_length: 131072
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
- "--allowed-local-media-path"
|
||||
- "/"
|
||||
- "--mm-processor-cache-type"
|
||||
- "shm"
|
||||
- "--reasoning-parser"
|
||||
- "glm45"
|
||||
base_env: {VLLM_VIDEO_LOADER_BACKEND: "glm4_6v"}
|
||||
|
||||
dependencies:
|
||||
- command: "uv pip install git+https://github.com/huggingface/transformers.git"
|
||||
note: "Latest transformers from main branch for GlmgaImageProcessor / GlmgaVideoProcessor support"
|
||||
|
||||
features:
|
||||
text_only:
|
||||
description: "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache."
|
||||
args:
|
||||
- "--language-model-only"
|
||||
|
||||
opt_in_features:
|
||||
- text_only
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 29
|
||||
description: "Full precision BF16 — runs on a single H100/H200"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- multi_node_tp
|
||||
|
||||
hardware_overrides: {}
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-GA is a dense vision-language model (~10B parameters) based on the
|
||||
GLM-4.6V-Flash architecture. It shares the same `Glm4vForConditionalGeneration`
|
||||
model class as GLM-4.6V but uses dedicated `GlmgaImageProcessor` and
|
||||
`GlmgaVideoProcessor` sub-processors. The key difference is in video processing:
|
||||
GLM-GA samples at a fixed 2 fps and supports up to 640 frames, enabling
|
||||
long-video understanding.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** >= 0.21.0
|
||||
- **Transformers:** latest (required for Glmga processor support)
|
||||
- **Hardware:** 1x H100/H200 or equivalent (BF16)
|
||||
|
||||
### Install vLLM
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --torch-backend auto
|
||||
uv pip install git+https://github.com/huggingface/transformers.git
|
||||
```
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### Single GPU
|
||||
|
||||
```bash
|
||||
export VLLM_VIDEO_LOADER_BACKEND=glm4_6v
|
||||
vllm serve zai-org/GLM-GA \
|
||||
--tool-call-parser glm45 \
|
||||
--reasoning-parser glm45 \
|
||||
--enable-auto-tool-choice \
|
||||
--allowed-local-media-path / \
|
||||
--mm-processor-cache-type shm
|
||||
```
|
||||
|
||||
### Tuning Tips
|
||||
|
||||
- `--max-model-len=65536` is a common default; you can push to 131072.
|
||||
- `--max-num-batched-tokens=32768` for prompt-heavy workloads.
|
||||
- `--mm-processor-cache-type shm` for efficient vision processing.
|
||||
|
||||
## Client Usage
|
||||
|
||||
### Image Understanding
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
resp = client.chat.completions.create(
|
||||
model="zai-org/GLM-GA",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
|
||||
{"type": "text", "text": "Describe the image."}
|
||||
]
|
||||
}],
|
||||
max_tokens=512,
|
||||
)
|
||||
print(resp.choices[0].message.content)
|
||||
```
|
||||
|
||||
### Video Understanding
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
||||
resp = client.chat.completions.create(
|
||||
model="zai-org/GLM-GA",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "video_url", "video_url": {"url": "https://example.com/video.mp4"}},
|
||||
{"type": "text", "text": "Summarize what happens in this video."}
|
||||
]
|
||||
}],
|
||||
max_tokens=1024,
|
||||
)
|
||||
print(resp.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Video Processing Details
|
||||
|
||||
GLM-GA uses a dedicated `GlmgaVideoProcessor` that differs from GLM-4.6V:
|
||||
- Fixed 2 fps sampling (GLM-4.6V uses dynamic fps based on duration)
|
||||
- Up to 640 frames per video
|
||||
- Frame upsampling uses `math.floor` alignment matching the HuggingFace reference
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Long-context memory:** At 128K context, tune `--max-num-batched-tokens` and
|
||||
`--gpu-memory-utilization` to prevent OOM.
|
||||
- **Video loading errors:** Ensure OpenCV or PyAV is installed for video decoding.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-GA)
|
||||
- [GLM-4.6V-Flash](https://huggingface.co/zai-org/GLM-4.6V-Flash) (base architecture)
|
||||
- [vLLM multimodal inputs guide](https://docs.vllm.ai/en/latest/features/multimodal_inputs.html)
|
||||
@@ -0,0 +1,158 @@
|
||||
meta:
|
||||
title: "GLM-OCR"
|
||||
slug: "glm-ocr"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "GLM-OCR image-to-text model with built-in MTP speculative decoding for high-throughput OCR serving"
|
||||
date_added: 2026-01-26
|
||||
date_updated: 2026-04-17
|
||||
tasks:
|
||||
- multimodal
|
||||
performance_headline: "Multilingual end-to-end OCR VLM with MTP-accelerated decoding"
|
||||
related_recipes: []
|
||||
|
||||
model:
|
||||
model_id: "zai-org/GLM-OCR"
|
||||
min_vllm_version: "0.16.0"
|
||||
architecture: dense
|
||||
parameter_count: "0.9B"
|
||||
active_parameters: "0.9B"
|
||||
context_length: 131072
|
||||
base_args: []
|
||||
base_env: {}
|
||||
|
||||
dependencies:
|
||||
- note: "GLM-OCR requires the nightly vllm wheel"
|
||||
command: "uv pip install -U vllm --pre --extra-index-url https://wheels.vllm.ai/nightly"
|
||||
- note: "transformers from source for GLM-OCR tokenizer support"
|
||||
command: "uv pip install git+https://github.com/huggingface/transformers.git"
|
||||
|
||||
features:
|
||||
spec_decoding:
|
||||
description: "Multi-Token Prediction speculative decoding using the model's built-in MTP layers"
|
||||
args:
|
||||
- "--speculative-config.method"
|
||||
- "mtp"
|
||||
- "--speculative-config.num_speculative_tokens"
|
||||
- "1"
|
||||
text_only:
|
||||
description: "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache. Mutually exclusive with encoder_parallel."
|
||||
args:
|
||||
- "--language-model-only"
|
||||
encoder_parallel:
|
||||
description: "Run the vision encoder in data-parallel mode — avoids TP comm overhead on the small encoder. Mutually exclusive with text_only."
|
||||
args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
|
||||
opt_in_features:
|
||||
- text_only
|
||||
- encoder_parallel
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 2
|
||||
description: "Full precision BF16 — single-GPU deployment"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- multi_node_tp
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides: {}
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-OCR is a vision-language model for end-to-end OCR. It includes built-in
|
||||
Multi-Token Prediction (MTP) layers enabling speculative decoding for higher
|
||||
throughput generation.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** nightly recommended (or latest stable with MTP support)
|
||||
- **Transformers:** >= 5.0.0 (install from source for latest)
|
||||
|
||||
### Install vLLM
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --torch-backend auto
|
||||
```
|
||||
|
||||
Or nightly:
|
||||
|
||||
```bash
|
||||
uv pip install -U vllm --pre --extra-index-url https://wheels.vllm.ai/nightly
|
||||
uv pip install git+https://github.com/huggingface/transformers.git
|
||||
```
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### With MTP Speculative Decoding
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/GLM-OCR \
|
||||
--speculative-config.method mtp \
|
||||
--speculative-config.num_speculative_tokens 1
|
||||
```
|
||||
|
||||
## Client Usage
|
||||
|
||||
### OpenAI SDK
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1", timeout=3600)
|
||||
|
||||
messages = [{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://ofasys-multimodal-wlcb-3-toshanghai.oss-accelerate.aliyuncs.com/wpf272043/keepme/image/receipt.png"}},
|
||||
{"type": "text", "text": "Text Recognition:"}
|
||||
]
|
||||
}]
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="zai-org/GLM-OCR",
|
||||
messages=messages,
|
||||
max_tokens=2048,
|
||||
temperature=0.0,
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
### cURL
|
||||
|
||||
```bash
|
||||
curl -s http://localhost:8000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "zai-org/GLM-OCR",
|
||||
"messages": [{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://example.com/receipt.png"}},
|
||||
{"type": "text", "text": "Text Recognition:"}
|
||||
]
|
||||
}],
|
||||
"max_tokens": 2048,
|
||||
"temperature": 0.0
|
||||
}'
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Greedy sampling recommended:** Use `temperature=0.0` for optimal OCR accuracy.
|
||||
- **Transformers version:** Requires `transformers >= 5.0.0`.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/GLM-OCR)
|
||||
@@ -0,0 +1,156 @@
|
||||
meta:
|
||||
title: "Glyph"
|
||||
slug: "glyph"
|
||||
provider: "GLM (Z-AI)"
|
||||
description: "Visual-text compression framework that renders long text into images and processes them with a reasoning VLM, scaling effective context length"
|
||||
date_added: 2025-10-28
|
||||
date_updated: 2026-04-17
|
||||
tasks:
|
||||
- multimodal
|
||||
performance_headline: "Reasoning multimodal model for visual-text compression, single-GPU deployable"
|
||||
related_recipes: []
|
||||
hardware:
|
||||
h100: verified
|
||||
mi300x: verified
|
||||
mi325x: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/Glyph"
|
||||
min_vllm_version: "0.11.0"
|
||||
architecture: dense
|
||||
parameter_count: "10B"
|
||||
active_parameters: "10B"
|
||||
context_length: 131072
|
||||
base_args:
|
||||
- "--no-enable-prefix-caching"
|
||||
- "--mm-processor-cache-gb"
|
||||
- "0"
|
||||
- "--limit-mm-per-prompt.video"
|
||||
- "0"
|
||||
base_env: {}
|
||||
|
||||
features:
|
||||
reasoning:
|
||||
description: "GLM-4.5 reasoning parser for extracting reasoning traces from Glyph outputs"
|
||||
args:
|
||||
- "--reasoning-parser"
|
||||
- "glm45"
|
||||
text_only:
|
||||
description: "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache. Mutually exclusive with encoder_parallel."
|
||||
args:
|
||||
- "--language-model-only"
|
||||
encoder_parallel:
|
||||
description: "Run the vision encoder in data-parallel mode — avoids TP comm overhead on the small encoder. Mutually exclusive with text_only."
|
||||
args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
|
||||
opt_in_features:
|
||||
- text_only
|
||||
- encoder_parallel
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 24
|
||||
description: "Full precision BF16 — single-GPU deployment on 1xH100"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- multi_node_tp
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides: {}
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
[Glyph](https://github.com/thu-coai/Glyph) is a framework from Zhipu AI for scaling
|
||||
context length via visual-text compression. It renders long textual sequences into
|
||||
images and processes them with a vision-language model. This recipe covers the vLLM
|
||||
deployment of the `zai-org/Glyph` VLM as a component in that framework.
|
||||
|
||||
Glyph is a reasoning multimodal model, so `--reasoning-parser glm45` is recommended
|
||||
to parse reasoning traces from outputs.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **vLLM version:** latest stable
|
||||
- **Hardware:** 1x H100 or 1x MI300X/MI325X
|
||||
|
||||
### Install vLLM (NVIDIA)
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --torch-backend auto
|
||||
```
|
||||
|
||||
### Install vLLM (AMD ROCm)
|
||||
|
||||
```bash
|
||||
uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm
|
||||
```
|
||||
|
||||
ROCm wheel requires Python 3.12, ROCm 7.0, glibc >= 2.35.
|
||||
|
||||
## Launching the Server
|
||||
|
||||
### Single H100 GPU
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/Glyph \
|
||||
--no-enable-prefix-caching \
|
||||
--mm-processor-cache-gb 0 \
|
||||
--reasoning-parser glm45 \
|
||||
--limit-mm-per-prompt.video 0
|
||||
```
|
||||
|
||||
### Single MI300X / MI325X
|
||||
|
||||
```bash
|
||||
VLLM_ROCM_USE_AITER=1 \
|
||||
SAFETENSORS_FAST_GPU=1 \
|
||||
vllm serve zai-org/Glyph \
|
||||
--no-enable-prefix-caching \
|
||||
--mm-processor-cache-gb 0 \
|
||||
--reasoning-parser glm45 \
|
||||
--limit-mm-per-prompt.video 0
|
||||
```
|
||||
|
||||
### Configuration Tips
|
||||
|
||||
- `--no-enable-prefix-caching` and `--mm-processor-cache-gb 0` are recommended for
|
||||
OCR-like workloads where image reuse is uncommon; they avoid unnecessary hashing
|
||||
and caching overhead.
|
||||
- Adjust `--max-num-batched-tokens` for throughput according to your hardware.
|
||||
|
||||
## Benchmarking
|
||||
|
||||
```bash
|
||||
vllm bench serve \
|
||||
--model zai-org/Glyph \
|
||||
--dataset-name random \
|
||||
--random-input-len 8192 \
|
||||
--random-output-len 512 \
|
||||
--request-rate 10000 \
|
||||
--num-prompts 16 \
|
||||
--ignore-eos
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Reasoning traces:** Use `--reasoning-parser glm45` to extract reasoning content.
|
||||
- **Slow first inference:** Disabling prefix caching and multimodal processor caching
|
||||
is intentional for Glyph's use case and trades off first-request latency for predictable throughput.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/Glyph)
|
||||
- [Glyph framework on GitHub](https://github.com/thu-coai/Glyph)
|
||||
- [vLLM deployment section of Glyph docs](https://github.com/thu-coai/Glyph?tab=readme-ov-file#model-deployment-vllm-acceleration)
|
||||
@@ -0,0 +1,99 @@
|
||||
meta:
|
||||
title: "GLM-4-9B"
|
||||
slug: "glm-4-9b-hf"
|
||||
provider: "Z.ai"
|
||||
description: "GLM-4 9B dense base language model with 8K context."
|
||||
date_added: 2026-08-19
|
||||
date_updated: 2026-09-12
|
||||
tasks:
|
||||
- text
|
||||
performance_headline: "Validated on Intel Xeon 6 with BF16 serving"
|
||||
hardware:
|
||||
xeon6: verified
|
||||
|
||||
model:
|
||||
model_id: "zai-org/glm-4-9b-hf"
|
||||
min_vllm_version: "0.6.5"
|
||||
architecture: dense
|
||||
parameter_count: "9B"
|
||||
active_parameters: "9B"
|
||||
context_length: 8192
|
||||
base_args: []
|
||||
base_env: {}
|
||||
|
||||
features: {}
|
||||
|
||||
opt_in_features: []
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 22
|
||||
description: "Full precision BF16"
|
||||
supported_hardware:
|
||||
- xeon6
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- multi_node_tp
|
||||
|
||||
hardware_overrides: {}
|
||||
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
GLM-4-9B is the dense base model in the GLM-4 9B family. Intel Xeon 6 CPU
|
||||
serving was validated with BF16.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Hardware: Intel Xeon 6/Xeon 5 CPUs
|
||||
- vLLM >= 0.6.5
|
||||
|
||||
### Docker (Intel Xeon 6 CPUs)
|
||||
|
||||
```bash
|
||||
docker pull vllm/vllm-openai-cpu:latest-x86_64
|
||||
```
|
||||
|
||||
## Intel Xeon 6
|
||||
|
||||
```bash
|
||||
vllm serve zai-org/glm-4-9b-hf \
|
||||
--tensor-parallel-size 1
|
||||
```
|
||||
|
||||
Docker (the image entrypoint is `vllm serve`):
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
--privileged --ipc=host -p 8000:8000 \
|
||||
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
||||
vllm/vllm-openai-cpu:latest-x86_64 zai-org/glm-4-9b-hf \
|
||||
--tensor-parallel-size 1
|
||||
```
|
||||
|
||||
The example uses TP=1. Adjust TP/DP for the deployment topology;
|
||||
host-specific CPU placement is intentionally not hard-coded.
|
||||
|
||||
## Runtime and Platform Tuning
|
||||
|
||||
The following settings are intentionally not prescribed as portable CPU model
|
||||
defaults because they depend on the workload, hardware, or runtime environment:
|
||||
|
||||
- `--max-num-batched-tokens`: scheduler/throughput tuning.
|
||||
- `--max-num-seqs`: concurrency and scheduler-capacity tuning.
|
||||
- `--gpu-memory-utilization`: platform memory-budget tuning.
|
||||
- `--no-enable-prefix-caching`: workload/benchmark cache-policy tuning.
|
||||
- `VLLM_ENGINE_ITERATION_TIMEOUT_S`: operational runtime timeout.
|
||||
|
||||
These settings may still appear in validated hardware-specific overrides. Tune
|
||||
them at deployment time based on platform resources, workload shape, and
|
||||
latency/throughput goals.
|
||||
|
||||
## References
|
||||
|
||||
- [Model card](https://huggingface.co/zai-org/glm-4-9b-hf)
|
||||
- [vLLM CPU installation](https://docs.vllm.ai/en/latest/getting_started/installation/cpu/)
|
||||
Reference in New Issue
Block a user