FlowBlock: Wavefront-Parallel Decoding for Self-Correcting Diffusion Language Models
Training-free parallel decoding framework for block-wise diffusion LLMs using gated wavefront execution and heterogeneous wavefront packing
FlowBlock: Wavefront-Parallel Decoding for Self-Correcting Diffusion Language Models
一、论文概述
| 项目 | 内容 |
|---|---|
| 标题 | FlowBlock: Wavefront-Parallel Decoding for Self-Correcting Diffusion Language Models |
| 作者 | Bing Tian, Haikun Liu, Xiaocheng Zhong, Zhuohui Duan, Zhaokai Luo, Huayi Jin, Zhiyong Wang, Xiaofei Liao |
| 机构 | (标记: † = 主要贡献者, § = 其他贡献者) |
| 论文 | arXiv:2607.17652 |
| 代码 | github.com/Red-EAD/FlowBlock |
| 发布 | 20 Jul 2026 (v1), 575 KB |
| 许可 | arXiv.org perpetual non-exclusive license |
| ** Subjects** | Artificial Intelligence (cs.AI) |
二、核心思想
问题定义
块扩散语言模型(Block-wise dLLMs)按块级别顺序解码,虽然实现了跨块的 KV cache 复用,但导致块间解码严格串行化。下游块 必须等待上游块 完全 finalize 后才能开始。前期工作试图通过后训练方法解锁块间并行性,但加速有限且经常降低准确率。
关键瓶颈在于: 的后期去噪步骤通常只修正少量不确定位置,而此时所有下游块都处于空闲状态——这是未被利用的并行窗口。
解决方案概述
FlowBlock 是一个免训练的并行解码框架,基于一个关键洞察:自校正 dLLMs 中的 Token-to-Token (T2T) 编辑机制使得早期草稿是可变的而非不可撤销的。下游块在稍早的上游草稿上生成的 token 可以在后续去噪步骤中被 T2T 编辑修正。因此,块的”最终性”可以从硬性依赖转变为调度资源。
FlowBlock 包含两个核心机制:
-
门控波前解码(Gated Wavefront Decoding, GWD):仅当前沿块的就绪度超过阈值 时才将新块纳入有界波前窗口,通过联合 T2T 编辑同时细化多个活动块,并使用窗口块因果掩码(W-shaped block-causal mask)按序提交块,保留精确的冻结前缀 KV cache 复用。
-
异构波前打包(Heterogeneous Wavefront Packing, HWP):为每个请求分配独立波前状态,将异步窗口打包成密集的形状稳定 batched 前向传播,使用绝对位置 RoPE 和行级块对角掩码。
在 LLaDA-2.1 和 LLaDA-2.0 上的评估显示:FlowBlock 将 TPS 最高提升 2.95×–4.01×,延迟降低最高 53.6%–77.1%,平均准确率提升 1.3 分。相比后训练的 D2F 基线,FlowBlock 准确率更高且 batched serving 吞吐量最高高 16×。
三、技术架构
整体框架图


