spiritbuun commited on
Commit
e0b6207
·
verified ·
1 Parent(s): 681bb3c

Upload Q4_K_M GGUF + model card

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +136 -0
  3. dflash-draft-q4_k_m.gguf +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* 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
 
 
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
+ dflash-draft-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: gguf
4
+ base_model: z-lab/Qwen3.5-27B-DFlash
5
+ tags:
6
+ - gguf
7
+ - speculative-decoding
8
+ - dflash
9
+ - drafter
10
+ - llama.cpp
11
+ - quantized
12
+ ---
13
+
14
+ # Qwen3.5-27B-DFlash — GGUF (Q4_K_M)
15
+
16
+ **Q4_K_M llama.cpp quantization** of [`z-lab/Qwen3.5-27B-DFlash`](https://huggingface.co/z-lab/Qwen3.5-27B-DFlash), the block-diffusion drafter for DFlash speculative decoding. Pair it with any Qwen3.5-27B target model (e.g. `Qwen/Qwen3.5-27B`).
17
+
18
+ Only **Q4_K_M** is published here — on our RTX 3090 benchmarks Q4_K_M was the optimal operating point for this drafter; Q8_0 and F16 did not produce better end-to-end decode throughput, so they're intentionally omitted to keep the pairing simple.
19
+
20
+ ## Requirements
21
+
22
+ DFlash speculative decoding is **not yet in upstream `llama.cpp`**. You need the fork that carries the tape-replay rollback, hidden-state capture, and tree-aware SSM kernels:
23
+
24
+ - Fork: [`spiritbuun/buun-llama-cpp`](https://github.com/spiritbuun/buun-llama-cpp) (branch `master`)
25
+ - Built with: `cmake -B build -DGGML_CUDA=ON -DGGML_NATIVE=ON -DGGML_CUDA_FA=ON -DGGML_CUDA_FA_ALL_QUANTS=ON`
26
+
27
+ ## Usage
28
+
29
+ ### `llama-server`
30
+ ```bash
31
+ ./build/bin/llama-server \
32
+ -m /path/to/Qwen3.5-27B-target.Q4_K_M.gguf \
33
+ -md /path/to/dflash-draft-q4_k_m.gguf \
34
+ --spec-type dflash \
35
+ -ngl 99 -ngld 99 \
36
+ -np 1 -c 6048 -cd 256 \
37
+ -fa on -b 256 -ub 64 \
38
+ --host 0.0.0.0 --port 8080 --jinja
39
+ ```
40
+
41
+ ### `llama-speculative-simple`
42
+ ```bash
43
+ ./build/bin/llama-speculative-simple \
44
+ -m /path/to/Qwen3.5-27B-target.Q4_K_M.gguf \
45
+ -md /path/to/dflash-draft-q4_k_m.gguf \
46
+ --spec-type dflash \
47
+ -ngl 99 -ngld 99 \
48
+ -c 4096 --draft-max 16 --draft-min 1 \
49
+ -p "Write a Python mergesort."
50
+ ```
51
+
52
+ ## Observed performance (RTX 3090, Qwen3.5-27B-heretic target Q4_K_M)
53
+
54
+ | Workload | Draft ON (t/s) | Draft OFF (t/s) | Acceptance |
55
+ |---------------------------|---------------:|----------------:|-----------:|
56
+ | Code (raw prompt) | 140 | 40 | 69 % |
57
+ | Code (chat template) | 99 | 40 | 37 % |
58
+ | Prose (raw prompt) | 60 | 40 | 77 % |
59
+
60
+ **Heads-up on chat templates.** The drafter was trained on raw continuations; wrapping the prompt in Qwen chat-template tokens (`<|im_start|>` etc.) shifts the hidden-state distribution the drafter's cross-attention expects. Acceptance on code drops from **69 % → 37 %** when the template is applied, and end-to-end throughput drops correspondingly. Raw-mode generation is still a strong speedup; chat-mode is a more modest one. A drafter retrained on chat-formatted data would be needed to recover the full speedup under a chat template.
61
+
62
+ ## Quantization details
63
+
64
+ - Source: `z-lab/Qwen3.5-27B-DFlash` (BF16 safetensors, 2 B parameters)
65
+ - Converter: `convert_hf_to_gguf.py` from [`spiritbuun/buun-llama-cpp`](https://github.com/spiritbuun/buun-llama-cpp) (adds `DFlashDraftModel` arch)
66
+ - Quant: `llama-quantize` → `Q4_K_M`
67
+ - File size: ~1.0 GB
68
+ - Tensors: drafter transformer + projection heads + cross-attention layers targeting Qwen3.5-27B layer ids `[1, 16, 31, 46, 61]`
69
+
70
+ ---
71
+
72
+ # Original model card — `z-lab/Qwen3.5-27B-DFlash`
73
+
74
+ *Reproduced from the upstream model page. License: MIT.*
75
+
76
+ ## Overview
77
+ **Qwen3.5-27B-DFlash** is a lightweight **drafter** component for DFlash speculative decoding. It must be used with the target model `Qwen/Qwen3.5-27B`.
78
+
79
+ - **Paper**: https://arxiv.org/abs/2602.06036
80
+ - **GitHub**: https://github.com/z-lab/dflash
81
+ - **Blog**: https://z-lab.ai/projects/dflash/
82
+ - **Model Size**: 2B parameters (BF16)
83
+ - **Context Length**: 4096 tokens
84
+
85
+ ## What is DFlash?
86
+ DFlash is a novel speculative decoding method using a lightweight block diffusion model for drafting, enabling efficient, high-quality parallel drafting that significantly speeds up inference.
87
+
88
+ ## Upstream Quick Start (vLLM / SGLang)
89
+
90
+ ### vLLM
91
+ ```bash
92
+ uv pip install -U vllm --torch-backend=auto --extra-index-url https://wheels.vllm.ai/nightly
93
+
94
+ vllm serve Qwen/Qwen3.5-27B \
95
+ --speculative-config '{"method": "dflash", "model": "z-lab/Qwen3.5-27B-DFlash", "num_speculative_tokens": 15}' \
96
+ --attention-backend flash_attn \
97
+ --max-num-batched-tokens 32768
98
+ ```
99
+
100
+ ### SGLang
101
+ ```bash
102
+ uv pip install "git+https://github.com/sgl-project/sglang.git@refs/pull/20547/head#subdirectory=python"
103
+
104
+ python -m sglang.launch_server \
105
+ --model-path Qwen/Qwen3.5-27B \
106
+ --speculative-algorithm DFLASH \
107
+ --speculative-draft-model-path z-lab/Qwen3.5-27B-DFlash \
108
+ --speculative-num-draft-tokens 16 \
109
+ --tp-size 1 \
110
+ --attention-backend fa3 \
111
+ --mem-fraction-static 0.75 \
112
+ --trust-remote-code
113
+ ```
114
+
115
+ ## Upstream Benchmarks (NVIDIA B200, BF16)
116
+
117
+ **Up to 5.2× speedup** over autoregressive baseline at concurrency 1 on HumanEval with block size 16.
118
+
119
+ | Task | Concurrency | AR | DFlash (B16) | Speedup |
120
+ |-----------|-------------|-----|--------------|---------|
121
+ | Math500 | 1 | 84 | **397** | **4.7×** |
122
+ | HumanEval | 1 | 83 | **427** | **5.2×** |
123
+ | GSM8K | 1 | 83 | **330** | **4.0×** |
124
+
125
+ ## Citation
126
+ ```bibtex
127
+ @article{chen2026dflash,
128
+ title = {{DFlash: Block Diffusion for Flash Speculative Decoding}},
129
+ author = {Chen, Jian and Liang, Yesheng and Liu, Zhijian},
130
+ journal = {arXiv preprint arXiv:2602.06036},
131
+ year = {2026}
132
+ }
133
+ ```
134
+
135
+ ## License
136
+ **MIT** — inherited from the upstream model. This repository redistributes a quantized derivative under the same terms.
dflash-draft-q4_k_m.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3adbef5d972993175c086d92e8bdb6391feb90b7ef01e480c6e82197ea6929b
3
+ size 1033066912