zhijianliu commited on
Commit
bae18bb
·
0 Parent(s):
Files changed (5) hide show
  1. .gitattributes +36 -0
  2. README.md +147 -0
  3. assets/dflash2-figure.png +3 -0
  4. config.json +63 -0
  5. model.safetensors +3 -0
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/dflash2-figure.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-nd-4.0
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ base_model:
6
+ - zai-org/GLM-5.3
7
+ inference: false
8
+ tags:
9
+ - dflash
10
+ - dflash2
11
+ - speculative-decoding
12
+ - block-diffusion
13
+ - draft-model
14
+ - sglang
15
+ ---
16
+
17
+ # GLM-5.3-DFlash2
18
+
19
+ [Blog](https://inco.ai/blog/dflash2/) | [GitHub](https://github.com/z-lab/dflash)
20
+
21
+ This repository contains the DFlash 2 draft model for
22
+ [`zai-org/GLM-5.3`](https://huggingface.co/zai-org/GLM-5.3).
23
+ It is not a standalone language model: it runs inside a speculative
24
+ decoding server and drafts tokens for the target model to verify.
25
+
26
+ DFlash 2 is a block-diffusion drafter for speculative decoding. It predicts
27
+ a whole block of tokens in a single pass and keeps the top candidates at
28
+ every position. A lightweight selector then traces one coherent path through them.
29
+ Two-tap dynamic convolutions in the backbone keep the draft from decaying
30
+ toward the end of the block. Decoding is lossless: greedy output
31
+ matches the target model exactly, and sampling preserves its distribution.
32
+
33
+ <div align="center">
34
+ <img src="assets/dflash2-figure.png" alt="DFlash 2: parallel block drafting with a candidate path selector" width="100%">
35
+ </div>
36
+
37
+ ## Quick Start
38
+
39
+ Serve with [SGLang](https://github.com/sgl-project/sglang):
40
+
41
+ ```bash
42
+ pip install "sglang[all] @ git+https://github.com/sgl-project/sglang.git#subdirectory=python"
43
+
44
+ sglang serve \
45
+ --model-path zai-org/GLM-5.3 \
46
+ --tp-size 4 \
47
+ --trust-remote-code \
48
+ --speculative-algorithm DFLASH \
49
+ --speculative-draft-model-path incoai/GLM-5.3-DFlash2 \
50
+ --speculative-draft-attention-backend fa4
51
+ ```
52
+
53
+ DFlash 2 is also supported by vLLM v0.28.0 and later; see
54
+ [`incoai/GLM-5.3-NVFP4`](https://huggingface.co/incoai/GLM-5.3-NVFP4) for a
55
+ vLLM serving example with the NVFP4-quantized target. See the
56
+ [blog post](https://inco.ai/blog/dflash2/) for more details.
57
+
58
+ ## Evaluation
59
+
60
+ - Runtime: SGLang on four NVIDIA GB300 GPUs (TP4), with FlashAttention 4 for DFlash 2 draft attention
61
+ - Speculation block size: 8 (7 draft tokens per verification step)
62
+ - Sampling: GLM-5.3's officially recommended parameters (temperature 1.0, top-p 0.95), with the default `Max` reasoning effort
63
+ - Maximum new tokens: 4096
64
+ - Samples: 128 at concurrency 1; 1,024 at concurrency 8 and 32
65
+
66
+ We compare autoregressive decoding, GLM-5.3's native MTP, and DFlash 2.
67
+ All speculative methods propose seven draft tokens per verification step.
68
+
69
+ ### Acceptance Length
70
+
71
+ Acceptance length is the per-request mean of completion tokens divided by verification steps.
72
+ Higher is better.
73
+
74
+ | Task | MTP | DFlash 2 |
75
+ | :--- | ---: | ---: |
76
+ | GSM8K | 5.12 | **5.94** |
77
+ | MATH-500 | 5.05 | **6.02** |
78
+ | HumanEval | 4.85 | **5.48** |
79
+ | MBPP | 4.34 | **4.95** |
80
+ | MT-Bench | 3.81 | **4.19** |
81
+
82
+ ### Throughput
83
+
84
+ Throughput is total output tokens divided by end-to-end wall time.
85
+ Each cell shows `output tok/s (speedup vs. autoregressive)`.
86
+
87
+ #### Concurrency 1
88
+
89
+ | Task | Autoregressive | MTP | DFlash 2 |
90
+ | :--- | ---: | ---: | ---: |
91
+ | GSM8K | 113.4 | 292.6 (2.58×) | **366.6 (3.23×)** |
92
+ | MATH-500 | 113.1 | 297.4 (2.63×) | **383.3 (3.39×)** |
93
+ | HumanEval | 113.7 | 292.9 (2.58×) | **363.7 (3.20×)** |
94
+ | MBPP | 113.4 | 266.5 (2.35×) | **336.5 (2.97×)** |
95
+ | MT-Bench | 113.2 | 206.8 (1.83×) | **244.3 (2.16×)** |
96
+
97
+ #### Concurrency 8
98
+
99
+ | Task | Autoregressive | MTP | DFlash 2 |
100
+ | :--- | ---: | ---: | ---: |
101
+ | GSM8K | 535.3 | 1,094.5 (2.04×) | **1,310.4 (2.45×)** |
102
+ | MATH-500 | 549.6 | 1,145.6 (2.08×) | **1,409.7 (2.56×)** |
103
+ | HumanEval | 554.4 | 1,133.8 (2.05×) | **1,360.6 (2.45×)** |
104
+ | MBPP | 554.2 | 1,049.7 (1.89×) | **1,277.4 (2.31×)** |
105
+ | MT-Bench | 544.5 | 807.0 (1.48×) | **895.5 (1.64×)** |
106
+
107
+ #### Concurrency 32
108
+
109
+ | Task | Autoregressive | MTP | DFlash 2 |
110
+ | :--- | ---: | ---: | ---: |
111
+ | GSM8K | 1,142.7 | 2,283.6 (2.00×) | **2,694.5 (2.36×)** |
112
+ | MATH-500 | 1,251.8 | 2,943.2 (2.35×) | **3,559.8 (2.84×)** |
113
+ | HumanEval | 1,303.1 | 3,016.9 (2.32×) | **3,589.1 (2.75×)** |
114
+ | MBPP | 1,292.8 | 2,790.2 (2.16×) | **3,380.4 (2.61×)** |
115
+ | MT-Bench | 1,262.7 | 2,119.5 (1.68×) | **2,345.0 (1.86×)** |
116
+
117
+ ## License
118
+
119
+ This model is released under
120
+ [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/)
121
+ for research and evaluation. For commercial licensing, contact
122
+ [contact@inco.ai](mailto:contact@inco.ai).
123
+
124
+ ## Citation
125
+
126
+ If you find DFlash 2 useful, please cite:
127
+
128
+ ```bibtex
129
+ @misc{inco2026dflash2,
130
+ title = {{DFlash 2: Keep Drafting Parallel}},
131
+ author = {{Inco AI}},
132
+ year = {2026},
133
+ month = {August},
134
+ url = {https://inco.ai/blog/dflash2/}
135
+ }
136
+ ```
137
+
138
+ Please also cite the original DFlash paper:
139
+
140
+ ```bibtex
141
+ @inproceedings{chen2026dflash,
142
+ title = {{DFlash: Block Diffusion for Flash Speculative Decoding}},
143
+ author = {Chen, Jian and Liang, Yesheng and Liu, Zhijian},
144
+ booktitle = {International Conference on Machine Learning (ICML)},
145
+ year = {2026}
146
+ }
147
+ ```
assets/dflash2-figure.png ADDED

Git LFS Details

  • SHA256: 6d8dcc9a9472bddb644c881fe83050b5343d09bf5ffb0912e5598e55fe671e99
  • Pointer size: 131 Bytes
  • Size of remote file: 287 kB
config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DFlash2DraftModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": null,
8
+ "dflash_config": {
9
+ "block_size": 8,
10
+ "conv_group_size": 16,
11
+ "conv_kernel_size": 2,
12
+ "mask_token_id": 154856,
13
+ "selector_rank": 256,
14
+ "selector_top_k": 16,
15
+ "target_layer_ids": [
16
+ 5,
17
+ 19,
18
+ 33,
19
+ 47,
20
+ 61,
21
+ 75
22
+ ]
23
+ },
24
+ "dtype": "bfloat16",
25
+ "eos_token_id": [
26
+ 154820,
27
+ 154827,
28
+ 154829
29
+ ],
30
+ "head_dim": 128,
31
+ "hidden_act": "silu",
32
+ "hidden_size": 6144,
33
+ "initializer_range": 0.02,
34
+ "intermediate_size": 12288,
35
+ "is_causal": false,
36
+ "layer_types": [
37
+ "sliding_attention",
38
+ "sliding_attention",
39
+ "sliding_attention",
40
+ "sliding_attention",
41
+ "sliding_attention",
42
+ "sliding_attention"
43
+ ],
44
+ "max_position_embeddings": 1048576,
45
+ "max_window_layers": 6,
46
+ "model_type": "qwen3",
47
+ "num_attention_heads": 64,
48
+ "num_hidden_layers": 6,
49
+ "num_key_value_heads": 8,
50
+ "num_target_layers": 78,
51
+ "pad_token_id": 154820,
52
+ "rms_norm_eps": 1e-05,
53
+ "rope_parameters": {
54
+ "rope_theta": 1000000,
55
+ "rope_type": "default"
56
+ },
57
+ "sliding_window": 2048,
58
+ "tie_word_embeddings": false,
59
+ "transformers_version": "5.7.0",
60
+ "use_cache": false,
61
+ "use_sliding_window": true,
62
+ "vocab_size": 154880
63
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ed9d14ad9a56fe587e3b5c1096ae14ee1e49baf52c0566b039ef62bd42ec3e9
3
+ size 4918859112