Speculative Speculative Decoding

framework 2603.03251
speculative-decodinginference-optimizationlatencyparallel-decodingasynchronous-execution

Speculative Speculative Decoding #

Tanishq Kumar, Tri Dao, Avner May | 2026-03 | https://arxiv.org/abs/2603.03251 Category: framework | Tags: speculative-decoding, inference-optimization, latency, parallel-decoding, asynchronous-execution Read: 2026-04-16

Core Contribution #

提出 Speculative Speculative Decoding (SSD) 框架,通过在 verification 进行的同时预测可能的 verification outcome 并预先为其准备 speculation(speculation cache),将 drafting 与 verification 完全并行化,消除 speculative decoding 的顺序依赖瓶颈。优化实例 Saguaro 比最优 SD baseline 平均快 30%。

Summary #

Autoregressive decoding 受限于逐 token 的顺序生成。Speculative decoding (SD) 虽然通过 draft model 提前猜测 token 并由 target model 一次验证来加速推理,但 SD 本身仍依赖 "speculation → verification → speculation" 的顺序链条:verification 结束之前无法开始下一轮 drafting。

Speculative Speculative Decoding (SSD) 打破这一顺序依赖。核心思路是将 draft model 部署在独立硬件上(如单独一块 H100),在 target model 进行 verification 的同时,draft model 预测最可能的 verification outcome(包括接受了多少 token、bonus token 是什么),并为每个可能的 outcome 预先准备好对应的 speculation,存入 "speculation cache"。当 verification 完成后,若实际 outcome 在 cache 中(cache hit),则立即返回预存的 speculation,完全消除 drafting 延迟。

论文提出的优化算法 Saguaro 解决三个核心挑战:(1) 如何在预算 $B$ 内选择最优的 verification outcome 集合(geometric fan-out cache topology);(2) 如何平衡 acceptance rate 和 cache hit rate 的矛盾(Saguaro sampling with logit bonus $C$);(3) cache miss 时如何 fallback(batch-size-adaptive 策略:小 batch 用 just-in-time speculation,大 batch 用随机 token)。实验在 Llama-3.1-70B (4×H100 TP) + Llama-3.2-1B draft (1×H100) 上,覆盖 math/code/chat 四个数据集,Saguaro 平均比最强 SD baseline 快 30%,最高达 autoregressive 的 5× 加速。

Key Findings #

Key Figures #

Figure 1: SD vs SSD System Overview #

Figure 1: SD vs SSD System Overview

What it shows: 三幅子图对比了 SD 与 SSD 的时序关系和端到端性能。

Why it matters: 这是论文的"灵魂图",直观展示了 SSD 的核心价值——将 drafting 从 critical path 上移除。

Detailed description: 左图展示传统 SD 的时序:verifier 在 draft 计算期间空闲等待,形成串行流水。中图展示 SSD:speculation 在独立设备(1×H100)上与 verification 并行执行,draft model 预计算多个可能 outcome 的 speculation 并存入 cache,verification 完成后直接查 cache 返回。右图展示在 Llama-3.1-70B / 4×H100 / batch=1 / greedy decoding 条件下 SSD、SD 和 AR 的端到端 tokens/s 对比。

Figure 2: Speculation Cache Construction Strategy #

Figure 2: Speculation Cache Construction Strategy

What it shows: Saguaro 如何在 $K+1$ 个位置上分配 fan-out $F_k$(每个位置猜测多少个 bonus token candidate)。

Why it matters: 这是 Saguaro 的核心机制图,解释了 geometric fan-out 策略的工作原理。

Detailed description: 图示展示了一个 speculation 序列被 verify 后,不同 acceptance 长度 $k$ 对应不同的 bonus token 位置。在每个位置 $k$,Saguaro 分配 $F_k$ 个候选 bonus token(从 draft logits 的 top 排名中选取,排除已发送验证的 sampled token)。Fan-out 遵循 geometric 递减策略:$F_k = F_0 \cdot a_p^{k/(1+r)}$,即前面的位置分配更多候选(因为走到后面位置的概率指数衰减)。每个 $(k, t^*)$ 组合对应一条预计算的 speculation 分支,存入 cache。

Figure 3: Power-Law Cache Hit Rate #

Figure 3: Power-Law Cache Hit Rate

What it shows: Cache miss rate 与 fan-out F 之间的经验关系,在 log-log 坐标下呈线性(即 power law)。

