Files
myWiki/concepts/parallel-drafting.md

35 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Parallel Drafting"
created: 2026-06-28
updated: 2026-06-28
type: concept
tags: [speculative-decoding, llm-inference, parallel-generation]
sources: [DSpark]
---
# Parallel Drafting
并行草稿Parallel Drafting是[[speculative-decoding|投机解码Speculative Decoding]]中草稿模型的一种架构范式:所有 $\gamma$ 个草稿位置在单次前向传播中同时生成,使草稿延迟 $T_{draft}$ 几乎独立于块大小。这与[[autoregressive-drafting|自回归草稿Autoregressive Drafting]]形成鲜明对比——后者的 $T_{draft} \propto \gamma$。
## 核心优势
$O(1)$ 的草稿延迟允许并行草稿器使用**更深的网络架构**和**更大的候选块**(如 $\gamma=16$),而不按比例增加延迟。在第一个草稿位置上,更深网络带来的容量优势产生了显著的准确率差距——而第一个 token 的接受率对整个块的期望接受长度影响最大(前缀接受机制)。
## 核心缺陷
**缺乏 token 间依赖建模**:每个位置独立预测,无法条件化于同块内先前采样的 token。当上下文允许多种合理延续时如 "of course" 和 "no problem"),可能产生"of problem"或"no course"等不一致组合,即[[cross-mode-collision|跨模态碰撞Cross-Mode Collision]]。
这导致了**后缀接受率衰减suffix decay**:接受率从位置 1 的高起点快速下降到后面位置的低谷(如 Chat 场景从 ~0.72 降到 ~0.52),而自回归草稿器反而在后续位置维持或上升。
## 代表方法
| 方法 | 关键机制 |
|------|---------|
| [[DFlash]] | [[kv-injection|KV 注入KV Injection]],并行生成全部 mask token |
| Medusa | 多个独立草稿头,无需额外草稿模型 |
| [[DSpark]] | 半自回归:并行骨干 + 轻量级顺序头 |
## 参考
- [[DSpark]] — 通过半自回归解决后缀衰减
- [[cross-mode-collision|跨模态碰撞Cross-Mode Collision]]