Instructions to use axteam/GLM-4.7-Flash-NVFP4A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use axteam/GLM-4.7-Flash-NVFP4A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="axteam/GLM-4.7-Flash-NVFP4A16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("axteam/GLM-4.7-Flash-NVFP4A16") model = AutoModelForCausalLM.from_pretrained("axteam/GLM-4.7-Flash-NVFP4A16", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use axteam/GLM-4.7-Flash-NVFP4A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "axteam/GLM-4.7-Flash-NVFP4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "axteam/GLM-4.7-Flash-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/axteam/GLM-4.7-Flash-NVFP4A16
- SGLang
How to use axteam/GLM-4.7-Flash-NVFP4A16 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "axteam/GLM-4.7-Flash-NVFP4A16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "axteam/GLM-4.7-Flash-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "axteam/GLM-4.7-Flash-NVFP4A16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "axteam/GLM-4.7-Flash-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use axteam/GLM-4.7-Flash-NVFP4A16 with Docker Model Runner:
docker model run hf.co/axteam/GLM-4.7-Flash-NVFP4A16
GLM-4.7-Flash ยท NVFP4A16 (W4A16, FP4 weights)
4-bit quantization of zai-org/GLM-4.7-Flash for vLLM serving. Quantized by axteam.
| Base model | zai-org/GLM-4.7-Flash |
| Method | NVFP4A16 (W4A16, FP4 weights) |
| Format | compressed-tensors nvfp4-pack-quantized |
| Weights / activations | W4A16 โ FP4 (E2M1) weights group 16 + FP8 scale, BF16 activations |
| Architecture | MoE (GLM-4.7 Lite ยท Glm4MoeLite) ยท 31.2B ยท 202K context ยท text-only |
| Size on disk | ~18.9 GB |
| Calibration | None (data-free, name-based model_free_ptq) |
| License | mit |
Quantization details
- Scheme โ W4A16 โ FP4 (E2M1) weights group 16 + FP8 scale, BF16 activations, stored as compressed-tensors
nvfp4-pack-quantized. - Kept in BF16 โ token embeddings, the LM head, and all RMSNorms. Only attention & MLP projections are quantized. In addition, the MoE router (
mlp.gate, incl.e_score_correction_bias) is kept in BF16. The MTP layer (model.layers.47:eh_proj,shared_head.head) is quantized like the other layers. - Post-training quantization (no retraining). Tokenizer /
chat_templateidentical to the original. - FP4 global scales are shared across the pairs vLLM fuses โ
q_a_proj+kv_a_proj_with_mqa(MLA) andgate_proj+up_projof every routed and shared expert.
Revision 2026-10-31: the first upload of this repo (same day) quantized those pairs with separate global scales. vLLM runs each pair as one GEMM with one scale, so that build produced corrupted text. The weights were re-quantized and replaced; if you downloaded this repo before the fix, please download it again.
Benchmarks (measured)
Every column was measured with the same harness and settings โ lm-evaluation-harness on vLLM, greedy, few-shot completion (no chat template). Percentages are recovery vs. the BF16 original.
| Benchmark | BF16 (original) | FP8-dynamic | NVFP4A16 (this repo) |
|---|---|---|---|
| MMLU (5-shot) | 72.19 | 71.78 (99.4%) | 69.97 (96.9%) |
| GSM8K (5-shot, strict) | 83.70 | 82.71 (98.8%) | 79.83 (95.4%) |
| ARC-Challenge (0-shot) | 57.51 | 57.51 (100.0%) | 55.03 (95.7%) |
| Winogrande (5-shot) | 74.51 | 73.32 (98.4%) | 73.40 (98.5%) |
| KMMLU (5-shot, direct) | 50.04 | 50.15 (100.2%) | 47.38 (94.7%) |
| HAE-RAE (0-shot) | 64.89 | 63.89 (98.4%) | 59.67 (91.9%) |
| Average | 67.14 | 66.56 (99.1%) | 64.21 (95.6%) |
โ ๏ธ Note: average recovery is 95.6% โ noticeable degradation at this precision; prefer an 8-bit build if quality matters most.
Requirements
| Runtime | vLLM โ the architecture is in vLLM โฅ 0.15.0; tested here with vLLM 0.32.0. |
| vLLM install | vLLM 0.32 itself needs Python 3.11โ3.14, torch 2.13 (CUDA 13.0 build, so an NVIDIA driver with CUDA 13 support), transformers โฅ5.16.1,<5.20 and compressed-tensors 0.17.0 (both pinned by vLLM; 0.17.0 reads this checkpoint, which was saved with 0.19.0 โ do not upgrade it separately). |
| GPU | NVIDIA Turing (sm75) or newer โ weight-only FP4, no FP4 tensor cores needed. V100 (sm70) is not supported. (Kernel choice per GPU from vLLM 0.32's selection code; only B200 was run here.) |
| Memory | Weights: 18.9 GB. Add KV cache (grows with context length ร concurrent requests) and a few GB for activations / CUDA graphs; use --tensor-parallel-size N when the weights do not fit one GPU. |
| Transformers (without vLLM) | Not loadable correctly by Transformers (checked up to 5.22.1) โ use vLLM. |
| trust_remote_code | not needed |
Usage (vLLM)
Start an OpenAI-compatible server:
vllm serve axteam/GLM-4.7-Flash-NVFP4A16 --max-model-len 32768
Query it:
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "axteam/GLM-4.7-Flash-NVFP4A16",
"messages": [{"role": "user", "content": "๋ํ๋ฏผ๊ตญ์ ์๋๋ ์ด๋์ธ๊ฐ์?"}],
"temperature": 1.0, "max_tokens": 512
}'
Offline inference in Python:
from vllm import LLM, SamplingParams
llm = LLM(model="axteam/GLM-4.7-Flash-NVFP4A16", max_model_len=32768)
params = SamplingParams(temperature=1.0, max_tokens=1024)
out = llm.chat([{"role": "user", "content": "Explain model quantization in two sentences."}], params)
print(out[0].outputs[0].text)
Recommended sampling (from the original
generation_config.json):temperature=1.0. Thinking mode is on by default in the chat template; to turn it off passchat_template_kwargs={"enable_thinking": False}(Pythonllm.chat(..., chat_template_kwargs=...), or"chat_template_kwargs": {"enable_thinking": false}in the request body).
Reducing KV-cache memory (optional, serve-time)
The KV cache is kept in BF16 by default. KV-cache precision is a runtime choice, independent of the weight quantization above; for long contexts or large batches FP8 roughly halves KV-cache memory:
vllm serve axteam/GLM-4.7-Flash-NVFP4A16 --kv-cache-dtype fp8
License
Quantized derivative of zai-org/GLM-4.7-Flash (mit).
ํ๊ตญ์ด ์์ฝ
zai-org/GLM-4.7-Flash์ NVFP4A16 (W4A16) ์์ํ ๋น๋ ยท ์ ์ axteam
๊ฐ์
| ํญ๋ชฉ | ๋ด์ฉ |
|---|---|
| ์๋ณธ ๋ชจ๋ธ | zai-org/GLM-4.7-Flash |
| ์์ํ ๋ฐฉ์ | NVFP4A16 (W4A16, FP4 ๊ฐ์ค์น) |
| ์ ์ฅ ํ์ | compressed-tensors nvfp4-pack-quantized |
| ๋ชจ๋ธ ๊ตฌ์กฐ | MoE (GLM-4.7 Lite, Glm4MoeLite) ยท 31.2B ยท ์ปจํ
์คํธ 202K ยท ํ
์คํธ ์ ์ฉ |
| ์ฉ๋ | ์ฝ 18.9 GB |
| ๋ณด์ ๋ฐ์ดํฐ | ์์ (๊ฐ์ค์น๋ง์ผ๋ก ์ค์ผ์ผ ๊ณ์ฐ, ์ด๋ฆ ๊ธฐ๋ฐ model_free_ptq) |
์์ํ ์์ธ
- ๊ฐ์ค์น: FP4(E2M1), ๊ทธ๋ฃน ํฌ๊ธฐ 16 + ๊ทธ๋ฃน๋ณ FP8 ์ค์ผ์ผ (์๋ ๊ฒฐํฉ ์์ ์ ์ญ ์ค์ผ์ผ ๊ณต์ )
- ํ์ฑํ: BF16 (์์ํํ์ง ์์)
- ์์ํ ์ ์ฐจ: PTQ(ํ์ต ํ ์์ํ, ์ฌํ์ต ์์), ๋ณด์ ๋ฐ์ดํฐ ์์ด ๊ฐ์ค์น๋ง์ผ๋ก ์ค์ผ์ผ์ ์ ํด ๋ฐ์ฌ๋ฆผ(RTN)
- BF16 ์ ์ง: ํ ํฐ ์๋ฒ ๋ฉ, LM ํค๋, ๋ชจ๋ RMSNorm, MoE ๋ผ์ฐํฐ(
mlp.gate,e_score_correction_biasํฌํจ) - ์์ํ ๋์: ์ดํ
์
ยทMLP ์ ํ์ธต(projection) (MTP ์ธต
model.layers.47๋ ๋ค๋ฅธ ์ธต๊ณผ ๊ฐ์ด ์์ํ) - ์ ์ญ ์ค์ผ์ผ ๊ณต์ : vLLM์ด ํ GEMM์ผ๋ก ํฉ์ณ ๊ณ์ฐํ๋ ์(MLA
q_a_proj+kv_a_proj_with_mqa, ๋ชจ๋ ๋ผ์ฐํ ๋์ ์ ๋ฌธ๊ฐ(routed expert)ยท๊ณต์ ์ ๋ฌธ๊ฐ์gate_proj+up_proj)์ FP4 ์ ์ญ ์ค์ผ์ผ ํ๋๋ฅผ ๊ณต์ - ์๋ณธ ํ์ผ: ํ ํฌ๋์ด์ ยทchat template์ ์๋ณธ๊ณผ ๋์ผ
ํ์ง (์ค์ธก)
- ๋ฒค์น๋งํฌ ํ๊ท : 64.21 (์๋ณธ 67.14, 95.6%) โ MMLUยทGSM8KยทARC-ChallengeยทWinograndeยทKMMLUยทHAE-RAE 6์ข ํ๊ท , lm-evaluation-harness + vLLM, chat template ์๋ few-shotยทgreedy, ๋ชจ๋ ๋น๋๋ฅผ ๊ฐ์ ์ค์ ์ผ๋ก ์ธก์
- ํ๊ตญ์ด ๋ฒค์น๋งํฌ: KMMLU 47.38 (์๋ณธ 50.04, 94.7%) ยท HAE-RAE 59.67 (์๋ณธ 64.89, 91.9%)
- ์ฃผ์: โ ๏ธ ์ด ์ ๋ฐ๋์์ ํ์ง ์ ํ๊ฐ ๋๋ ทํจ (๋ฒค์น๋งํฌ ํ๊ท ์๋ณธ ๋๋น 95.6%) โ ํ์ง์ด ์ค์ํ๋ฉด 8๋นํธ(FP8ยทAWQ-8bit) ๋น๋ ๊ถ์ฅ
์๊ตฌ์ฌํญ
- ์คํ ์์ง: vLLM 0.15.0 ์ด์(์ด ๊ตฌ์กฐ๋ฅผ ์ง์ํ๋ ์ฒซ ๋ฒ์ ), ์ด ๋น๋๋ vLLM 0.32.0์์ ์คํ ํ์ธ
- vLLM 0.32 ์ค์น ์กฐ๊ฑด: Python 3.11~3.14, torch 2.13(CUDA 13.0 ๋น๋, CUDA 13 ์ง์ ๋๋ผ์ด๋ฒ ํ์), transformers 5.16.1 ์ด์ 5.20 ๋ฏธ๋ง, compressed-tensors 0.17.0 โ transformersยทcompressed-tensors๋ vLLM์ด ๋ฒ์ ์ ๊ณ ์ ํ๋ฏ๋ก compressed-tensors๋ฅผ ๋ฐ๋ก ์ ๊ทธ๋ ์ด๋ํ์ง ๋ง ๊ฒ (์ด ์ฒดํฌํฌ์ธํธ๋ 0.19.0์ผ๋ก ์ ์ฅ๋์ง๋ง 0.17.0์์๋ ๋ก๋๋จ)
- GPU: NVIDIA Turing(sm75) ์ด์, V100(sm70) ๋ฏธ์ง์ โ ๊ฐ์ค์น ์ ์ฉ FP4๋ผ FP4 ์ ์ฉ ํ ์์ฝ์ด ๋ถํ์ (GPU๋ณ ์ง์ ์ฌ๋ถ๋ vLLM 0.32 ์ปค๋ ์ ํ ์ฝ๋ ๊ธฐ์ค, ์ค์ ์คํ์ B200์์๋ง ํ์ธ)
- ๋ฉ๋ชจ๋ฆฌ: ๊ฐ์ค์น 18.9 GB + KV ์บ์(์ปจํ
์คํธ ๊ธธ์ด ร ๋์ ์์ฒญ ์์ ๋น๋ก) + ํ์ฑํยทCUDA graph์ฉ ์ GB โ GPU ํ ์ฅ์ ๋ค ๋ค์ด๊ฐ์ง ์์ผ๋ฉด
--tensor-parallel-size N์ผ๋ก ๋ถ์ฐ - Transformers๋ก ์ง์ ์ฌ์ฉ: ๋ถ๊ฐ โ 5.22.1๊น์ง ์ฌ๋ฐ๋ฅด๊ฒ ๋ก๋๋์ง ์์ ํ์ธ, vLLM ์ฌ์ฉ
- trust_remote_code: ๋ถํ์
์ฌ์ฉ๋ฒ
- ์๋ฒ ์คํ:
vllm serve axteam/GLM-4.7-Flash-NVFP4A16 --max-model-len 32768โ OpenAI ํธํ API - Python:
LLM(model="axteam/GLM-4.7-Flash-NVFP4A16", max_model_len=32768).chat(...)โ ์ ์ฒด ์์๋ ์ ์์ด ๋ณธ๋ฌธ 'Usage (vLLM)' ์ ์ฐธ๊ณ - ๊ถ์ฅ ์ํ๋ง:
temperature=1.0(์๋ณธgeneration_config.json๊ธฐ์ค) - thinking ๋ชจ๋: ๊ธฐ๋ณธ ์ผ์ง โ ๋๋ ค๋ฉด
chat_template_kwargs={"enable_thinking": False}์ ๋ฌ(Python์llm.chat()์ธ์, HTTP๋ ์์ฒญ ๋ณธ๋ฌธ์"chat_template_kwargs": {"enable_thinking": false}) - KV ์บ์ ์ ๊ฐ(์ ํ):
vllm serve์--kv-cache-dtype fp8์ถ๊ฐ โ ๊ธฐ๋ณธ BF16์ธ KV ์บ์๋ฅผ FP8๋ก ์ ์ฅํด KV ์บ์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฝ ์ ๋ฐ์ผ๋ก ์ค์ (๊ธด ์ปจํ ์คํธยท๋์ ์์ฒญ์ด ๋ง์ ๋ ์ ๋ฆฌ, ๊ฐ์ค์น ์์ํ์ ๋ณ๊ฐ์ธ ์คํ ์ต์ )
์ฐธ๊ณ
- ์์ ์ด๋ ฅ (2026-10-31): ์ฒ์ ์ฌ๋ฆฐ ๋น๋๋ vLLM์ด ํ GEMM์ผ๋ก ๊ณ์ฐํ๋ ๊ฐ์ค์น ์์ FP4 ์ ์ญ ์ค์ผ์ผ์ด ์๋ก ๋ฌ๋ผ ์ถ๋ ฅ์ด ๊นจ์ก์ โ ๋ค์ ์์ํํด ๊ต์ฒด, ์ด์ ์ ๋ฐ์๋ค๋ฉด ๋ค์ ๋ฐ์ ๊ฒ
๋ผ์ด์ ์ค
- ๋ผ์ด์ ์ค: MIT โ ์๋ณธ ๋ชจ๋ธ์ ๋ผ์ด์ ์ค๋ฅผ ๊ทธ๋๋ก ๋ฐ๋ฆ
- ๊ถ๋ฆฌ: ์๋ณธ ๋ชจ๋ธ์ ๊ถ๋ฆฌ๋ Z.ai์๊ฒ ์์, ์ด ๋ฆฌํฌ๋ ์์ํ ํ์๋ฌผ
- Downloads last month
- 736
Model tree for axteam/GLM-4.7-Flash-NVFP4A16
Base model
zai-org/GLM-4.7-Flash