DFlash is a speculative decoding method that uses a lightweight
block diffusion model to draft multiple tokens in parallel. This is the drafter model, which must be paired with
google/gemma-4-31B-it.
vLLM: until Gemma4 DFlash support is merged, install vLLM from
PR #41703:
1uv pip install -U --torch-backend=auto \
2 "vllm @ git+https://github.com/vllm-project/vllm.git@refs/pull/41703/head"
1vllm serve google/gemma-4-31B-it \
2 --speculative-config '{"method": "dflash", "model": "z-lab/gemma-4-31B-it-DFlash", "num_speculative_tokens": 15, "attention_backend": "flash_attn"}' \
3 --attention-backend triton_attn \
4 --max-num-batched-tokens 32768 \
5 --trust-remote-code
1# Optional: enable schedule overlapping (experimental, may not be stable)
2# export SGLANG_ENABLE_SPEC_V2=1
3# export SGLANG_ENABLE_DFLASH_SPEC_V2=1
4# export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1
5
6python -m sglang.launch_server \
7 --model-path google/gemma-4-31B-it \
8 --speculative-algorithm DFLASH \
9 --speculative-draft-model-path z-lab/gemma-4-31B-it-DFlash \
10 --speculative-num-draft-tokens 16 \
11 --tp-size 1 \
12 --attention-backend triton \
13 --speculative-draft-attention-backend fa4 \
14 --trust-remote-code
1from openai import OpenAI
2
3client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
4
5response = client.chat.completions.create(
6 model="google/gemma-4-31B-it",
7 messages=[{"role": "user", "content": "Write a quicksort in Python."}],
8 max_tokens=4096,
9 temperature=0.0,
10 extra_body={"chat_template_kwargs": {"enable_thinking": True}},
11)
12print(response.choices[0].message.content)
Special thanks to
David Wang for his outstanding engineering support on this project. We are also grateful to
Modal,
InnoMatrix, and
Yotta Labs for providing the compute resources used to train this draft model.
If you find DFlash useful, please cite our work. To share feedback on DFlash or request new model support, please fill out this form:
DFlash Feedback.
1@article{chen2026dflash,
2 title = {{DFlash: Block Diffusion for Flash Speculative Decoding}},
3 author = {Chen, Jian and Liang, Yesheng and Liu, Zhijian},
4 journal = {arXiv preprint arXiv:2602.06036},
5 year = {2026}
6}