dcw2 commited on
Commit
28407c6
·
verified ·
0 Parent(s):

Add Qwen3.5-9B-DFlash release

Browse files
Files changed (4) hide show
  1. .gitattributes +35 -0
  2. README.md +126 -0
  3. config.json +59 -0
  4. model.safetensors +3 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
README.md ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: text-generation
3
+ library_name: transformers
4
+ base_model:
5
+ - Qwen/Qwen3.5-9B
6
+ license: apache-2.0
7
+ inference: false
8
+ tags:
9
+ - dflash
10
+ - speculative-decoding
11
+ - speculative-decoding-draft
12
+ - block-diffusion
13
+ - draft-model
14
+ - diffusion-language-model
15
+ - efficiency
16
+ - qwen
17
+ - qwen3
18
+ - qwen3.5
19
+ - sglang
20
+ ---
21
+
22
+ # Qwen3.5-9B-DFlash
23
+
24
+ [Paper](https://arxiv.org/abs/2602.06036) | [Github](https://github.com/z-lab/dflash) | [Blog](https://z-lab.ai/projects/dflash)
25
+
26
+ This DFlash draft model is a joint retrain from [Z-Lab](https://z-lab.ai) and [Modal](https://modal.com), trained with 40k sequence length and sliding-window attention for improved long-context performance. It is mirrored across the following Hugging Face repositories:
27
+
28
+ - [`z-lab/Qwen3.5-9B-DFlash`](https://huggingface.co/z-lab/Qwen3.5-9B-DFlash)
29
+ - [`modal-labs/Qwen3.5-9B-DFlash`](https://huggingface.co/modal-labs/Qwen3.5-9B-DFlash)
30
+
31
+ This repository contains a DFlash draft model for `Qwen/Qwen3.5-9B`. It is not a standalone language model. It is intended to be paired with the target model in a speculative decoding server.
32
+
33
+ DFlash uses a lightweight block diffusion draft model to propose multiple tokens in parallel. The target model verifies those proposals, improving serving throughput while preserving the target model's output distribution.
34
+
35
+ ## Quick Start
36
+
37
+ This model should be used with an inference server that supports DFlash speculative decoding. An example SGLang deployment is:
38
+
39
+ ```bash
40
+ export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1
41
+
42
+ python -m sglang.launch_server \
43
+ --model-path Qwen/Qwen3.5-9B \
44
+ --trust-remote-code \
45
+ --speculative-algorithm DFLASH \
46
+ --speculative-draft-model-path modal-labs/Qwen3.5-9B-DFlash \
47
+ --speculative-dflash-block-size 8 \
48
+ --speculative-draft-attention-backend fa4 \
49
+ --attention-backend trtllm_mha \
50
+ --linear-attn-prefill-backend flashinfer \
51
+ --linear-attn-decode-backend flashinfer \
52
+ --mamba-scheduler-strategy extra_buffer \
53
+ --tp-size 1 \
54
+ --max-running-requests 32 \
55
+ --cuda-graph-max-bs-decode 32 \
56
+ --cuda-graph-backend-prefill tc_piecewise \
57
+ --enable-flashinfer-allreduce-fusion \
58
+ --mem-fraction-static 0.8 \
59
+ --host 0.0.0.0 \
60
+ --port 30000
61
+ ```
62
+
63
+ Block size `8` is the recommended default for higher-concurrency serving. Block size `16` gives longer accept lengths and strong concurrency-1 throughput in most workloads.
64
+
65
+ ## Benchmark Results
66
+
67
+ We benchmarked DFlash against the autoregressive baseline and Qwen's built-in MTP draft path. DFlash reaches up to `5.01x` speedup at concurrency 1 and `2.58x` at concurrency 32. Across the benchmark suite, DFlash delivers higher throughput than MTP at every matched setting where both completed.
68
+
69
+ ### Setup
70
+
71
+ - Runtime: SGLang on 1x NVIDIA B200 GPU, tensor parallel size 1, `bfloat16`
72
+ - Backends: `trtllm_mha` target attention, `fa4` DFlash draft attention, `flashinfer` linear-attention prefill and decode
73
+ - Workloads: GSM8K, MATH500, HumanEval, MBPP, and MT-Bench with the Qwen chat template
74
+ - Decoding: greedy, thinking enabled, max output length 4096 tokens
75
+ - Measurement: 5 independent runs per configuration at concurrency 1 and 32 with continuous batching
76
+ - Throughput: generated output tokens / wall-clock benchmark time, including prefill and scheduling
77
+ - Accept length: `completion_tokens / spec_verify_ct` per generation turn, averaged across generation turns
78
+
79
+ ### Throughput and Speedup
80
+
81
+ Each cell is `output tok/s (speedup)`. Bold marks the fastest speculative configuration in each row.
82
+
83
+ #### Concurrency 1
84
+
85
+ | Workload | Baseline | MTP steps=3 | DFlash block=4 | MTP steps=7 | DFlash block=8 | MTP steps=15 | DFlash block=16 |
86
+ | --- | --- | --- | --- | --- | --- | --- | --- |
87
+ | gsm8k | 245.2 (1.00x) | 537.7 (2.19x) | 609.8 (2.49x) | 573.4 (2.34x) | 890.7 (3.63x) | 435.5 (1.78x) | **1027.3 (4.19x)** |
88
+ | math500 | 244.6 (1.00x) | 558.3 (2.28x) | 636.3 (2.60x) | 617.3 (2.52x) | 987.6 (4.04x) | 485.3 (1.98x) | **1225.7 (5.01x)** |
89
+ | humaneval | 243.4 (1.00x) | 537.6 (2.21x) | 633.2 (2.60x) | 586.9 (2.41x) | 959.5 (3.94x) | 447.6 (1.84x) | **1195.8 (4.91x)** |
90
+ | mbpp | 244.7 (1.00x) | 526.4 (2.15x) | 624.4 (2.55x) | 543.6 (2.22x) | 935.7 (3.82x) | 403.6 (1.65x) | **1092.6 (4.46x)** |
91
+ | mt-bench | 243.7 (1.00x) | 501.7 (2.06x) | 560.2 (2.30x) | 494.6 (2.03x) | 757.5 (3.11x) | 368.0 (1.51x) | **834.3 (3.42x)** |
92
+
93
+ #### Concurrency 32
94
+
95
+ | Workload | Baseline | MTP steps=3 | DFlash block=4 | MTP steps=7 | DFlash block=8 | MTP steps=15 | DFlash block=16 |
96
+ | --- | --- | --- | --- | --- | --- | --- | --- |
97
+ | gsm8k | 5837.6 (1.00x) | 10421.0 (1.79x) | 11882.9 (2.04x) | 10132.5 (1.74x) | **13718.0 (2.35x)** | 8332.8 (1.43x) | 11019.7 (1.89x) |
98
+ | math500 | 5885.7 (1.00x) | 11124.9 (1.89x) | 12534.0 (2.13x) | 11213.3 (1.91x) | **15198.3 (2.58x)** | 7785.0 (1.32x) | 13227.4 (2.25x) |
99
+ | humaneval | 5513.0 (1.00x) | 9645.9 (1.75x) | 11882.7 (2.16x) | 9701.0 (1.76x) | **14229.9 (2.58x)** | 6901.7 (1.25x) | 12406.1 (2.25x) |
100
+ | mbpp | 5538.8 (1.00x) | 9116.4 (1.65x) | 11561.2 (2.09x) | 8701.6 (1.57x) | **13460.3 (2.43x)** | 6220.5 (1.12x) | 11338.9 (2.05x) |
101
+ | mt-bench | 5491.7 (1.00x) | 9135.0 (1.66x) | 10072.2 (1.83x) | 8436.9 (1.54x) | **10718.2 (1.95x)** | 5917.8 (1.08x) | 8495.7 (1.55x) |
102
+
103
+ ### Accept Length
104
+
105
+ Mean accept length at concurrency 1. Bold marks the higher value in each matched MTP/DFlash pair.
106
+
107
+ | Workload | MTP steps=3 | DFlash block=4 | MTP steps=7 | DFlash block=8 | MTP steps=15 | DFlash block=16 |
108
+ | --- | --- | --- | --- | --- | --- | --- |
109
+ | gsm8k | **3.464** | 3.452 | 5.276 | **5.400** | 6.388 | **6.949** |
110
+ | math500 | 3.541 | **3.555** | 5.466 | **5.757** | 6.728 | **7.721** |
111
+ | humaneval | 3.493 | **3.571** | 5.326 | **5.798** | 6.399 | **7.927** |
112
+ | mbpp | 3.338 | **3.454** | 4.790 | **5.376** | 5.508 | **6.820** |
113
+ | mt-bench | **3.229** | 3.193 | 4.551 | **4.606** | 5.438 | **5.716** |
114
+
115
+ ## Citation
116
+
117
+ If you find DFlash useful, please cite the original paper:
118
+
119
+ ```bibtex
120
+ @article{chen2026dflash,
121
+ title = {{DFlash: Block Diffusion for Flash Speculative Decoding}},
122
+ author = {Chen, Jian and Liang, Yesheng and Liu, Zhijian},
123
+ journal = {arXiv preprint arXiv:2602.06036},
124
+ year = {2026}
125
+ }
126
+ ```
config.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DFlashDraftModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoModel": "dflash.DFlashDraftModel"
9
+ },
10
+ "bos_token_id": null,
11
+ "dflash_config": {
12
+ "block_size": 16,
13
+ "mask_token_id": 248077,
14
+ "target_layer_ids": [
15
+ 1,
16
+ 5,
17
+ 9,
18
+ 13,
19
+ 17,
20
+ 21,
21
+ 25,
22
+ 29
23
+ ]
24
+ },
25
+ "dtype": "bfloat16",
26
+ "eos_token_id": 248044,
27
+ "head_dim": 128,
28
+ "hidden_act": "silu",
29
+ "hidden_size": 4096,
30
+ "initializer_range": 0.02,
31
+ "intermediate_size": 12288,
32
+ "layer_types": [
33
+ "sliding_attention",
34
+ "sliding_attention",
35
+ "sliding_attention",
36
+ "sliding_attention",
37
+ "sliding_attention",
38
+ "full_attention"
39
+ ],
40
+ "max_position_embeddings": 262144,
41
+ "max_window_layers": 6,
42
+ "model_type": "qwen3",
43
+ "num_attention_heads": 32,
44
+ "num_hidden_layers": 6,
45
+ "num_key_value_heads": 8,
46
+ "num_target_layers": 32,
47
+ "pad_token_id": null,
48
+ "rms_norm_eps": 1e-06,
49
+ "rope_parameters": {
50
+ "rope_theta": 10000000,
51
+ "rope_type": "default"
52
+ },
53
+ "sliding_window": 4096,
54
+ "tie_word_embeddings": false,
55
+ "transformers_version": "5.7.0",
56
+ "use_cache": true,
57
+ "use_sliding_window": true,
58
+ "vocab_size": 248320
59
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a42274b32554f48de1faa0d42824e9c2ceda649c30ae0a731cddf410dd698c7
3
+ size 2583816465