Why it matters: 这个经验发现使得 cache topology 优化问题有 closed-form 最优解(Theorem 12)。

Detailed description: 图展示了在不同 speculation 场景下,cache rejection rate $(1 - p_{\text{hit}})$ 关于 fan-out $F$ 的曲线。当在对数坐标下绘制时,数据点近似落在直线上,验证了 Definition 11 中的 $r$ power-law 假设。不同的 speculator 质量(primary vs backup)对应不同的 power-law 指数 $r$。

Figure 7: End-to-End Performance Results #

Figure 7: End-to-End Performance Results

What it shows: Saguaro 在四个数据集上相对 SD baseline 和 AR 的端到端 wall-clock speedup。

Why it matters: 这是论文的主实验结果图,证明 Saguaro 在多种任务上一致性地优于 SD。

Detailed description: 图展示了 Saguaro 在 Alpaca、GSM8k、UltraFeedback、HumanEval 四个数据集上的 tokens/s 或 wall-clock time 对比。Saguaro 平均比最强 SD baseline 快 30%,比 AR decoding 快 up to 5×。结果在 Llama-3.1-70B (target, 4×H100 TP) + Llama-3.2-1B (draft, 1×H100) 配置下,batch size 1,greedy decoding。

Key Tables #

Algorithm 1: The SSD Framework #


Function main(prompt, target, primary_draft, backup_draft):
  asynchronously launch speculator(prompt, primary_draft, backup_draft)
  generated_tokens ← verifier(prompt, target)
  return generated_tokens

Function verifier(prompt, target):
  target.prefill(prompt)
  WAIT TO RECEIVE spec_tokens from speculator
  generated_tokens ← []
  while True:
    verify_outcome ← target.verify(spec_tokens)
    generated_tokens.append(verify_outcome.tokens)
    SEND verify_outcome to speculator
    if end_token ∈ verify_outcome: return generated_tokens
    WAIT TO RECEIVE spec_tokens from speculator

Function speculator(prompt, primary_draft, backup_draft):
  primary_draft.prefill(prompt)
  spec_tokens ← primary_draft.speculate(prompt)
  while True:
    SEND spec_tokens to verifier
    outcomes ← predict_verify_outcomes(spec_tokens, primary_draft)  // Sec 4.1
    cache ← speculate_for_outcomes(outcomes, primary_draft)          // Sec 4.2
    WAIT TO RECEIVE verify_outcome from verifier
    if end_token ∈ verify_outcome: return
    if verify_outcome ∈ cache:
      spec_tokens ← cache[verify_outcome]
    else:
      spec_tokens ← fallback_speculate(verify_outcome, ...)         // Sec 4.3

Takeaway: SSD 框架将 speculator 和 verifier 解耦为两个并行进程。Speculator 在 verification 期间构建 speculation cache,verification 完成后通过 cache lookup 消除 drafting 延迟。

Limitations #

Infrastructure Impact #


Deep Analysis (framework) #

1. System Scope #

2. Architecture & Data Flow #

2a. End-to-End Data Flow Diagram #


[User Prompt]
    │
    ├──→ [Target Model Prefill] (4×H100 GPU, TP)
    │         ↓ KV cache in HBM
    │
    ├──→ [Draft Model Prefill] (1×H100 GPU, separate)
    │         ↓ Draft KV cache
    │
    ├──→ [Initial Speculation] draft autoregressive K tokens
    │         ↓ spec_tokens (K token IDs)
    │         ↓ draft logits at each position
    │
    └──→ [Main Loop] ──────────────────────────────────────
              │
              │  ┌─ PARALLEL ──────────────────────────┐
              │  │                                       │
              │  │  [Verifier]         [Speculator]      │
              │  │  target.verify()    predict_outcomes() │
              │  │  → (k, bonus_t*)    build cache S^T    │
              │  │  → accepted tokens  speculate for each │
              │  │                     outcome in cache    │
              │  └─────────────────────────────────────────┘
              │
              ├──→ verify_outcome sent to speculator
              │
              ├──→ [Cache Lookup] verify_outcome ∈ cache?
              │       ├── HIT:  return cached speculation → next verify
              │       └── MISS: fallback_speculate → next verify
              │
              └──→ [End] when end_token generated
