Text Generation
Transformers
Safetensors
English
Chinese
glm4_moe_lite
Mixture of Experts
nvfp4
quantized
vllm
glm
30b
mtp
speculative-decoding
conversational
8-bit precision
compressed-tensors
Instructions to use GadflyII/GLM-4.7-Flash-MTP-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GadflyII/GLM-4.7-Flash-MTP-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GadflyII/GLM-4.7-Flash-MTP-NVFP4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("GadflyII/GLM-4.7-Flash-MTP-NVFP4") model = AutoModelForCausalLM.from_pretrained("GadflyII/GLM-4.7-Flash-MTP-NVFP4") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use GadflyII/GLM-4.7-Flash-MTP-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GadflyII/GLM-4.7-Flash-MTP-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GadflyII/GLM-4.7-Flash-MTP-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GadflyII/GLM-4.7-Flash-MTP-NVFP4
- SGLang
How to use GadflyII/GLM-4.7-Flash-MTP-NVFP4 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 "GadflyII/GLM-4.7-Flash-MTP-NVFP4" \ --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": "GadflyII/GLM-4.7-Flash-MTP-NVFP4", "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 "GadflyII/GLM-4.7-Flash-MTP-NVFP4" \ --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": "GadflyII/GLM-4.7-Flash-MTP-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use GadflyII/GLM-4.7-Flash-MTP-NVFP4 with Docker Model Runner:
docker model run hf.co/GadflyII/GLM-4.7-Flash-MTP-NVFP4
Update README.md
Browse files
README.md
CHANGED
|
@@ -19,7 +19,7 @@ pipeline_tag: text-generation
|
|
| 19 |
# Note: If you have a multi-GPU SM120 Blackwell system (RTX 50/Pro), try my vLLM fork to resolve P2P / TP=2 issues (Pending PR into upstream).
|
| 20 |
https://github.com/Gadflyii/vllm/tree/main
|
| 21 |
|
| 22 |
-
# GLM-4.7-Flash-MTP-NVFP4 (Mixed Precision with MTP
|
| 23 |
|
| 24 |
This is a **mixed precision NVFP4 quantization** of [zai-org/GLM-4.7-Flash](https://huggingface.co/zai-org/GLM-4.7-Flash), a 30B-A3B (30B total, 3B active) Mixture-of-Experts model. This version preserves **MTP (Multi-Token Prediction) layers in BF16** for speculative decoding compatibility.
|
| 25 |
|
|
@@ -27,8 +27,7 @@ This is a **mixed precision NVFP4 quantization** of [zai-org/GLM-4.7-Flash](http
|
|
| 27 |
|
| 28 |
| Feature | GLM-4.7-Flash-NVFP4 | **This Model** |
|
| 29 |
|---------|---------------------|----------------|
|
| 30 |
-
| MTP Layers |
|
| 31 |
-
| MTP Speculative Decoding | ❌ Not supported | ✅ Supported |
|
| 32 |
| Calibration Samples | 128 | **512** |
|
| 33 |
| Calibration Seq Length | 2048 | **4096** |
|
| 34 |
| MMLU-Pro Accuracy | 23.56% | **23.91%** |
|
|
@@ -47,13 +46,12 @@ This model uses **mixed precision** to preserve accuracy and MTP functionality:
|
|
| 47 |
|
| 48 |
## Performance
|
| 49 |
|
| 50 |
-
| Metric | BF16 | NVFP4
|
| 51 |
|--------|------|----------|----------------|
|
| 52 |
| MMLU-Pro | 24.83% | 23.56% | **23.91%** |
|
| 53 |
| Size | 62.4 GB | 20.4 GB | **20.9 GB** |
|
| 54 |
| Compression | 1x | 3.1x | **3.0x** |
|
| 55 |
| Accuracy Loss | - | -1.27% | **-0.92%** |
|
| 56 |
-
| MTP Working | ✅ | ❌ | ✅ |
|
| 57 |
|
| 58 |
### MTP Acceptance Rate
|
| 59 |
|
|
@@ -68,12 +66,12 @@ MTP quality is preserved (actually slightly improved) after quantization.
|
|
| 68 |
|
| 69 |
MTP speculative decoding currently shows overhead rather than speedup due to missing `torch.compile` support for the MTP drafter model in vLLM. For best throughput, run without MTP enabled until this is resolved upstream.
|
| 70 |
|
| 71 |
-
| Configuration | Tokens/sec |
|
| 72 |
-
|---------------|------------|
|
| 73 |
-
| Without MTP | 78.1 tok/s |
|
| 74 |
-
| With MTP (1 token) | 64.7 tok/s |
|
| 75 |
-
| With MTP (2 tokens) | 56.8 tok/s |
|
| 76 |
-
| With MTP (4 tokens) | 44.5 tok/s |
|
| 77 |
|
| 78 |
## Usage
|
| 79 |
|
|
|
|
| 19 |
# Note: If you have a multi-GPU SM120 Blackwell system (RTX 50/Pro), try my vLLM fork to resolve P2P / TP=2 issues (Pending PR into upstream).
|
| 20 |
https://github.com/Gadflyii/vllm/tree/main
|
| 21 |
|
| 22 |
+
# GLM-4.7-Flash-MTP-NVFP4 (Mixed Precision with MTP in BF16)
|
| 23 |
|
| 24 |
This is a **mixed precision NVFP4 quantization** of [zai-org/GLM-4.7-Flash](https://huggingface.co/zai-org/GLM-4.7-Flash), a 30B-A3B (30B total, 3B active) Mixture-of-Experts model. This version preserves **MTP (Multi-Token Prediction) layers in BF16** for speculative decoding compatibility.
|
| 25 |
|
|
|
|
| 27 |
|
| 28 |
| Feature | GLM-4.7-Flash-NVFP4 | **This Model** |
|
| 29 |
|---------|---------------------|----------------|
|
| 30 |
+
| MTP Layers | NVFP4 | BF16 |
|
|
|
|
| 31 |
| Calibration Samples | 128 | **512** |
|
| 32 |
| Calibration Seq Length | 2048 | **4096** |
|
| 33 |
| MMLU-Pro Accuracy | 23.56% | **23.91%** |
|
|
|
|
| 46 |
|
| 47 |
## Performance
|
| 48 |
|
| 49 |
+
| Metric | BF16 | NVFP4 | **This Model** |
|
| 50 |
|--------|------|----------|----------------|
|
| 51 |
| MMLU-Pro | 24.83% | 23.56% | **23.91%** |
|
| 52 |
| Size | 62.4 GB | 20.4 GB | **20.9 GB** |
|
| 53 |
| Compression | 1x | 3.1x | **3.0x** |
|
| 54 |
| Accuracy Loss | - | -1.27% | **-0.92%** |
|
|
|
|
| 55 |
|
| 56 |
### MTP Acceptance Rate
|
| 57 |
|
|
|
|
| 66 |
|
| 67 |
MTP speculative decoding currently shows overhead rather than speedup due to missing `torch.compile` support for the MTP drafter model in vLLM. For best throughput, run without MTP enabled until this is resolved upstream.
|
| 68 |
|
| 69 |
+
| Configuration | Tokens/sec |
|
| 70 |
+
|---------------|------------|
|
| 71 |
+
| Without MTP | 78.1 tok/s |
|
| 72 |
+
| With MTP (1 token) | 64.7 tok/s |
|
| 73 |
+
| With MTP (2 tokens) | 56.8 tok/s |
|
| 74 |
+
| With MTP (4 tokens) | 44.5 tok/s |
|
| 75 |
|
| 76 |
## Usage
|
| 77 |
|