Text Generation
Transformers
Safetensors
qwen3
speculative-decoding
dflash
draft-model
glm
z.ai
text-generation-inference
Instructions to use Dariusfar/GLM-4.7-Flash-DFlash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dariusfar/GLM-4.7-Flash-DFlash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Dariusfar/GLM-4.7-Flash-DFlash")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Dariusfar/GLM-4.7-Flash-DFlash") model = AutoModel.from_pretrained("Dariusfar/GLM-4.7-Flash-DFlash", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Dariusfar/GLM-4.7-Flash-DFlash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Dariusfar/GLM-4.7-Flash-DFlash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dariusfar/GLM-4.7-Flash-DFlash", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Dariusfar/GLM-4.7-Flash-DFlash
- SGLang
How to use Dariusfar/GLM-4.7-Flash-DFlash 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 "Dariusfar/GLM-4.7-Flash-DFlash" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dariusfar/GLM-4.7-Flash-DFlash", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Dariusfar/GLM-4.7-Flash-DFlash" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dariusfar/GLM-4.7-Flash-DFlash", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Dariusfar/GLM-4.7-Flash-DFlash with Docker Model Runner:
docker model run hf.co/Dariusfar/GLM-4.7-Flash-DFlash
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -45,9 +45,52 @@ Pair with **GLM-4.7-Flash** in a DFlash-capable inference stack (e.g. a speculat
|
|
| 45 |
serving engine). It requires the target model plus a DFlash runtime and does not generate text
|
| 46 |
on its own.
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
## Training
|
| 49 |
|
| 50 |
-
Trained on NERSC Perlmutter; exported from training checkpoint `step_2916`.
|
|
|
|
|
|
|
| 51 |
|
| 52 |
## License
|
| 53 |
|
|
|
|
| 45 |
serving engine). It requires the target model plus a DFlash runtime and does not generate text
|
| 46 |
on its own.
|
| 47 |
|
| 48 |
+
## Method note: decoupling draft width from verification depth
|
| 49 |
+
|
| 50 |
+
A DFlash-style drafter normally uses a **single width `k`** for both the draft pass *and* the
|
| 51 |
+
number of proposals the target verifies. In this work those two knobs are **decoupled** into
|
| 52 |
+
independent, fixed-shape controls:
|
| 53 |
+
|
| 54 |
+
- **`draft_width`** — the non-causal DFlash draft-query width. Because mask rows attend to one
|
| 55 |
+
another, a *wider* draft pass shifts the **acceptance** profile at early positions.
|
| 56 |
+
- **`verify_k`** — how many of those proposals are actually sent to the target for verification.
|
| 57 |
+
On a **fine-grained MoE target** like GLM-4.7-Flash, each verified token is expensive, so this
|
| 58 |
+
is the real cost driver.
|
| 59 |
+
|
| 60 |
+
The technique runs the proposer at a **wide** `draft_width`, keeps only the first `verify_k`
|
| 61 |
+
proposals, and verifies just that prefix — discarding the tail *before it ever enters the
|
| 62 |
+
target's KV / sequence state*. Draft and verify graphs stay fixed-shape (CUDA-graph
|
| 63 |
+
capturable), and target output semantics are preserved (the DeepSpec `prediction_shifted` row
|
| 64 |
+
contract), so the accelerated path is numerically faithful to the target.
|
| 65 |
+
|
| 66 |
+
**Why it helps.** A wide draft raises the number of committed tokens at early positions
|
| 67 |
+
(≈3.1 committed through position 4 at width-8, vs ≈2.1 at width-4), while a short verify avoids
|
| 68 |
+
paying MoE verification cost on the low-probability tail. The two optima are genuinely
|
| 69 |
+
different, so tying them together leaves throughput on the table.
|
| 70 |
+
|
| 71 |
+
### Results
|
| 72 |
+
|
| 73 |
+
The sweet spot was **wide draft (8) / short verify (3)**. On a fixed same-node benchmark it
|
| 74 |
+
delivered **~1.16× throughput vs. an MTP-1 baseline** and **~+3% over the matched coupled
|
| 75 |
+
setting** (mean accepted length 2.50 vs 2.40) at **flat p95 latency**. The gain is strongly
|
| 76 |
+
**workload-dependent** (≈0.97×–1.54× across code / reasoning / numerical-optimization prompts),
|
| 77 |
+
which motivates **workload-aware / request-level routing** rather than one static configuration.
|
| 78 |
+
|
| 79 |
+

|
| 80 |
+
|
| 81 |
+
*Draft-width × verify-depth matrix: acceptance and throughput across the swept configurations.
|
| 82 |
+
Wide-draft / short-verify (e.g. 8/3) sits at the throughput optimum.*
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
|
| 86 |
+
*Full-domain throughput vs. baselines (MTP-1 and coupled DFlash). Note the strong per-workload
|
| 87 |
+
variation — the motivation for request-level routing.*
|
| 88 |
+
|
| 89 |
## Training
|
| 90 |
|
| 91 |
+
Trained on NERSC Perlmutter (4×A100-40GB); exported from training checkpoint `step_2916`.
|
| 92 |
+
Draft config: block 16, 8-layer draft (hidden 2048), auxiliary hidden states from target
|
| 93 |
+
layers [1, 12, 23, 33, 44].
|
| 94 |
|
| 95 |
## License
|
| 96 |
|