HuggingFace镜像/Qwen3.5-27B-DFlash
模型介绍文件和版本分析
下载使用量0

Qwen3.5-27B-DFlash

论文 | GitHub | 博客

DFlash 是一种新颖的推测解码方法,它利用轻量级 块扩散 模型进行草稿生成。该方法支持高效、高质量的并行草稿生成,突破了推理速度的极限。

本模型是 草稿生成器 组件。它必须与目标模型 Qwen/Qwen3.5-27B 配合使用。其训练上下文长度为 4096 个 token。

DFlash Architecture

快速开始

安装

vLLM:

uv pip install vllm
uv pip install -U vllm --torch-backend=auto --extra-index-url https://wheels.vllm.ai/nightly

SGLang:

uv pip install "git+https://github.com/sgl-project/sglang.git@refs/pull/20547/head#subdirectory=python"

启动服务器

vLLM:

vllm serve Qwen/Qwen3.5-27B \
  --speculative-config '{"method": "dflash", "model": "z-lab/Qwen3.5-27B-DFlash", "num_speculative_tokens": 15}' \
  --attention-backend flash_attn \
  --max-num-batched-tokens 32768

SGLang:

# Optional: enable schedule overlapping (experimental, may not be stable)
# export SGLANG_ENABLE_SPEC_V2=1
# export SGLANG_ENABLE_DFLASH_SPEC_V2=1
# export SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1

python -m sglang.launch_server \
    --model-path Qwen/Qwen3.5-27B \
    --speculative-algorithm DFLASH \
    --speculative-draft-model-path z-lab/Qwen3.5-27B-DFlash \
    --speculative-num-draft-tokens 16 \
    --tp-size 1 \
    --attention-backend fa3 \
    --mem-fraction-static 0.75 \
    --mamba-scheduler-strategy extra_buffer \
    --trust-remote-code

提示: 对于长上下文或智能体类工作负载,可添加 --speculative-dflash-draft-window-size WINDOW_SIZE 以启用草稿模型的滑动窗口注意力机制。

使用方法

from openai import OpenAI

client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")

response = client.chat.completions.create(
    model="Qwen/Qwen3.5-27B",
    messages=[{"role": "user", "content": "Write a quicksort in Python."}],
    max_tokens=4096,
    temperature=0.0
)
print(response.choices[0].message.content)

基准测试结果

测试环境:单张 NVIDIA B200 显卡,SGLang 框架,启用思考模式,最大输出长度 4096。我们报告的是端到端吞吐量,包含预填充时间。如需复现脚本,请参见我们的 GitHub 仓库。

吞吐量与加速比

每秒令牌数(相对自回归基线的加速比)

块大小 = 16

任务并发数ARMTPDFlash
Math500184243 (2.9x)397 (4.7x)
86251457 (2.3x)2270 (3.6x)
1611212224 (2.0x)3135 (2.8x)
3219492504 (1.3x)3712 (1.9x)
GSM8K183215 (2.6x)330 (4.0x)
86251303 (2.1x)1868 (3.0x)
1611091773 (1.6x)2589 (2.3x)
3219142170 (1.1x)3152 (1.6x)
HumanEval183236 (2.9x)427 (5.2x)
86021345 (2.2x)2079 (3.5x)
1610311921 (1.9x)2748 (2.7x)
3217202234 (1.3x)3198 (1.9x)
MBPP184200 (2.4x)347 (4.2x)
86271049 (1.7x)1826 (2.9x)
1610751729 (1.6x)2479 (2.3x)
3218321933 (1.1x)2808 (1.5x)
MT-Bench184169 (2.0x)255 (3.0x)
86221035 (1.7x)1444 (2.3x)
1611131550 (1.4x)1984 (1.8x)
3219001772 (0.9x)2391 (1.3x)

块大小 = 8

任务并发数ARMTPDFlash
Math500184273 (3.2x)335 (4.0x)
86251673 (2.7x)2020 (3.2x)
1611212731 (2.4x)3646 (3.3x)
3219493739 (1.9x)4288 (2.2x)
GSM8K183243 (2.9x)301 (3.6x)
86251539 (2.5x)1814 (2.9x)
1611092472 (2.2x)2896 (2.6x)
3219143431 (1.8x)3822 (2.0x)
HumanEval183258 (3.1x)350 (4.2x)
86021486 (2.5x)1856 (3.1x)
1610312302 (2.2x)2749 (2.7x)
3217202477 (1.4x)3412 (2.0x)
MBPP184234 (2.8x)311 (3.7x)
86271375 (2.2x)1757 (2.8x)
1610752159 (2.0x)2661 (2.5x)
3218322885 (1.6x)3309 (1.8x)
MT-Bench184210 (2.5x)250 (3.0x)
86221300 (2.1x)1495 (2.4x)
1611132105 (1.9x)2403 (2.2x)
3219002873 (1.5x)3256 (1.7x)

验收长度

格式:MTP / DFlash(跨并发级别取平均值)

任务B8B16
Math5005.73 / 5.907.14 / 7.93
GSM8K5.54 / 5.576.84 / 7.22
HumanEval5.81 / 6.347.38 / 9.18
MBPP5.10 / 5.605.94 / 7.27
MT-Bench4.60 / 4.545.30 / 5.47

致谢

特别感谢 David Wang 为本项目提供的卓越工程支持。我们也感谢 Modal、InnoMatrix 和 Yotta Labs 提供用于训练此 draft 模型的计算资源。

引用

如果您发现 DFlash 有用,请引用我们的工作。如需分享关于 DFlash 的反馈或请求新的模型支持,请填写此表单:DFlash Feedback。

@article{chen2026dflash,
  title   = {{DFlash: Block Diffusion for Flash Speculative Decoding}},
  author  = {Chen, Jian and Liang, Yesheng and Liu, Zhijian},
  journal = {arXiv preprint arXiv:2602.06036},
  year    = {2026}
}