StageInput → OutputLocationLatencyData format
Target Prefilltokens → KV cache4×H100 (TP)~100ms (prompt dependent)[layers, heads, seq, dim]
Draft Prefilltokens → draft KV cache1×H100~10ms[layers, heads, seq, dim]
Draft Speculationprefix → $K$ tokens + logits1×H100$T_p \cdot T_{\text{verify}}$ ms$K$ token IDs + [$K$, vocab] logits
Target Verification$K$ tokens → $(k, t^*)$4×H100$T_{\text{verify}}$ msaccepted count $k$ + bonus token $t^*$
Cache Lookupoutcome → cached speculation1×H100 (CPU memory)~0ms$K$ token IDs
Fallback Speculateoutcome → new speculation1×H100 or CPU$T_b \cdot T_{\text{verify}}$ ms$K$ token IDs

2b. Data Movement Hotspots #

  1. spec_tokens: Draft GPU → Target GPU — K 个 token ID(极小数据量,~几十 bytes),每轮一次。通信可忽略。
  2. verify_outcome: Target GPU → Draft GPU — 一个 (k, t*) 对,每轮一次。同样极小。
  3. Draft model KV cache 管理 — draft model 需要为 $B$ 个不同的 verification outcome 维护独立的 KV cache 分支。这是 memory 的主要挑战,需要 $O(B \cdot K \cdot d_{\text{model}})$ 的额外 HBM。
  4. 3. Design Space & Constraint Analysis #

    3a. Alternative Approaches

    AlternativeFeasibilityReason
    只预测 "全部接受" outcome (AMUSD/PEARL)可行但有限全部接受概率 = $\alpha^K$,$K=5$ 时 $\alpha=0.8$ 则仅 33%,大量迭代浪费
    为所有 $O(KV)$ outcome 预计算不可行$V$=128K, $K$=5 → ~640K 条 speculation,远超 draft 计算能力
    Draft 与 target 共享 GPU可行但抵消收益SD 的瓶颈就是 draft 占用 target GPU 时间;共享则无法并行
    Tree-based SD 增大 verified tree可行但 target 开销增大Tree 增大导致 target forward pass 成本增加,而 SSD 不增加 target compute
    多 draft model 并行可行但成本高需要更多 GPU,且无理论指导如何分配

    3b. Constraint Derivation

    关键约束:draft model 在 verification 时间内最多完成 B 条 speculation。这意味着:

    • $B \approx T_{\text{verify}} / T_{\text{draft per speculation}}$
    • 对 Llama-3.2-1B draft + Llama-3.1-70B target (4×H100),$T_{\text{verify}} \gg T_{\text{draft}}$,所以 $B$ 可以取到 20-40
    • Cache budget $B$ 是整个方法的核心 trade-off 参数

    3c. Assumption Audit

    1. "Cache miss rate follows power law" — 经验假设,Figure 3 验证。但在极端分布(如非常 uniform 的 target distribution)下可能不成立。
    2. "Draft model is much faster than target model" — 需要 $T_p < 1$ (draft 在 verify 期间完成)。当 draft model 过大或 target model 过小时,这个假设不满足。
    3. "Batch size 1 为主要场景" — 大 batch size 下 cache hit rate 按 $p_{\text{hit}}^b$ 衰减,speedup 显著下降。这限制了 SSD 在 throughput-oriented 场景的适用性。
    4. "Draft logits 可预测 bonus token" — 依赖 draft 与 target distribution 的相似性。当两者差异大时,residual distribution 偏离 draft logits,预测准确率下降。
    5. 3d. Core Technical Barrier

      Geometric fan-out cache topology (Theorem 12)。将 cache budget $B$ 最优分配到 $K+1$ 个位置的问题,通过 power-law 假设得到 closed-form 解:$F_k = F_0 \cdot a_p^{k/(1+r)}$。这个看似简单的结果需要:(1) 发现 cache miss rate 遵循 power law 的经验规律;(2) 将其形式化为 Lagrange 乘子优化问题;(3) 证明该解在实际硬件约束下是可计算和可实现的。没有这个 topology 优化,naive uniform fan-out 的 cache hit rate 会显著更低。

      3e. Design Binding Critique

      • 强制绑定独立 GPU: SSD 要求 draft model 在物理独立的 GPU 上运行,不能与 target model 共享。这意味着必须多出一块 GPU 的硬件成本。
      • 强制绑定 draft model: 需要一个与 target model 分布相近的小模型。没有好的 draft model 则 cache hit rate 低。
      • 强制绑定 batch size 1: 最佳性能在 batch=1,大 batch 优势衰减。这与追求 throughput 的 serving 场景冲突。
      • 绑定放松: 论文提到可以与 EAGLE-3 等 draft architecture 组合,但未实验验证。

      Figure 1: SD vs SSD Architecture Comparison #

      Figure 1

      解读: 这张图直观对比了三种 decoding 策略的时序。左图 SD:draft 和 verify 严格串行,verifier 在 draft 期间空闲。中图 SSD:draft 在独立 GPU 上与 verify 并行执行,speculation cache 作为桥梁。右图量化结果表明 SSD (Saguaro) 在所有数据集上均优于 SD 和 AR。核心insight:SSD 不增加 target model 的计算量,仅利用额外 GPU 上的 idle compute 来预计算多个可能 outcome。

      4. Key Innovations #

      InnovationMechanismBenefitCost/Tradeoff
      Speculation Cache预计算 $B$ 个最可能的 verification outcome 对应的 speculation消除 drafting 延迟(cache hit 时)需要额外 GPU + $B$ 条并行 speculation 的 KV cache 内存
      Geometric Fan-Out$F_k = F_0 \cdot a_p^{k/(1+r)}$,前面位置分配更多 fan-out最大化 cache hit rate given budget $B$需要知道 acceptance rate $\alpha$ 和 power-law exponent $r$
      Saguaro Sampling给 cached token 的 logits 加 bonus $C$,提高命中率单调提升 cache hit rate降低 acceptance rate,trade-off 需调参
      Adaptive Fallback小 batch: just-in-time speculation; 大 batch: random token所有 batch size 下保持加速大 batch fallback 质量差(random token acceptance ~0)

      5. Scheduling & Resource Management #

      • Batch formation: Static batch (不是 continuous batching),所有 batch element 共享同一 speculation round
      • Memory management: Draft model 需维护 $B$ 条 speculation 分支的 KV cache;target model 按标准 SD 方式管理 KV cache
      • GPU utilization: SSD 的核心价值在于利用 target model verify 期间的 draft GPU idle time;但 target model 的 GPU 利用率与 SD 相同
      • 大 batch 退化: 当 batch size $b > b^*$ 时,整个 batch 必须等待最慢的 cache miss 的 fallback,$p_{\text{hit}}^b \to 0$,退化到 $1 + T_b$ 的延迟

      6. Target Scenarios & Workload Characterization #

      ScenarioWorkload PatternSLO / GoalWhy existing SD fails
      Interactive chat (batch=1)单用户低延迟TPOT < 20msSD 的 drafting 延迟直接加到 TPOT 上
      Code completion低 batch, greedy最低 latencyDraft 延迟占 SD 总延迟的 significant 比例
      Agent tool callingMulti-turn, latency-criticalE2E < 2s每轮 SD 的 draft overhead 累加

      Primary bottleneck: Memory bandwidth bound (typical decode phase), 但 SD 引入的 draft 计算是 compute-bound 的额外开销。SSD 消除的正是这个额外 compute 开销的延迟贡献。

      Figure 2: Cache Construction Mechanism #

      Figure 2

      解读: 这张图详细展示了 speculation cache 的构建过程。给定一条正在被 verify 的 speculation 序列 $(s_1, s_2, \ldots, s_K)$,每个位置 $k$ 可能成为 rejection point,产生需要预测的 bonus token。Saguaro 在每个位置 $k$ 分配 $F_k$ 个候选 bonus token(从 draft logits top 排名中选取),形成一个"漏斗形"的 cache 拓扑——前端宽后端窄,因为走到后面位置的概率指数衰减。每个 $(k, t^*)$ 组合对应一条预计算的新 speculation。

      7. Performance Evaluation #

      7a. Metrics Definition #

      MetricDefinitionUnitBetter
      Tokens/s输出 token 生成速率tokens/sHigher
      Speedup vs AR相对 autoregressive decoding 的加速比×Higher
      Speedup vs SD相对最优 speculative decoding baseline 的加速比×Higher
      Cache Hit Rate预计算 outcome 命中率%Higher
      Acceptance RateDraft token 被 target 接受的概率%Higher

      7b. Before-After Comparison #

      OptimizationMetricSD BaselineSaguaroImprovementConditions
      Full SSD PipelineSpeedup vs AR~3.5× (SD)~5×~30% over SDLlama-70B, 4×H100, batch=1, greedy
      Geometric Fan-OutCache Hit RateN/A (uniform)~90% (greedy)-$K$=5, $B$=20-40
      Saguaro SamplingCache Hit Rate$p_{\text{hit}}(C\!=\!1)$$p_{\text{hit}}(C\!>\!1)$monotonically increasingTheorem 15
      Adaptive FallbackSpeedup at batch > $b^*$degradedmaintained >20%robustCritical batch size $b^*$ derived

      7c. Bottleneck Shift Analysis #

      
      Before (AR): memory bandwidth bound → After SD: draft compute added to critical path
      → After SSD: draft compute hidden, but cache miss fallback becomes bottleneck at large batch
      → Remaining bottleneck: verification forward pass latency (irreducible) + cache miss at high temperature/batch
      

      7d. Baselines & Fairness #

      • Baselines: AR decoding, standard SD (draft collocated on target GPU), AMUSD, PEARL, SwiftSpec
      • Hardware fairness issue: SSD 使用 5 GPU (4 for target + 1 for draft) vs SD 使用 4 GPU (draft collocated)。SSD 多出 1 GPU 的硬件成本未在 throughput/\$ 中折算。
      • Greedy decoding 优势: 论文主要展示 greedy decoding 结果。温度采样下 cache hit rate 下降,speedup 减小。
      • Batch size 1 偏重: 最佳结果在 batch=1,大 batch 下优势递减(但论文声称仍在 batch=8 时有 20% speedup over SD)。

      8. API & Usability #

      • Code: 开源于 https://github.com/tanishqkumar/ssd
      • 实现基础: 基于 PyTorch,需要多 GPU setup(target TP + 独立 draft GPU)
      • 部署复杂度: 需要配置 inter-GPU 通信、draft model 选择、cache size $B$、fan-out 参数、Saguaro sampling $C$ 值
      • 与现有框架集成: 论文未讨论与 vLLM/SGLang 的集成,但框架层面需要支持 disaggregated draft model placement

      9. Infrastructure Impact #

      LayerImpact
      AlgorithmSaguaro sampling (logit bonus $C$) 为 SD sampling 策略开辟新维度;geometric fan-out 的优化框架可泛化到其他 cache-based 预计算系统
      Kernel不需要自定义 kernel,但多 outcome 并行 speculation 的 KV cache 管理可能受益于 paged attention 优化
      LLM与模型架构无关,但 acceptance rate $\alpha$ 直接受 draft-target 分布差异影响;更好的 draft architecture (EAGLE-3) 可进一步提升
      Agent对 latency-sensitive agent 场景(tool calling, streaming)直接受益;单 token latency 下降 30% 对交互体验影响显著
      Ops需要独立 GPU 资源管理和跨设备通信监控;cache hit rate 可作为运行时诊断指标

      10. Comparison Matrix #

      FeatureSaguaro (SSD)Standard SDAMUSD/PEARLTree-SDSwiftSpec
      Draft-Verify 并行Yes (core innovation)NoPartial (1 outcome only)NoYes
      Multi-outcome cacheYes ($B$ outcomes)N/ANo (1 outcome)N/AYes (tree)
      Extra GPU requiredYes (1 GPU)NoYesNoYes
      Target compute overheadNoneNoneNone$O(\text{tree size})$None
      Batch size scalabilityDegrades ($p_{\text{hit}}^b$)OKDegradesOKDegrades
      Lossless (same distribution)YesYesYesYesYes
      Temperature robustnessWeak (high temp → low cache hit)N/AWeakGoodWeak

      11. Adoption, Maturity & Ecosystem Influence #

      • Open source: Yes, MIT license (GitHub: tanishqkumar/ssd)
      • Venue: ICLR 2026 (top-tier)
      • Author credibility: Tri Dao (FlashAttention 作者) 是 co-author,增强了方法的可信度
      • Production readiness: Research prototype,距离 production 集成有距离(缺少 continuous batching、SLO-aware scheduling 等 serving features)
      • Ecosystem influence: 概念上与 vLLM 的 disaggregated prefill/decode 架构相契合——将 draft model 视为另一个可独立部署的组件。后续 work 可能将 SSD 集成到 SGLang/vLLM 的 speculative decoding module 中。
      • 与 CPU speculative execution 的类比: 论文将 SSD 与 CPU 的 branch prediction + speculative execution 类比,这个视角对理解和传播方法很有价值。如同 CPU 发展从简单 pipeline 到深度 speculative execution,LLM inference 也在走类似的演化路径。