[Feature] support DFlash: Block Diffusion for Flash Speculative Decoding

未关闭
#4,530 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 2 天内回复

@RunningLeon 已经在做这个了。

开始于 2026年4月18日。

评估

这个 Issue 还没有评估数据。

描述

planned feature
Motivation

https://github.com/z-lab/dflash

DFlash is a lightweight block diffusion model
You can give qwen3.5 27Bvllm sglang mlx already support model modification.

The following is from the publicity introduction:

🚀 Core Breakthrough
DFlash is a lightweight Block Diffusion Model purpose-built for speculative decoding. It predicts an entire token block in a single forward pass, delivering unprecedented inference acceleration.

Limitations of Traditional Methods

Conventional speculative decoding approaches (e.g., EAGLE-3) still generate drafts in an autoregressive manner, where each token must wait for the completion of the previous one. This caps the practical speedup at only 2–3×.

DFlash Innovations

DFlash adopts a fundamentally different strategy:

  • Parallel Draft Generation: Generates a full token block in one forward pass
  • KV Injection Mechanism: Injects hidden layer features from the target model as contextual conditions into every layer of the draft model
  • Feature Fusion: Fuses multi-layer hidden states via FC + RMSNorm to provide highly consistent contextual information

📊 Remarkable Acceleration Results

Qwen3-8B: 6× Lossless Acceleration

On the Qwen3-8B model, DFlash achieves:

  • 6× lossless speedup
  • 2.5× faster than EAGLE-3
  • Acceptance rate as high as 89%+

Qwen3.5-9B: 4.1× Acceleration

On Apple Silicon platforms, the Qwen3.5-9B model delivers:

  • 4.1× speedup
  • Validates 16 tokens generated in a single batch
  • Optimized with custom Metal kernels

🔥 Qwen3.5-27B: 5× Inference Speed Surge

Performance Comparison (Configuration)

Setup 1024 tokens 2048 tokens Speedup
Baseline 14 tok/s 11 tok/s 1×
8-bit Quantization 35 tok/s 26 tok/s 2.5×
4-bit Quantization 28 tok/s 20 tok/s 2.0×

Key Findings

1. 8-bit quantization outperforms 4-bit: Delivers superior speedup while maintaining higher precision
2. Strong long-sequence performance: Retains 2.3× speedup when generating 2048 tokens
3. Lossless decoding: Fully preserves model output quality with zero accuracy degradation

Related resources

https://github.com/z-lab/dflash

Additional context
Image Image
主要语言
Python
星标
8.2k
派生
797
平均合并
3 天 15 小时
30 天内合并 PR
52

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

InternLM/lmdeploy 的其他 Issue

查看 InternLM/lmdeploy 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。