数据流架构图解
┌─────────────────────────────────────────────────────────────────┐
│ FlowBlock Execution Framework │
│ │
│ Gated Wavefront Decoding (GWD): │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Committed Prefix (Frozen KV) │ │
│ │ [B0] [B1] [B2] ... [B(L-1)] │ │
│ │ ↕ Active Window [L, R) — up to W blocks │ │
│ │ ┌─────┬─────┐ │ │
│ │ │ BL │ BL+1 │ ... │ B(R-1) │ ← Mutable (T2T editable) │ │
│ │ └─────┴─────┘ │ │
│ │ ↕ │ │
│ │ Gate: ρ(BR-1) ≥ θspawn → admit BR │ │
│ │ W-shaped Mask: query in g attends to prefix + blocks L..g │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ Heterogeneous Wavefront Packing (HWP): │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Per-sequence independent wavefronts: │ │
│ │ Seq 0: [L0=0, R0=2) offset o0=0 │ │
│ │ Seq 1: [L1=2, R1=4) offset o1=64 │ │
│ │ Seq 2: [L2=1, R2=3) offset o2=32 │ │
│ │ │ │
│ │ Per-row gather → dense [B, q] tensor (q = W·bl) │ │
│ │ Per-row block-diagonal attention mask │ │
│ │ KV scatter-back: present[b, t+δ] → data[b, ob+δ] │ │
│ └──────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
核心公式
M2T/T2T 联合更新规则
Token update sets (Eq. 1):
其中 是 mask-to-token (M2T) 草稿集合——尚未揭示的可信 masked 位置; 是 token-to-token (T2T) 编辑集合——已揭示但被更置信预测替换的非 prompt 位置。下一状态设为 对所有 ,其余位置保持不变。
前沿块就绪度度量
Readiness fraction (Eq. 2 in paper):
其中 是块 中仍被 masked 的位置集合。 当 (块已完成)。
Gated admission condition (Eq. 3 in paper):
W-shaped 块因果注意力掩码
KV-cache correctness: 窗口内块 的查询可 attends 到 committed prefix 和块 ,但从不访问未来块。在同一块内保持双向注意力。
异构波前打包
Per-row gather (Eq. 4 in paper):
其中 是窗口固定容量, 是每行的绝对偏移。
Per-row block-diagonal mask (Eq. 5 in paper):
其中 是共享物理尾部起始位置, 是查询 的窗口 slot。
KV write-back scatter (Eq. 6 in paper):
Algorithm 1: Gated Wavefront Decoding
Algorithm 1 Gated Wavefront Decoding (one sequence)
0: prompt c, blocks B_0, ..., B_{n-1}, width W, gate θ_spawn
1: prefill c; L ← 0; R ← 1 {B_0 admitted unconditionally}
2: while L < n and no EOS committed do
3: Z ← f_θ(x[o_L, o_R−1+bl); pos; mask; KV) {one W-shaped forward}
4: for g = L to R−1 do
5: apply M2T ∪ T2T update (Eq. 1) to B_g from Z_g
6: end for
7: while L < R and B_L locally finished do
8: freeze KV of B_L into prefix; L ← L + 1 {retire in order}
9: end while
10: while R − L < W and R < n and ρ(B_{R−1}) ≥ θ_spawn do
11: R ← R + 1 {gated admission, Eq. 4}
12: end while
13: end while
模型组件
| 组件 | 说明 | 关键参数 |
|---|---|---|
| Wavefront Window | 滑动窗口 持有最多 个相邻块并发去噪 | (默认) |
| Readiness Gate | 控制新块何时加入波前 | |
| W-shaped Mask | 保证 frozen-prefix KV 复用的精确性 | 块因果 + 窗口内双向 |
| Per-row Gather | 将异步窗口打包为 张量 | |
| Block-Diagonal Attention | 行级独立掩码,跨序列隔离 | Eq. (6) |
| KV Scatter-back | 前向后将窗口 KV 写回绝对位置 | Eq. (7) |
训练流程
FlowBlock 不需要任何训练或后训练。它直接在未修改的自校正 dLLM checkpoint(LLaDA-2.1-mini)上运行,仅修改推理调度策略:
- Inference-time only: 利用模型固有的 T2T 自校正能力
- No kernel modifications: 不修改任何 CUDA/kernel 实现
- Speed-accuracy knob: 提供直接的速度-准确率权衡
四、核心创新
| 创新点 | 说明 | 理论/实验依据 |
|---|---|---|
| 发现 T2T 放松块间依赖 | 首次观察到自校正 dLLMs 的 T2T 编辑使早期草稿可变,将块最终性从硬依赖转为调度资源 | Section 3.2: 下游块只需信息充分的草稿而非已确定的前驱 |
| 门控波前解码 (GWD) | 结合就绪度门控 admission、联合 T2T 细化、W-shaped 块因果掩码,在保留精确 frozen-prefix KV 复用的前提下重叠块 | Figure 1 + Algorithm 1: 窗口内 KV 可变,窗口外冻结 |
| 异构波前打包 (HWP) | 为每个请求维护独立波前状态,通过 per-row gather、绝对位置 KV 索引、块对角 packed attention 将异步窗口打包为密集 batched forward | Figure 2 + Section 5.4: HWP 在 B=16 时比同步变体高 2.15× TPS |
| 免训练替代后训练 | 相比 D2F 需要 distill 专用 checkpoint,FlowBlock 在推理时利用已有自校正能力,准确率更高且扩展性更好 | Section 5.2: FlowBlock 比 D2F 高 16.5 分准确率 + 2.37× TPS |
五、代码实现分析
实现框架
FlowBlock 实现于 dInfer——一个基于 SGLang 的 dLLM 推理框架。关键配置:
- 模型: LLaDA-2.1-mini (open-weight MoE block-diffusion LLM with T2T self-correction)
- 默认参数: , , 保留模型默认的 阈值
- 硬件: 8× GPU (80 GB) 节点,数据并行
- 最大生成长度: 2048 tokens,块长度 32
关键设计决策
- KV cache 预分配: 按最大序列长度预分配,每行在绝对位置存储 KV
- 无数据移动的检索: 每行读取相同的物理前缀 slice,attention mask 决定可见位置
- 免费 retire: 一旦块 commit,其 KV 已在正确位置,后续写入仅推进到新窗口偏移
- Per-row EOS: 每行独立的 EOS 检测立即停用对应序列
六、实验结果
实验设置
- 模型: LLaDA-2.1-mini (MoE block-diffusion), LLaDA-2.0-mini
- 基线: LLaDA-2.0 (no self-correction), LLaDA-2.1 (native serial), D2F (training-based inter-block parallel)
- Benchmark: 4 math (GSM8K, MATH500, Minerva-Algebra, ASDiv) + 4 code (HumanEval, MBPP, HumanEval+, MBPP+)
- 指标: Accuracy/pass@1 (%), TPF (tokens per forward), TPS (tokens per second), Latency (s)
主结果 (Batch Size = 1)
表1: 各方法在 8 个 benchmark 上的对比 (block length = 32)
| Model | GSM8K Acc/TPS | MATH500 Acc/TPS | Minerva-A Acc/TPS | ASDiv Acc/TPS | HumanEval Acc/TPS | HumanEval+ Acc/TPS | MBPP Acc/TPS | MBPP+ Acc/TPS | Avg TPS |
|---|---|---|---|---|---|---|---|---|---|
| LLaDA-2.0 | 92.49 / 82.6 | 73.40 / 104.6 | 91.24 / 120.9 | 92.36 / 81.9 | 84.76 / 159.6 | 79.27 / 162.5 | 79.16 / 105.1 | 84.39 / 108.7 | 115.7 |
| LLaDA-2.1 | 92.49 / 176.6 | 77.00 / 211.7 | 93.60 / 247.6 | 92.89 / 174.5 | 82.93 / 180.1 | 77.44 / 182.8 | 82.20 / 124.2 | 87.04 / 125.8 | 177.9 |
| D2F | 85.82 / 98.9 | 61.20 / 105.0 | 81.30 / 127.9 | 75.31 / 100.3 | 66.46 / 112.7 | 60.37 / 105.2 | 68.62 / 122.5 | 65.08 / 118.4 | 111.4 |
| FlowBlock | 92.65 / 254.2 | 76.20 / 332.1 | 93.51 / 378.9 | 92.80 / 239.7 | 86.59 / 279.4 | 82.32 / 282.4 | 83.61 / 162.1 | 88.36 / 161.3 | 261.2 |
关键数字:
- FlowBlock vs LLaDA-2.0: 2.35× 平均 TPS 提升 (最高 3.17×)
- FlowBlock vs LLaDA-2.1: 1.45× 平均 TPS 提升 (最高 1.57×)
- FlowBlock vs D2F: 2.37× 平均 TPS 提升,准确率 +16.5 分
- FlowBlock 平均准确率 87.00,比 LLaDA-2.1 高 +1.3 分
- FlowBlock TPF 达到 7.23,比 LLaDA-2.1 (4.62) 高 1.6×
Batched Serving 结果
在 Minerva-Algebra 上 B=16 时达到 1293 TPS (2.05× LLaDA-2.1 best),在 HumanEval 上 B=32 时达到 1471 TPS (2.95× improvement)。与 LLaDA-2.0 相比,峰值差距在 Minerva-Algebra B=8 时达到 4.01×,延迟降低最高 77.1%。
D2F 无法有效扩展: 在 HumanEval 上从 B=1 的 113 TPS 降至 B=32 的 89 TPS,而 FlowBlock 在同一 batch 下达到 16.6× 吞吐优势。
HWP 消融实验 (Section 5.4)
HWP vs 同步波前在 GSM8K 上的 TPS 优势:
| Batch Size | HWP 优势 |
|---|---|
| B=2 | 1.46× |
| B=4 | 1.82× |
| B=8 | 2.12× |
| B=16 | 2.15× |
| B=32 | 1.87× (延迟降低 38%) |
超参数敏感性 (Section 5.5)
敏感性: 近无门控 admission 在 时比 LLaDA-2.1 低 2.0 分,在 时低 4.0 分。中等门控恢复至串行参考水平。
敏感性: throughput 随 单调递减(因为每个 forward 处理 查询位置)。
最优配置: → GSM8K 上 92.62% accuracy + 918 TPS (LLaDA-2.1 serving scale 的 1.54×)。
Block Length 鲁棒性 (Table 2)
在 GSM8K 上 从 64 增长到 128 时:
| Method | =64 Acc | =96 Acc | =128 Acc |
|---|---|---|---|
| LLaDA-2.1 | 92.57% | 89.99% | 77.41% |
| D2F | 53.98% | 31.54% | 22.82% |
| FlowBlock | 92.19% | 91.05% | 80.06% |
FlowBlock 在 时仍比 LLaDA-2.1 高 +2.65 分,TPF 保持 5.70 (1.72× lead)。
Generation Length 鲁棒性 (Table 3)
FlowBlock 在 GSM8K 上保持恒定 TPF = 6.73,不受生成长度影响:
| Length | TPS (FlowBlock) | Lat (s) | Acc (%) |
|---|---|---|---|
| 512 | 253.3 | 1.17 | 90.75 |
| 1024 | 253.8 | 1.25 | 92.27 |
| 2048 | 249.6 | 1.36 | 92.65 |
七、相关工作
Diffusion Language Models
- Austin et al. 2021a (Structured denoising), Li et al. 2022 (Diffusion-lm), Sahoo et al. 2024 (MDA)
- Recent models: LLaDA (Nie et al. 2025), Dream (Ye et al. 2025), Mercury (Labs et al. 2025), Seed Diffusion (Song et al. 2025)
- 问题: vanilla dLLMs 做 bidirectional full-sequence denoising,所有位置每步刷新 KV cache,无法复用
Block-wise Diffusion LLMs
- Han et al. 2023 (SSD-LM), Arriola et al. 2025 (Block diffusion)
- LLaDA-2.0 (Bie et al. 2025): 扩展 block-wise 方案
- LLaDA-2.1 (Bie et al. 2026): 引入 T2T editing
- D2F (Wang et al. 2025): 通过后训练暴露块间并行性 —— FlowBlock 的对比基线,证明 training-free 方法可以超越 post-training
KV Cache for dLLMs
- Wu et al. 2025 (Fast-DLLM): 启用 KV cache + parallel decoding
- Ma et al. 2025a (DKV-cache): diffusion LLM 的 KV cache
八、总结
核心贡献
- 结构机会发现: 在自校正 dLLMs 中识别出 T2T 编辑放松块间依赖的机会,实现推理时的免训练调度
- 门控波前解码 (GWD): 结合就绪度门控 admission、联合 T2T 细化、W-shaped 块因果掩码,在保留精确 frozen-prefix KV 复用的前提下安全重叠块
- 异构波前打包 (HWP): 将异步 per-sequence 波前通过 per-row gather、绝对位置 KV 索引、块对角 attention 转化为密集 shape-stable batched forward
- dInfer 实现验证: 在 8 个 math/code benchmark 上一致提升吞吐和延迟,匹配或超越基线准确率,batched serving 可扩展
技术影响
FlowBlock 将 block-wise 解码从串行流水线转变为自定时数据流执行:块作为 pipeline stage,active window 形成从左到右推进的 wavefront,admission 和 retirement 由解码状态触发而非固定调度。这为自校正扩散语言模型提供了一个通用的执行框架。
局限性
- 仅限自校正 dLLMs: 当前设计依赖 T2T editing 能力,不适用于无自校正能力的 vanilla dLLMs(如 LLaDA-2.0 需配合 GWD 效果有限)
- Wavefront width 限制: 较大 增加 compute cost 且 throughput 单调递减,实际推荐
- Gate 调参: 需按任务和 benchmark 选择(GSM8K 上 0.6 最优),缺乏自动选择机制
- 仅 MoE 模型验证: 目前仅在 LLaDA-2.1-mini (MoE) 上评估,非 MoE dLLM 的扩展性待验证
九、参考资源
- 论文: https://arxiv.org/abs/2607.17652
- 代码: https://github.com/Red-EAD/FlowBlock
- DOI: https://doi.org/10.48550/arXiv.2607.17652
- dInfer: https://github.com/Red-EAD/dInfer (SGLang-backed inference framework for dLLMs)
- LLaDA-2.1: https://arxiv.org/abs/2602.08676 (Token-to-token editing for diffusion LLMs)
- LLaDA-2.0: https://arxiv.org/abs/2512.15745 (Scaling block diffusion to 100B)
- D2F: https://arxiv.org/abs/2508.09192 (Discrete diffusion forcing for inter-block parallelism)