-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[None][doc] Update GLM-5 docs for GLM-5.3 and disaggregated serving #18388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,10 +4,23 @@ | |
|
|
||
| This deployment guide provides step-by-step instructions for running the GLM-5 model using TensorRT LLM with FP8 and NVFP4 quantization, optimized for NVIDIA Blackwell GPUs. It covers the complete setup required; from accessing model weights and preparing the software environment to configuring TensorRT LLM parameters, launching the server, and validating inference output. | ||
|
|
||
| GLM-5 uses Multi-Latent Attention (MLA) with DeepSeek Sparse Attention (DSA). It shares the same architecture as DeepSeek V3.2 and reuses the `DeepseekV32ForCausalLM` code path in TensorRT LLM. GLM-5 natively supports Multi-Token Prediction (MTP) for speculative decoding. | ||
| GLM-5 uses Multi-Latent Attention (MLA) with DeepSeek Sparse Attention (DSA). It shares the same architecture as DeepSeek V3.2 (with minor changes) and is served through the `GlmMoeDsaForCausalLM` model, which reuses the DeepSeek V3.2 code path in TensorRT LLM. GLM-5 natively supports Multi-Token Prediction (MTP) for speculative decoding. | ||
|
|
||
| This guide applies to the GLM-5 family, including GLM-5.2 and GLM-5.3. GLM-5.3 is a weight update over GLM-5.2 with the same architecture and code path, so the server configurations and deployment steps below are identical across versions. Note that GLM-5.3 ships a revised chat template: the `enable_thinking` template kwarg is replaced by `clear_thinking`, and `reasoning_effort` accepts `low`/`high` (default `max`). Clients controlling reasoning behavior via `chat_template_kwargs` should update accordingly. | ||
|
|
||
| The guide is intended for developers and practitioners seeking high-throughput or low-latency inference using NVIDIA's accelerated stack. | ||
|
|
||
| ### Validated Features | ||
|
|
||
| The following features have been tested with GLM-5 on TensorRT LLM: | ||
|
|
||
| * CUDA Graph | ||
| * Multi-Token Prediction (MTP) | ||
| * Disaggregated serving | ||
| * Disaggregated serving with MTP | ||
|
|
||
| Because GLM-5 reuses the DeepSeek V3.2 code path, other features supported by `DeepseekV32ForCausalLM` are expected to work but have not been separately validated. See the [Model-Feature Support Matrix](../models/supported-models.md#model-feature-support-matrix-key-models) for the current per-feature status. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| * GPU: 8x NVIDIA B200 (SM100) | ||
|
|
@@ -20,13 +33,15 @@ The guide is intended for developers and practitioners seeking high-throughput o | |
|
|
||
| The following checkpoints are available: | ||
|
|
||
| * FP8 model: [zai-org/GLM-5-FP8](https://huggingface.co/zai-org/GLM-5-FP8) — Official FP8 checkpoint | ||
| * BF16 model: [zai-org/GLM-5](https://huggingface.co/zai-org/GLM-5) — Official BF16 checkpoint | ||
| * NVFP4 model: [warnold-nv/GLM-5-nvfp4-v1](https://huggingface.co/warnold-nv/GLM-5-nvfp4-v1) — Unofficial NVFP4 checkpoint for experimentation only. *Quantized with ModelOpt by Will Arnold.* | ||
| * FP8 model: [zai-org/GLM-5.3](https://huggingface.co/zai-org/GLM-5.3) — Official FP8 checkpoint | ||
| * BF16 model: [zai-org/GLM-5.3-BF16](https://huggingface.co/zai-org/GLM-5.3-BF16) — Official BF16 checkpoint | ||
| * NVFP4 model: [warnold-nv/GLM-5-nvfp4-v1](https://huggingface.co/warnold-nv/GLM-5-nvfp4-v1) — Unofficial NVFP4 checkpoint of GLM-5 for experimentation only. *Quantized with ModelOpt by Will Arnold.* | ||
|
|
||
| > **Note on checkpoint naming:** For GLM-5.3 the base repository (`zai-org/GLM-5.3`) contains the FP8 weights and the BF16 weights live in the `-BF16` repository. This is the reverse of GLM-5 and GLM-5.2, where the base repositories ([zai-org/GLM-5](https://huggingface.co/zai-org/GLM-5), [zai-org/GLM-5.2](https://huggingface.co/zai-org/GLM-5.2)) are BF16 and the FP8 weights live in the `-FP8` repositories ([zai-org/GLM-5-FP8](https://huggingface.co/zai-org/GLM-5-FP8), [zai-org/GLM-5.2-FP8](https://huggingface.co/zai-org/GLM-5.2-FP8)). Check the `quantization_config` in the checkpoint's `config.json` if in doubt. | ||
|
|
||
| ```bash | ||
| git lfs install | ||
| git clone https://huggingface.co/zai-org/GLM-5-FP8 /models/GLM-5-FP8 | ||
| git clone https://huggingface.co/zai-org/GLM-5.3 /models/GLM-5.3 | ||
| ``` | ||
|
|
||
| ## MoE Backend Support Matrix | ||
|
|
@@ -133,7 +148,7 @@ Below is an example command to launch the TensorRT LLM server with GLM-5 from wi | |
|
|
||
| ```bash | ||
| trtllm-serve \ | ||
| /models/GLM-5-FP8 \ | ||
| /models/GLM-5.3 \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- applicable repository knowledge files ---'
find /tmp/coderabbit-repo-knowledge/nvidia-tensorrt-llm-053b2761 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- documentation excerpt ---'
cat -n docs/source/deployment-guide/deployment-guide-for-glm-5-on-trtllm.md | sed -n '130,170p;245,285p;300,325p'
printf '%s\n' '--- serve implementation candidates ---'
fd -t f -i 'serve.py' .
printf '%s\n' '--- served-model option and model identity references ---'
rg -n -C 4 --glob '*.py' 'served_model_name|served model|model_name' tensorrt_llm 2>/dev/null | head -240Repository: NVIDIA/TensorRT-LLM Length of output: 27476 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- repository-wide conventions ---'
cat /tmp/coderabbit-repo-knowledge/nvidia-tensorrt-llm-053b2761/conventions/repo-wide.md
printf '%s\n' '--- documentation learnings ---'
cat /tmp/coderabbit-repo-knowledge/nvidia-tensorrt-llm-053b2761/learnings/md.md
printf '%s\n' '--- serve identity flow ---'
cat -n tensorrt_llm/commands/serve.py | sed -n '560,625p;1185,1230p;1450,1530p'
printf '%s\n' '--- downstream launch signatures and model use ---'
rg -n -C 5 'def launch_(openai|triton|server)|served_model_name|model_name=|model_name' tensorrt_llm/serve tensorrt_llm/commands/serve.py 2>/dev/null | head -260
printf '%s\n' '--- all relevant document model identifiers ---'
rg -n -C 2 '/models/GLM-5\.3|zai-org/GLM-5\.3|served_model_name' docs/source/deployment-guide/deployment-guide-for-glm-5-on-trtllm.mdRepository: NVIDIA/TensorRT-LLM Length of output: 39529 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- launch_server model propagation ---'
cat -n tensorrt_llm/commands/serve.py | sed -n '625,760p'
printf '%s\n' '--- OpenAI server model binding and request validation ---'
rg -n -C 6 'class OpenAIServer|self\.model|request\.model|model.*self\.model|model.*not.*found|not.*model' tensorrt_llm/serve/openai_server.py tensorrt_llm/serve/*.py | head -320
printf '%s\n' '--- benchmark request model contract ---'
cat -n tensorrt_llm/serve/scripts/benchmark_serving.py | sed -n '90,175p;780,820p;920,945p'Repository: NVIDIA/TensorRT-LLM Length of output: 40799 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- OpenAIServer constructor and model normalization ---'
cat -n tensorrt_llm/serve/openai_server.py | sed -n '431,525p'
printf '%s\n' '--- request model handling in OpenAI routes ---'
rg -n -C 8 'request\.model|self\.model|ModelNotFound|model.*match|model.*valid|invalid.*model|404.*model|HTTPException' tensorrt_llm/serve/openai_server.py tensorrt_llm/serve/router_utils.py | head -360
printf '%s\n' '--- benchmark OpenAI request construction ---'
rg -n -C 10 'class RequestFuncInput|model_name|model_id|json=.*model|\"model\"' tensorrt_llm/serve/scripts/benchmark_serving.py | head -300Repository: NVIDIA/TensorRT-LLM Length of output: 46351 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- completion response model and route definitions ---'
rg -n -C 12 'async def openai_(completion|chat)|CompletionResponse\(|model=self\.model|model=request\.model' tensorrt_llm/serve/openai_server.py
printf '%s\n' '--- benchmark client model selection ---'
rg -n -C 12 'class RequestFuncInput|model_name.*or.*model|model_name|request_func_input\.model' tensorrt_llm/serve | head -320Repository: NVIDIA/TensorRT-LLM Length of output: 35509 Align the served model name with the documented model ID. An existing 🤖 Prompt for AI AgentsSource: MCP tools |
||
| --host 0.0.0.0 \ | ||
| --port 8000 \ | ||
| --max_batch_size 128 \ | ||
|
|
@@ -150,6 +165,40 @@ trtllm-serve \ | |
| > - Reduce `--max_num_tokens` to `3072` for max-throughput configs. | ||
| > - Reduce `--max_batch_size` and `cuda_graph_config.max_batch_size` to `32` or `16` for min-latency configs. | ||
|
|
||
| ### Disaggregated Serving | ||
|
|
||
| GLM-5 supports disaggregated serving, which separates the prefill (context) and decode (generation) phases onto different workers so each can be scaled and tuned independently. This can be combined with MTP. | ||
|
|
||
| Launch one or more context (prefill) servers and one or more generation (decode) servers with `trtllm-serve`, then start a `trtllm-serve disaggregated` orchestrator that routes client requests between them. Both context and generation workers must carry the same `cache_transceiver_config` to exchange the KV cache. Add the following to the config file used by each worker: | ||
|
|
||
| ```yaml | ||
| cache_transceiver_config: | ||
| backend: NIXL | ||
| ``` | ||
|
Comment on lines
+175
to
+177
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: printf '%s\n' '--- repository conventions ---'
find /tmp/coderabbit-repo-knowledge/nvidia-tensorrt-llm-053b2761 -type f -name '*.md' -maxdepth 3 -print
printf '%s\n' '--- target document ---'
cat -n docs/source/deployment-guide/deployment-guide-for-glm-5-on-trtllm.md | sed -n '145,195p'
printf '%s\n' '--- relevant runtime definitions and model preference ---'
rg -n -C 8 'transceiver_runtime|GlmMoeDsaForCausalLM|Python transceiver|PYTHON' tensorrt_llm docs | head -240Repository: NVIDIA/TensorRT-LLM Length of output: 30952 🏁 Script executed: printf '%s\n' '--- applicable repository conventions ---'
cat /tmp/coderabbit-repo-knowledge/nvidia-tensorrt-llm-053b2761/conventions/repo-wide.md
cat /tmp/coderabbit-repo-knowledge/nvidia-tensorrt-llm-053b2761/learnings/md.md
printf '%s\n' '--- runtime implementation files ---'
fd -t f 'llm_utils.py|.*glm.*\.py$|.*dsa.*\.py$' tensorrt_llm | sort
printf '%s\n' '--- transceiver runtime declarations and selection ---'
rg -n -C 12 'transceiver_runtime|cache_transceiver_config' tensorrt_llm/llmapi tensorrt_llm/_torch | head -320
printf '%s\n' '--- GLM DSA model transceiver preference ---'
rg -n -C 15 'transceiver|NIXL|PYTHON|GlmMoeDsaForCausalLM' tensorrt_llm | head -320Repository: NVIDIA/TensorRT-LLM Length of output: 50375 🏁 Script executed: printf '%s\n' '--- GLM DSA implementation ---'
rg -n -C 20 'class GlmMoeDsaForCausalLM|get_preferred_transceiver_runtime|get_preferred_kv_cache_manager_version' \
tensorrt_llm/_torch/models/modeling_glm.py \
tensorrt_llm/_torch/auto_deploy/models/custom/modeling_glm_moe_dsa.py
printf '%s\n' '--- runtime resolver call sites ---'
rg -n -C 10 '_resolve_transceiver_runtime_auto|get_model_class|model_cls' \
tensorrt_llm/llmapi/llm_utils.py tensorrt_llm/llmapi tensorrt_llm/_torch | \
grep -E 'llm_utils.py|_resolve_transceiver_runtime_auto|resolve_transceiver|model_cls|get_model_class' | head -180
printf '%s\n' '--- exact version metadata ---'
rg -n -C 3 '1\.3\.0rc8|__version__|version\s*=' pyproject.toml setup.py setup.cfg tensorrt_llm 2>/dev/null | head -100Repository: NVIDIA/TensorRT-LLM Length of output: 26225 🏁 Script executed: printf '%s\n' '--- all transceiver preference implementations ---'
rg -n -C 8 'def get_preferred_transceiver_runtime|return "PYTHON"|return .PYTHON.' \
tensorrt_llm/_torch tensorrt_llm/llmapi
printf '%s\n' '--- GLM DSA class hierarchy and registration ---'
cat -n tensorrt_llm/_torch/auto_deploy/models/custom/modeling_glm_moe_dsa.py | sed -n '1,90p;560,650p'
rg -n -C 8 'GlmMoeDsaForCausalLM|GlmMoeDsaPreTrainedModel|modeling_glm_moe_dsa' \
tensorrt_llm/_torch tensorrt_llm/llmapi
printf '%s\n' '--- resolver invocation ---'
rg -n -C 15 '_resolve_transceiver_runtime_auto\(' tensorrt_llm
printf '%s\n' '--- checked-out package version ---'
cat -n tensorrt_llm/version.py | head -30Repository: NVIDIA/TensorRT-LLM Length of output: 50375 🏁 Script executed: printf '%s\n' '--- GLM DSA runtime preference ---'
cat -n tensorrt_llm/_torch/models/modeling_deepseekv3.py | sed -n '1888,1930p;2088,2110p'
printf '%s\n' '--- resolver invocation locations ---'
rg -n '_resolve_transceiver_runtime_auto' tensorrt_llm
printf '%s\n' '--- config default ---'
cat -n tensorrt_llm/llmapi/llm_args.py | sed -n '4392,4418p'
printf '%s\n' '--- package version ---'
cat -n tensorrt_llm/version.py | head -20Repository: NVIDIA/TensorRT-LLM Length of output: 6001 🏁 Script executed: printf '%s\n' '--- standard model-loading path ---'
cat -n tensorrt_llm/_torch/pyexecutor/model_loader.py | sed -n '440,550p'
printf '%s\n' '--- available local release tags ---'
git tag --list 'v1.3.0rc8' '1.3.0rc8' 'v1.3.0rc*' '1.3.0rc*' | sort -VRepository: NVIDIA/TensorRT-LLM Length of output: 6427 🌐 Web query:
💡 Result: In NVIDIA TensorRT-LLM, CacheTransceiverConfig is a configuration object used to manage disaggregated serving, which allows decoupling of the context-phase and generation-phase compute resources by transferring KV cache data between them [1][2][3]. The transceiver_runtime setting within CacheTransceiverConfig specifies the implementation used for these KV cache transfers [4][3]. There are two primary options: 1. CPP: The C++-based transceiver implementation, which is the default for most configurations [5][4]. 2. PYTHON: A Python-based implementation that provides additional flexibility, particularly required for specific advanced features such as certain V2 Mamba model deployments [4][6]. Starting with recent versions (such as the 1.3.0 series), an auto mode exists for transceiver_runtime [7]. When set to auto, the system attempts to select the appropriate runtime based on the model's requirements and the configured communication backend (NIXL is typically required for the Python runtime) [7]. Regarding GlmMoeDsaForCausalLM: While this specific class name appears in TensorRT-LLM's internal model definitions for MoE (Mixture of Experts) models, it is not a direct parameter or attribute of the CacheTransceiverConfig [8][3]. Instead, models like those implementing GlmMoeDsaForCausalLM may interact with the transceiver infrastructure by overriding methods (such as get_preferred_transceiver_runtime) to signal their specific requirements to the system's auto-selection logic [7]. Top results: [8] https://github.com/NVIDIA/TensorRT-LLM/releases/tag/v1.3.0rc8 [1] https://nvidia.github.io/TensorRT-LLM/1.3.0rc13/features/disagg-serving.html [2] https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/features/disagg-serving.md [4] #11136 [6] https://nvidia.github.io/TensorRT-LLM/features/kvcache.html [7] #16164 [3] https://mintlify.wiki/NVIDIA/TensorRT-LLM/config/llm-args Citations:
🏁 Script executed: set -eu
base='https://raw.githubusercontent.com/NVIDIA/TensorRT-LLM/v1.3.0rc8'
for file in \
tensorrt_llm/llmapi/llm_args.py \
tensorrt_llm/llmapi/llm_utils.py \
tensorrt_llm/_torch/models/modeling_deepseekv3.py \
tensorrt_llm/_torch/pyexecutor/model_loader.py
do
printf '\n--- %s ---\n' "$file"
curl -fsSL "$base/$file" |
rg -n -C 8 'transceiver_runtime|get_preferred_transceiver_runtime|_resolve_transceiver_runtime_auto'
doneRepository: NVIDIA/TensorRT-LLM Length of output: 948 🏁 Script executed: base='https://raw.githubusercontent.com/NVIDIA/TensorRT-LLM/v1.3.0rc8'
for file in \
tensorrt_llm/llmapi/llm_utils.py \
tensorrt_llm/_torch/models/modeling_deepseekv3.py \
tensorrt_llm/_torch/pyexecutor/model_loader.py
do
printf '\n--- %s ---\n' "$file"
curl -fsSL "$base/$file" |
rg -n -C 10 'GlmMoeDsaForCausalLM|get_preferred_transceiver_runtime|_resolve_transceiver_runtime_auto|transceiver_runtime' || true
doneRepository: NVIDIA/TensorRT-LLM Length of output: 314 🏁 Script executed: set -o pipefail
curl -fsSL 'https://api.github.com/repos/NVIDIA/TensorRT-LLM/git/trees/v1.3.0rc8?recursive=1' |
jq -r '.tree[] | select(.path|test("transceiver|kv_cache|disagg|model_loader")) | .path' |
head -120Repository: NVIDIA/TensorRT-LLM Length of output: 6508 🏁 Script executed: printf '%s\n' '--- release-tree model files ---'
curl -fsSL 'https://api.github.com/repos/NVIDIA/TensorRT-LLM/git/trees/v1.3.0rc8?recursive=1' |
jq -r '.tree[] | select(.path|test("modeling_(deepseek|glm)|glm.*\\.py$")) | .path'
for file in \
tensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py \
tensorrt_llm/llmapi/disagg_utils.py
do
printf '\n--- %s ---\n' "$file"
curl -fsSL "https://raw.githubusercontent.com/NVIDIA/TensorRT-LLM/v1.3.0rc8/$file" |
rg -n -C 12 'transceiver_runtime|PYTHON|CPP|backend|KvCacheTransceiver' || true
doneRepository: NVIDIA/TensorRT-LLM Length of output: 6348 Set In TensorRT-LLM v1.3.0rc8, 🤖 Prompt for AI AgentsSource: MCP tools |
||
|
|
||
| Reuse the FP8 config (or the FP8-with-MTP config for Disagg + MTP) from [Recommended Performance Settings](#recommended-performance-settings) for the workers, adding the `cache_transceiver_config` block above. The context workers should also set `disable_overlap_scheduler: true`. | ||
|
|
||
| The orchestrator is launched with a disaggregated config that lists the context and generation worker URLs: | ||
|
|
||
| ```bash | ||
| trtllm-serve disaggregated -c disagg_config.yaml | ||
| ``` | ||
|
|
||
| ```yaml | ||
| hostname: localhost | ||
| port: 8000 | ||
| context_servers: | ||
| num_instances: 1 | ||
| urls: | ||
| - "localhost:8001" | ||
| generation_servers: | ||
| num_instances: 1 | ||
| urls: | ||
| - "localhost:8002" | ||
| ``` | ||
|
|
||
| Clients then send OpenAI-compatible requests to the orchestrator (`localhost:8000`). For the full walkthrough, per-worker GPU placement, and multi-node/SLURM launch, see the [Disaggregated Serving guide](../features/disagg-serving.md). | ||
|
|
||
| ### LLM API Options (YAML Configuration) | ||
|
|
||
| These options provide control over TensorRT LLM's behavior and are set within the YAML file passed to the `trtllm-serve` command via the `--config` argument. | ||
|
|
@@ -209,7 +258,7 @@ After the TensorRT LLM server is set up and shows *Application startup complete* | |
| curl http://localhost:8000/v1/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": "zai-org/GLM-5-FP8", | ||
| "model": "zai-org/GLM-5.3", | ||
| "prompt": "What is the capital of France?", | ||
| "max_tokens": 16, | ||
| "temperature": 0 | ||
|
|
@@ -222,7 +271,7 @@ Example response: | |
| { | ||
| "id": "cmpl-...", | ||
| "object": "text_completion", | ||
| "model": "zai-org/GLM-5-FP8", | ||
| "model": "zai-org/GLM-5.3", | ||
| "choices": [ | ||
| { | ||
| "index": 0, | ||
|
|
@@ -264,7 +313,7 @@ result_dir=/tmp/glm5_output | |
| for concurrency in ${concurrency_list}; do | ||
| num_prompts=$((concurrency * multi_round)) | ||
| python -m tensorrt_llm.serve.scripts.benchmark_serving \ | ||
| --model zai-org/GLM-5-FP8 \ | ||
| --model zai-org/GLM-5.3 \ | ||
| --backend openai \ | ||
| --dataset-name "random" \ | ||
| --random-input-len ${isl} \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: NVIDIA/TensorRT-LLM
Length of output: 50377
🏁 Script executed:
Repository: NVIDIA/TensorRT-LLM
Length of output: 50377
🌐 Web query:
zai-org GLM-5.2 chat_template.jinja enable_thinking clear_thinking reasoning_effort💡 Result:
The GLM-5.2 model by zai-org utilizes a specialized Jinja template (
chat_template.jinja) to manage reasoning behavior, includingenable_thinking,clear_thinking, andreasoning_effort[1][2]. These parameters control the model's Deep Thinking capabilities [3][4]. enable_thinking This parameter determines whether the model engages in chain-of-thought (CoT) reasoning [3][4]. - Whenenable_thinkingis set totrue(default), the model performs dynamic thinking [4][5]. - When set tofalse, thinking is disabled, and the model provides direct responses [3][6]. In API implementations, this is often controlled viaextra_bodyparameters (e.g.,{"chat_template_kwargs": {"enable_thinking": false}}) [3] or by settingthinking.typetodisabled[4][7]. reasoning_effort This parameter controls the depth and intensity of the reasoning process [4][5]. - For GLM-5.2, the officially supported values arehighandmax[8][9]. -maxis the default level, providing the deepest reasoning suitable for complex tasks like hard mathematics, multi-step planning, and agentic workflows [3][4]. -highprovides a balance between reasoning depth and latency [3][4]. - While some documentation suggests mappings for other inputs (e.g.,low/mediummapping tohigh,xhighmapping tomax), the core supported interface for GLM-5.2 focuses onhighandmax[4][6]. clear_thinking This parameter is related to Preserved Thinking, a feature that allows the model to maintain reasoning coherence across multiple turns or tool calls [7][6]. - By default, standard API endpoints clear prior reasoning [6]. - Settingclear_thinkingtofalseenables Preserved Thinking, which requires the application to return the complete, unmodifiedreasoning_contentfrom previous turns to ensure continuity [7][6]. These parameters can typically be passed throughchat_template_kwargsor theextra_bodyfield in API requests (e.g., via vLLM or the Z.ai API) to customize inference behavior [3][7].Citations:
🌐 Web query:
zai-org GLM-5.3 chat_template.jinja clear_thinking reasoning_effort enable_thinking💡 Result:
In the context of the zai-org GLM-5.3 models, the parameters in the chat template (chat_template.jinja) are used to control the model's reasoning behavior [1][2]. These parameters are typically passed via chat_template_kwargs [3][4]. Reasoning_effort The reasoning_effort parameter controls the intensity or depth of the model's reasoning process [1][5]. In the GLM-5.x chat template, the value is processed as follows [1][2]: - Valid values are typically 'low', 'high', and 'max' (or default to 'max' if not specified or invalid) [1][2]. - It determines the system-level instruction regarding how much reasoning effort the model should apply [1][2]. Enable_thinking The enable_thinking parameter is a boolean toggle that activates or deactivates the model's reasoning/thinking mode [3][4]. - Setting enable_thinking: true activates the thinking process [3][4]. - Setting enable_thinking: false disables it, allowing for a standard response mode which can be useful for reducing latency or cost in simpler tasks [3][4]. Clear_thinking The clear_thinking parameter is used to manage the persistence of reasoning content across multi-turn conversations [6][4]. - clear_thinking: true (default): The model clears reasoning history between turns [7]. - clear_thinking: false: This enables Preserved Thinking, where the model retains and reuses reasoning blocks from previous turns [6][8]. This is particularly recommended for coding agents and complex, long-horizon tasks to improve consistency and cache hit rates [6][3]. When set to false, you must return the unmodified reasoning_content in subsequent turns [6][8]. These parameters provide granular control over the model's computational investment and conversational context, allowing developers to balance performance, cost, and task requirements [6][3].
Citations:
🏁 Script executed:
Repository: NVIDIA/TensorRT-LLM
Length of output: 7654
Correct the GLM-5.3 reasoning migration note.
clear_thinkingcontrols retention of prior reasoning; it does not replaceenable_thinking. GLM-5.3 always starts generation with<think>, so renaming the kwarg does not disable reasoning. Documentreasoning_effort(low,high, ormax, defaultmax) as the supported reasoning-control path, and explain when to setclear_thinking=truefor chat requests.🤖 Prompt for AI Agents
Source: MCP tools