[Docs] GLM-4.7 cookbook: add NVIDIA Blackwell (B200, GB200) + NVFP4 sections (#26384)

Co-authored-by: Hao Phan <htphan@nvidia.com>
Co-authored-by: Zijie Xia <zijie.xia@radixark.ai>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thanhhao
2026-06-01 20:47:51 -07:00
committed by GitHub
co-authored by Hao Phan Zijie Xia Claude Opus 4.8
parent 951fa05a09
commit 1c0019da75
2 changed files with 529 additions and 45 deletions
+404 -14
View File
@@ -1,14 +1,14 @@
---
title: GLM-4.7
metatags:
description: "Deploy GLM-4.7 with SGLang on AMD GPUs - state-of-the-art reasoning, enhanced coding, and robust tool calling capabilities."
description: "Deploy GLM-4.7 with SGLang on NVIDIA Blackwell (B200, GB200) and AMD GPUs - state-of-the-art reasoning, robust tool calling, and NVFP4 weights for Blackwell."
---
## 1. Model Introduction
[GLM-4.7](https://huggingface.co/zai-org/GLM-4.7) is the latest and most powerful language model in the GLM series developed by Zhipu AI, featuring state-of-the-art capabilities in reasoning, function calling, and multi-modal understanding.
[GLM-4.7](https://huggingface.co/zai-org/GLM-4.7) is a powerful language model developed by Zhipu AI, featuring advanced capabilities in reasoning, function calling, and agent workflows.
As the newest iteration in the GLM series, GLM-4.7 achieves significant improvements across all domains:
GLM-4.7 brings improvements across all major domains:
- **Extended Context Window**: Expanded context window supporting even longer documents and complex multi-turn conversations
- **Enhanced Reasoning**: Improved reasoning capabilities with better chain-of-thought processing
@@ -21,14 +21,15 @@ For more details, please refer to the [official GLM-4.7 documentation](https://d
**Key Features:**
- **State-of-the-Art Reasoning**: Enhanced reasoning capabilities for the most complex problem-solving tasks
- **Multiple Quantizations**: BF16 and FP8 variants for different performance/memory trade-offs
- **Hardware Optimization**: Specifically tuned for AMD MI300X/MI325X/MI355X GPUs
- **Multiple Quantizations**: BF16, FP8, and NVFP4 variants for different performance/memory trade-offs
- **Hardware Optimization**: Tuned for NVIDIA Blackwell (B200, GB200) and AMD MI300X/MI325X/MI355X GPUs
- **High Performance**: Optimized for both throughput and latency scenarios
**Available Models:**
- **BF16 (Full precision)**: [zai-org/GLM-4.7](https://huggingface.co/zai-org/GLM-4.7) - Recommended for MI300X/MI325X/MI355X
- **FP8 (8-bit quantized)**: [zai-org/GLM-4.7-FP8](https://huggingface.co/zai-org/GLM-4.7-FP8) - Recommended for MI300X/MI325X/MI355X
- **BF16 (Full precision)**: [zai-org/GLM-4.7](https://huggingface.co/zai-org/GLM-4.7)
- **FP8 (8-bit quantized)**: [zai-org/GLM-4.7-FP8](https://huggingface.co/zai-org/GLM-4.7-FP8)
- **NVFP4 (4-bit, NVIDIA Blackwell)**: [nvidia/GLM-4.7-NVFP4](https://huggingface.co/nvidia/GLM-4.7-NVFP4)
**License:**
@@ -40,6 +41,36 @@ SGLang offers multiple installation methods. You can choose the most suitable in
Please refer to the [official SGLang installation guide](../../../docs/get-started/install) for installation instructions.
**Docker Images by Hardware Platform:**
<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
<thead>
<tr style={{borderBottom: "2px solid #d55816"}}>
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Hardware Platform</th>
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>Docker Image</th>
</tr>
</thead>
<tbody>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>NVIDIA H100 / H200 / B200</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`lmsysorg/sglang:v0.5.12`</td>
</tr>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>NVIDIA GB200 / B300 / GB300 (aarch64)</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`lmsysorg/sglang:v0.5.12-cu130`</td>
</tr>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>AMD MI300X / MI325X</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`lmsysorg/sglang:v0.5.12-rocm720-mi30x`</td>
</tr>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>AMD MI355X</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>`lmsysorg/sglang:v0.5.12-rocm720-mi35x`</td>
</tr>
</tbody>
</table>
## 3. Model Deployment
This section provides deployment configurations optimized for different hardware platforms and use cases.
@@ -54,9 +85,50 @@ import { GLM47Deployment } from "/src/snippets/autoregressive/glm-47-deployment.
### 3.2 Configuration Tips
Pick a weight format by hardware: **NVFP4** on NVIDIA Blackwell (B200, GB200), **FP8** on H100/H200/AMD, **BF16** as the full-precision fallback. The recommended tensor-parallel size per platform:
<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
<thead>
<tr style={{borderBottom: "2px solid #d55816"}}>
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>Hardware</th>
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>NVFP4</th>
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.02)"}}>FP8</th>
<th style={{textAlign: "left", padding: "10px 12px", fontWeight: 700, whiteSpace: "nowrap", backgroundColor: "rgba(255,255,255,0.05)"}}>BF16</th>
</tr>
</thead>
<tbody>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>B200 (8×, single node)</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>tp=2 / 4 / 8</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>tp=4 / 8</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>tp=8</td>
</tr>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>GB200 (NVL72, 4× per tray)</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>tp=2 / 4</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>tp=4</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>—</td>
</tr>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>H200 (8×)</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>—</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>tp=8</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>tp=8</td>
</tr>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>AMD MI300X / MI325X / MI355X</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>—</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>tp=2 / 4 / 8</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>tp=4 / 8</td>
</tr>
</tbody>
</table>
- **EAGLE Speculative Decoding:** Supported for GLM-4.7. Add `--speculative-algorithm EAGLE --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4`. The spec-v2 overlap scheduler is enabled by default (`SGLANG_ENABLE_SPEC_V2=True`); set `SGLANG_ENABLE_SPEC_V2=0` to disable. Enable via the interactive command generator above.
- **Thinking Budget:** Use `--enable-custom-logit-processor` flag and pass `Glm4MoeThinkingBudgetLogitProcessor` in requests to cap the model's thinking token count (see section 4.2.3).
For general GLM-4.x family launch guidance (AMD ROCm notes and more), see [Launch GLM-4.5 / GLM-4.6 / GLM-4.7 with SGLang](../../../docs/basic_usage/glm45). Per-hardware bench commands and flags are inline in §5.1 below.
## 4. Model Invocation
### 4.1 Basic Usage
@@ -331,10 +403,10 @@ This section uses **industry-standard configurations** for comparable benchmark
**Test Environment:**
- Hardware: AMD MI300X (8x), AMD MI325X (8x), AMD MI355X (8x)
- Model: GLM-4.7
- Tensor Parallelism: 8
- SGLang Version: 0.5.6.post1
- Hardware: NVIDIA B200, NVIDIA GB200, AMD MI300X/MI325X/MI355X (8x)
- Model: GLM-4.7-NVFP4 on NVIDIA Blackwell; GLM-4.7-FP8 or GLM-4.7 (BF16) on AMD
- SGLang Version: 0.5.12 (NVIDIA Blackwell), 0.5.6.post1 (AMD)
- Best per-GPU throughput config on B200: **TP=2 NVFP4 bf16-KV** (NVFP4 weights, no EP). Numbers below come from this config.
**Benchmark Methodology:**
@@ -342,7 +414,7 @@ We use industry-standard benchmark configurations to ensure results are comparab
#### 5.1.1 Standard Test Scenarios
Three core scenarios reflect real-world usage patterns:
Four core scenarios reflect real-world usage patterns:
<table style={{width: "100%", borderCollapse: "collapse", tableLayout: "fixed"}}>
<colgroup>
@@ -378,6 +450,12 @@ Three core scenarios reflect real-world usage patterns:
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>1K</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Document summarization, RAG retrieval</td>
</tr>
<tr>
<td style={{padding: "9px 12px", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.02)"}}>**Throughput**</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>4K</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.02)"}}>1K</td>
<td style={{padding: "9px 12px", backgroundColor: "rgba(255,255,255,0.05)"}}>Mixed RAG / agent / multi-turn conversation (used for the inline B200 / GB200 results below)</td>
</tr>
</tbody>
</table>
@@ -387,7 +465,7 @@ Test each scenario at three concurrency levels to capture the throughput vs. lat
- **Low Concurrency**: `--max-concurrency 1` (Latency-optimized)
- **Medium Concurrency**: `--max-concurrency 16` (Balanced)
- **High Concurrency**: `--max-concurrency 100` (Throughput-optimized)
- **High Concurrency**: `--max-concurrency 100` (Throughput-optimized) — the Throughput (4K/1K) scenario uses `--max-concurrency 128` to match the inline B200/GB200 results below.
#### 5.1.3 Number of Prompts
@@ -534,6 +612,302 @@ python -m sglang.bench_serving \
--request-rate inf
```
**Scenario 4: Throughput (4K/1K) — NVIDIA Blackwell with NVFP4**
The remaining sub-sections (§5.1.4.1 NVIDIA B200, §5.1.4.2 NVIDIA GB200) measure this scenario with `nvidia/GLM-4.7-NVFP4` weights and report the full `bench_serving` output verbatim. The same commands apply to other NVIDIA hardware after substituting the deployment line from §3.1.
> **Note**: These runs use EOS-enabled generation (no `--disable-ignore-eos`), so generated-token counts reflect natural model behavior rather than a strict fixed-OSL pin. Compare against other EOS-enabled runs at the same workload, not against fixed-output-length benchmarks.
#### 5.1.4.1 NVIDIA B200
**Model Deployment (NVIDIA B200, TP=2 NVFP4 — max tok/s/gpu config):**
```bash Command
python -m sglang.launch_server \
--model nvidia/GLM-4.7-NVFP4 \
--tp-size 2 \
--mem-fraction-static 0.85 \
--reasoning-parser glm45 \
--tool-call-parser glm47
```
- Low Concurrency (Latency-Optimized)
```bash Command
python -m sglang.bench_serving \
--backend sglang \
--model nvidia/GLM-4.7-NVFP4 \
--dataset-name random \
--random-input-len 4096 \
--random-output-len 1024 \
--num-prompts 5 \
--max-concurrency 1 \
--request-rate inf
```
```text Output
============ Serving Benchmark Result ============
Backend: sglang
Max request concurrency: 1
Successful requests: 5
Benchmark duration (s): 25.07
Total input tokens: 8105
Total generated tokens: 2674
Request throughput (req/s): 0.20
Input token throughput (tok/s): 323.25
Output token throughput (tok/s): 106.65
Total token throughput (tok/s): 429.90
Concurrency: 1.00
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 5011.93
Median E2E Latency (ms): 6441.44
---------------Time to First Token----------------
Mean TTFT (ms): 179.61
Median TTFT (ms): 169.05
P99 TTFT (ms): 238.01
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 9.05
Median TPOT (ms): 9.03
P99 TPOT (ms): 9.16
---------------Inter-Token Latency----------------
Mean ITL (ms): 9.05
Median ITL (ms): 9.05
==================================================
```
- Medium Concurrency (Balanced)
```bash Command
python -m sglang.bench_serving \
--backend sglang \
--model nvidia/GLM-4.7-NVFP4 \
--dataset-name random \
--random-input-len 4096 \
--random-output-len 1024 \
--num-prompts 80 \
--max-concurrency 16 \
--request-rate inf
```
```text Output
============ Serving Benchmark Result ============
Backend: sglang
Max request concurrency: 16
Successful requests: 80
Benchmark duration (s): 60.60
Total input tokens: 179772
Total generated tokens: 39657
Request throughput (req/s): 1.32
Input token throughput (tok/s): 2966.39
Output token throughput (tok/s): 654.37
Total token throughput (tok/s): 3620.76
Concurrency: 14.01
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 10615.87
Median E2E Latency (ms): 9985.45
---------------Time to First Token----------------
Mean TTFT (ms): 267.39
Median TTFT (ms): 177.26
P99 TTFT (ms): 584.29
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 20.98
Median TPOT (ms): 21.06
P99 TPOT (ms): 24.88
---------------Inter-Token Latency----------------
Mean ITL (ms): 20.92
Median ITL (ms): 17.93
==================================================
```
- High Concurrency (Throughput-Optimized)
```bash Command
python -m sglang.bench_serving \
--backend sglang \
--model nvidia/GLM-4.7-NVFP4 \
--dataset-name random \
--random-input-len 4096 \
--random-output-len 1024 \
--num-prompts 640 \
--max-concurrency 128 \
--request-rate inf
```
```text Output
============ Serving Benchmark Result ============
Backend: sglang
Max request concurrency: 128
Successful requests: 640
Benchmark duration (s): 172.95
Total input tokens: 1453591
Total generated tokens: 308740
Request throughput (req/s): 3.70
Input token throughput (tok/s): 8404.67
Output token throughput (tok/s): 1785.14
Total token throughput (tok/s): 10189.80
Concurrency: 117.85
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 31848.20
Median E2E Latency (ms): 28554.42
---------------Time to First Token----------------
Mean TTFT (ms): 1598.40
Median TTFT (ms): 298.88
P99 TTFT (ms): 11015.96
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 65.94
Median TPOT (ms): 65.81
P99 TPOT (ms): 137.73
---------------Inter-Token Latency----------------
Mean ITL (ms): 62.99
Median ITL (ms): 35.44
==================================================
```
#### 5.1.4.2 NVIDIA GB200
**Model Deployment (NVIDIA GB200, TP=2 NVFP4 — max tok/s/gpu config):**
```bash Command
python -m sglang.launch_server \
--model nvidia/GLM-4.7-NVFP4 \
--tp-size 2 \
--mem-fraction-static 0.85 \
--reasoning-parser glm45 \
--tool-call-parser glm47
```
- Low Concurrency (Latency-Optimized)
```bash Command
python -m sglang.bench_serving \
--backend sglang \
--model nvidia/GLM-4.7-NVFP4 \
--dataset-name random \
--random-input-len 4096 \
--random-output-len 1024 \
--num-prompts 5 \
--max-concurrency 1 \
--request-rate inf
```
```text Output
============ Serving Benchmark Result ============
Backend: sglang
Max request concurrency: 1
Successful requests: 5
Benchmark duration (s): 24.74
Total input tokens: 8105
Total generated tokens: 2674
Request throughput (req/s): 0.20
Input token throughput (tok/s): 327.65
Output token throughput (tok/s): 108.10
Total token throughput (tok/s): 435.75
Concurrency: 1.00
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 4944.47
Median E2E Latency (ms): 6347.31
---------------Time to First Token----------------
Mean TTFT (ms): 211.41
Median TTFT (ms): 207.25
P99 TTFT (ms): 226.46
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 8.86
Median TPOT (ms): 8.84
P99 TPOT (ms): 8.96
---------------Inter-Token Latency----------------
Mean ITL (ms): 8.87
Median ITL (ms): 8.85
==================================================
```
- Medium Concurrency (Balanced)
```bash Command
python -m sglang.bench_serving \
--backend sglang \
--model nvidia/GLM-4.7-NVFP4 \
--dataset-name random \
--random-input-len 4096 \
--random-output-len 1024 \
--num-prompts 80 \
--max-concurrency 16 \
--request-rate inf
```
```text Output
============ Serving Benchmark Result ============
Backend: sglang
Max request concurrency: 16
Successful requests: 80
Benchmark duration (s): 60.40
Total input tokens: 179772
Total generated tokens: 39657
Request throughput (req/s): 1.32
Input token throughput (tok/s): 2976.52
Output token throughput (tok/s): 656.61
Total token throughput (tok/s): 3633.13
Concurrency: 13.97
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 10611.51
Median E2E Latency (ms): 9956.84
---------------Time to First Token----------------
Mean TTFT (ms): 338.14
Median TTFT (ms): 215.25
P99 TTFT (ms): 915.40
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 20.87
Median TPOT (ms): 21.36
P99 TPOT (ms): 27.05
---------------Inter-Token Latency----------------
Mean ITL (ms): 20.77
Median ITL (ms): 16.53
==================================================
```
- High Concurrency (Throughput-Optimized)
```bash Command
python -m sglang.bench_serving \
--backend sglang \
--model nvidia/GLM-4.7-NVFP4 \
--dataset-name random \
--random-input-len 4096 \
--random-output-len 1024 \
--num-prompts 640 \
--max-concurrency 128 \
--request-rate inf
```
```text Output
============ Serving Benchmark Result ============
Backend: sglang
Max request concurrency: 128
Successful requests: 640
Benchmark duration (s): 181.89
Total input tokens: 1453591
Total generated tokens: 309221
Request throughput (req/s): 3.52
Input token throughput (tok/s): 7991.59
Output token throughput (tok/s): 1700.04
Total token throughput (tok/s): 9691.63
Concurrency: 118.86
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 33690.47
Median E2E Latency (ms): 30421.55
---------------Time to First Token----------------
Mean TTFT (ms): 1353.16
Median TTFT (ms): 383.52
P99 TTFT (ms): 8940.53
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 69.88
Median TPOT (ms): 71.77
P99 TPOT (ms): 131.75
---------------Inter-Token Latency----------------
Mean ITL (ms): 67.23
Median ITL (ms): 33.46
==================================================
```
#### 5.1.5 Understanding the Results
**Key Metrics:**
@@ -549,6 +923,7 @@ python -m sglang.bench_serving \
- **1K/1K (Chat)**: Represents the most common conversational AI workload. This is the highest priority scenario for most deployments.
- **1K/8K (Reasoning)**: Tests long-form generation capabilities crucial for complex reasoning, code generation, and detailed explanations.
- **8K/1K (Summarization)**: Evaluates performance with large context inputs, essential for RAG systems, document Q&A, and summarization tasks.
- **4K/1K (Throughput)**: Realistic mixed workload typical of production deployments (RAG context + medium response). Long enough input that prefill matters, long enough output that decode steady-state dominates. Used for the inline B200 / GB200 results above.
- **Variable Concurrency**: Captures the Pareto frontier - the optimal tradeoff between throughput and latency at different load levels. Low concurrency shows best-case latency, high concurrency shows maximum throughput.
**Interpreting Results:**
@@ -567,6 +942,21 @@ Document model accuracy on standard benchmarks:
- Benchmark Command
```bash Command
python -m sglang.test.few_shot_gsm8k \
--num-questions 200 \
--num-shots 5 \
--num-questions 1319 \
--port 30000
```
- Test Result (NVIDIA B200, TP=2 NVFP4)
```text Output
Accuracy: 0.946
Latency: 178.284 s
Output throughput: 769.204 token/s
```
- Test Result (NVIDIA GB200, TP=2 NVFP4)
```text Output
Accuracy: 0.951
Latency: 175.190 s
Invalid: 0.000
```
@@ -5,7 +5,10 @@ export const GLM47Deployment = () => {
name: 'hardware',
title: 'Hardware Platform',
items: [
{ id: 'mi300x', label: 'MI300X', default: true },
{ id: 'b200', label: 'B200', default: true },
{ id: 'gb200', label: 'GB200', default: false },
{ id: 'h200', label: 'H200', default: false },
{ id: 'mi300x', label: 'MI300X', default: false },
{ id: 'mi325x', label: 'MI325X', default: false },
{ id: 'mi355x', label: 'MI355X', default: false }
]
@@ -14,8 +17,18 @@ export const GLM47Deployment = () => {
name: 'quantization',
title: 'Quantization',
items: [
{ id: 'bf16', label: 'BF16', default: true },
{ id: 'fp8', label: 'FP8', default: false }
{ id: 'nvfp4', label: 'NVFP4', default: true },
{ id: 'fp8', label: 'FP8', default: false },
{ id: 'bf16', label: 'BF16', default: false }
]
},
gpus: {
name: 'gpus',
title: 'Number of GPUs',
items: [
{ id: '2', label: '2', default: false },
{ id: '4', label: '4', default: true },
{ id: '8', label: '8', default: false }
]
},
strategy: {
@@ -47,6 +60,20 @@ export const GLM47Deployment = () => {
}
};
// §3.2 support matrix — single source of truth for the greyed-out controls and
// generateCommand. hardware -> weight type -> allowed TP sizes (missing key = unsupported).
const SUPPORT = {
b200: { nvfp4: [2, 4, 8], fp8: [4, 8], bf16: [8] },
gb200: { nvfp4: [2, 4], fp8: [4] },
h200: { fp8: [8], bf16: [8] },
mi300x: { fp8: [2, 4, 8], bf16: [4, 8] },
mi325x: { fp8: [2, 4, 8], bf16: [4, 8] },
mi355x: { fp8: [2, 4, 8], bf16: [4, 8] },
};
const quantSupported = (hw, q) => Boolean(SUPPORT[hw] && SUPPORT[hw][q]);
const allowedTps = (hw, q) => (SUPPORT[hw] && SUPPORT[hw][q]) || [];
const firstSupportedQuant = (hw) => Object.keys(SUPPORT[hw] || {})[0] || 'fp8';
// Initialize state
const getInitialState = () => {
const initialState = {};
@@ -80,7 +107,21 @@ export const GLM47Deployment = () => {
}, []);
const handleRadioChange = (optionName, value) => {
setValues(prev => ({ ...prev, [optionName]: value }));
setValues(prev => {
const next = { ...prev, [optionName]: value };
// Keep weight type + GPU count within the §3.2 matrix as hardware/quant change,
// so the displayed command is always a supported configuration.
if (optionName === 'hardware' || optionName === 'quantization') {
if (!quantSupported(next.hardware, next.quantization)) {
next.quantization = firstSupportedQuant(next.hardware);
}
const tps = allowedTps(next.hardware, next.quantization);
if (tps.length && !tps.includes(parseInt(next.gpus, 10))) {
next.gpus = String(tps.includes(4) ? 4 : tps[0]);
}
}
return next;
});
};
const handleCheckboxChange = (optionName, itemId, isChecked) => {
@@ -96,47 +137,81 @@ export const GLM47Deployment = () => {
// Generate command
const generateCommand = () => {
const { hardware, quantization, strategy, thinking, toolcall } = values;
const { hardware, quantization, gpus, strategy, thinking, toolcall } = values;
const strategyArray = Array.isArray(strategy) ? strategy : [];
const modelSuffix = quantization === 'fp8' ? '-FP8' : '';
const modelName = `zai-org/GLM-4.7${modelSuffix}`;
const isNvidiaBlackwell = hardware === 'b200' || hardware === 'gb200';
const isAMD = hardware === 'mi300x' || hardware === 'mi325x' || hardware === 'mi355x';
// Determine TP value based on hardware and quantization
let tpValue = 4; // Default for MI300X and MI325X
if (hardware === 'mi355x') {
tpValue = quantization === 'fp8' ? 2 : 4; // MI355X: TP=2 for FP8, TP=4 for BF16
// Only emit §3.2-supported commands; guards any stale (greyed-out) selection.
if (!quantSupported(hardware, quantization)) {
return (
`# ${quantization.toUpperCase()} is not supported on ${hardware.toUpperCase()} per the §3.2 matrix.\n` +
`# Pick a highlighted weight type above.`
);
}
// Pick model checkpoint by weight type
let modelName = 'zai-org/GLM-4.7';
if (quantization === 'nvfp4') {
modelName = 'nvidia/GLM-4.7-NVFP4';
} else if (quantization === 'fp8') {
modelName = 'zai-org/GLM-4.7-FP8';
}
let cmd = 'python -m sglang.launch_server \\\n';
cmd += ` --model ${modelName}`;
// TP is mandatory
cmd += ` \\\n --tp ${tpValue}`;
if (isAMD) {
// AMD (MI300X / MI325X / MI355X): validated pre-Blackwell command shape.
// TP is fixed per chip + weight type, so the GPU-count selector is unused here.
let tpValue = 4; // MI300X / MI325X default
if (hardware === 'mi355x') {
tpValue = quantization === 'fp8' ? 2 : 4; // MI355X: TP=2 FP8, TP=4 BF16
}
cmd += ` \\\n --tp ${tpValue}`;
// MI300X/MI325X BF16 requires extra flags
if ((hardware === 'mi300x' || hardware === 'mi325x') && quantization === 'bf16') {
cmd += ` \\\n --max-context-length 8192 \\\n --mem-fraction-static 0.9`;
// MI300X/MI325X BF16 requires extra flags
if ((hardware === 'mi300x' || hardware === 'mi325x') && quantization === 'bf16') {
cmd += ` \\\n --max-context-length 8192 \\\n --mem-fraction-static 0.9`;
}
if (strategyArray.includes('dp')) {
cmd += ` \\\n --dp 8 \\\n --enable-dp-attention`;
}
if (strategyArray.includes('ep')) {
cmd += ` \\\n --ep 8`;
}
} else {
// NVIDIA (B200 / GB200 / H200): TP follows the "Number of GPUs" selector,
// clamped to a §3.2-supported value for the chosen hardware + weight type.
const tps = allowedTps(hardware, quantization);
let tpValue = parseInt(gpus, 10) || tps[0];
if (!tps.includes(tpValue)) {
tpValue = tps.includes(4) ? 4 : tps[0];
}
cmd += ` \\\n --tp-size ${tpValue}`;
// Blackwell + NVFP4: enable EP when the user selected it
if (isNvidiaBlackwell && quantization === 'nvfp4' && strategyArray.includes('ep')) {
cmd += ` \\\n --ep ${tpValue}`;
}
// Blackwell + NVFP4: leave headroom for cuda-graph capture
if (isNvidiaBlackwell && quantization === 'nvfp4') {
cmd += ` \\\n --mem-fraction-static 0.85`;
}
}
// Strategy-specific parameters
if (strategyArray.includes('dp')) {
cmd += ` \\\n --dp 8 \\\n --enable-dp-attention`;
}
if (strategyArray.includes('ep')) {
cmd += ` \\\n --ep 8`;
}
// MTP / EAGLE speculative decoding (all platforms)
if (strategyArray.includes('mtp')) {
cmd = 'SGLANG_ENABLE_SPEC_V2=1 ' + cmd;
cmd += ` \\\n --speculative-algorithm EAGLE \\\n --speculative-num-steps 3 \\\n --speculative-eagle-topk 1 \\\n --speculative-num-draft-tokens 4`;
}
// Add tool call parser if enabled
if (toolcall === 'enabled') {
cmd += ` \\\n --tool-call-parser glm47`;
}
// Add thinking parser if enabled
// glm45 is the registered reasoning detector; glm47 is only valid for tool-call.
if (thinking === 'enabled') {
cmd += ` \\\n --reasoning-parser glm45`;
}
@@ -155,16 +230,31 @@ export const GLM47Deployment = () => {
const subtitleStyle = { display: 'block', fontSize: '9px', marginTop: '1px', lineHeight: '1.1', opacity: 0.7 };
const commandDisplayStyle = { flex: 1, padding: '12px 16px', background: isDark ? '#111827' : '#f5f5f5', borderRadius: '6px', fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", fontSize: '12px', lineHeight: '1.5', color: isDark ? '#e5e7eb' : '#374151', whiteSpace: 'pre-wrap', overflowX: 'auto', margin: 0, border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}` };
// Which Deployment Strategy toggles apply (mirrors generateCommand): DP only on
// AMD; EP only on AMD or Blackwell + NVFP4 — greyed otherwise.
const hwSel = values.hardware;
const isAMDSel = hwSel === 'mi300x' || hwSel === 'mi325x' || hwSel === 'mi355x';
const isBlackwellSel = hwSel === 'b200' || hwSel === 'gb200';
const strategyApplies = (id) => {
if (id === 'dp') return isAMDSel;
if (id === 'ep') return isAMDSel || (isBlackwellSel && values.quantization === 'nvfp4');
return true; // tp (required) and mtp (all platforms)
};
return (
<div style={containerStyle} className="not-prose">
{Object.entries(options).map(([key, option]) => (
{Object.entries(options).map(([key, option]) => {
// GPU count is fixed (greyed) on AMD; on NVIDIA individual counts are greyed
// per the §3.2 matrix. Weight types unsupported on the hardware are greyed too.
const gpusGroupAMD = key === 'gpus' && isAMDSel;
return (
<div key={key} style={cardStyle}>
<div style={titleStyle}>{option.title}</div>
<div style={titleStyle}>{option.title}{gpusGroupAMD ? ' (N/A for AMD)' : ''}</div>
<div style={itemsStyle}>
{option.type === 'checkbox' ? (
option.items.map(item => {
const isChecked = (values[option.name] || []).includes(item.id);
const isDisabled = item.required;
const isDisabled = item.required || (key === 'strategy' && !strategyApplies(item.id));
return (
<label key={item.id} style={{ ...labelBaseStyle, ...(isChecked ? checkedStyle : {}), ...(isDisabled ? disabledStyle : {}) }}>
<input type="checkbox" checked={isChecked} disabled={isDisabled} onChange={(e) => handleCheckboxChange(option.name, item.id, e.target.checked)} style={{ display: 'none' }} />
@@ -176,9 +266,12 @@ export const GLM47Deployment = () => {
) : (
option.items.map(item => {
const isChecked = values[option.name] === item.id;
const isDisabled =
(key === 'gpus' && (gpusGroupAMD || !allowedTps(values.hardware, values.quantization).includes(parseInt(item.id, 10)))) ||
(key === 'quantization' && !quantSupported(values.hardware, item.id));
return (
<label key={item.id} style={{ ...labelBaseStyle, ...(isChecked ? checkedStyle : {}) }}>
<input type="radio" name={option.name} value={item.id} checked={isChecked} onChange={() => handleRadioChange(option.name, item.id)} style={{ display: 'none' }} />
<label key={item.id} style={{ ...labelBaseStyle, ...(isChecked ? checkedStyle : {}), ...(isDisabled ? disabledStyle : {}) }}>
<input type="radio" name={option.name} value={item.id} checked={isChecked} disabled={isDisabled} onChange={() => !isDisabled && handleRadioChange(option.name, item.id)} style={{ display: 'none' }} />
{item.label}
{item.subtitle && <small style={{ ...subtitleStyle, color: isChecked ? 'rgba(255,255,255,0.85)' : 'inherit' }}>{item.subtitle}</small>}
</label>
@@ -187,7 +280,8 @@ export const GLM47Deployment = () => {
)}
</div>
</div>
))}
);
})}
<div style={cardStyle}>
<div style={titleStyle}>Run this Command:</div>
<pre style={commandDisplayStyle}>{generateCommand()}</pre>