Tree Speculative Decoding with In-Call KV Repair on a Commercial Static-Graph NPU

Sungwon Woo, Seyeon KimarXiv 2026

TL;DR

Running tree-based speculative decoding on commercial AI accelerators (NPUs) is notoriously tricky because their ahead-of-time compiled graphs lock you into rigid input shapes and hide physical memory management. By noticing that doubling a batch from 16 to 32 tokens is nearly "free" in hardware latency, the authors pack speculative draft branches and memory clean-up operations into a single 32-token pass. The result is a 12–13% speedup and 10–11% energy savings over an already supercharged baseline—without needing custom memory-shuffling kernels.

What Problem Does This Paper Address?

Large Language Models (LLMs) usually generate text one word at a time, spending most of their time waiting on memory bandwidth to load billions of weights. Speculative decoding breaks this bottleneck: a tiny, fast "drafter" model guesses several future tokens, and the massive "target" model verifies them all in one parallel swoop. Tree speculative decoding goes further by drafting a branching tree of possibilities so the target model can verify multiple backup guesses simultaneously.

On flexible GPUs, this is standard practice. On commercial static-graph Neural Processing Units (NPUs)—specifically the Rebellions ATOM+—two strict rules get in the way:

  1. Fixed Shapes: Models are compiled ahead of time for a fixed query length (say, 16 or 32 tokens). You cannot dynamically resize inputs on the fly.
  2. Hands-Off Memory: The NPU runtime controls the physical Key-Value (KV) cache (the model's running memory of past tokens) and writes every evaluated token into consecutive memory slots. When a speculative tree branch is rejected, dead tokens pollute the cache, and accepted tokens deeper in the tree land out of order. Normally, fixing this requires an expensive, separate memory-compaction step.

Methods

Before building their tree verifier, the authors first cleaned up the standard 16-token linear baseline (using the block-diffusion drafter DFlash). Instead of re-evaluating older tokens to align with 64-token memory chunks, they started verification directly at the exact cursor position—a tweak they call the Direct-Start Linear Baseline.

Next, they built their 32-row tree verifier (T32-H32) around a clever in-call KV repair contract:

Figure 1: One T32-H32 decoding step. The tree selector places the anchor and the full argmax path before high-probability branches, and one 32-row target call scores R = L −W repair rows ahead of 32 −R tree rows. The grouped 32-row projection head then extends L and advances W only over canonical slots (hatched cells: accepted path). Repair and tree verification share one fixed-shape call, so no separate cache-movement call is needed.
  • Watermark Tracking & In-Call Repair: A watermark $W$ tracks where clean, sequentially ordered KV memory ends. If an accepted tree branch jumps over rejected sibling tokens, $R$ accepted tokens end up stranded out of canonical order. Instead of launching a separate memory-copy operation, the next 32-row verification call starts back at $W$, placing those $R$ tokens at the very front to re-score and overwrite the messy slots cleanly (averaging just 0.93 repair rows per step!).
  • Tree Rows & Masks: The remaining $32 - R$ slots hold the drafted token tree. Because the NPU's default positional tracking forces strictly linear attention, the authors bypass it—feeding precomputed per-token rotary position tables and an explicit ancestor attention mask so each tree node only sees valid history and its own branch.
  • Grouped 32-Row Projection Head: Evaluating 32 hidden states through a 16-row vocabulary head twice created a host-side bottleneck, so they compiled a unified 32-row projection head to compute all target probabilities in one shot.
Figure 2: Repair example with R = 2: gray slots hold valid KV, yellow rows re-score committed tokens, and blue rows are tree candidates (hatched if accepted). As b1 sits at slot L + 16, W stops at L + 2 and the next call rewrites that slot.

Datasets

All experiments—exploratory sweeps and pre-registered confirmation runs—evaluated greedy mathematical reasoning on GSM8K prompts using Qwen3-4B and Qwen3-8B target models. No new datasets were introduced.

Key Insights and Ideas

  • The "Free" Compute Lunch at 32 Rows: Why 32 rows? Profiling the NPU revealed that memory transfers (DMA) dominate latency at small batch sizes. Going from 16 to 32 query rows increases target call latency by just 3.5% (1.3 ms), whereas jumping to 128 rows hits compute limits and adds 30 ms. Those 16 "nearly free" extra rows are what pay for tree branching and KV repair.
Figure 3: 4B target latency per call by query rows (prefix 256; API median of 30 calls; DMA and compute busy time from profiled traces). DMA time stays flat, so 32 rows cost only 3.5% more than 16; beyond that, compute dominates.
  • Bad Baselines Fake Big Wins: Simply turning off unnecessary 16-token chunk-boundary replay boosted the linear baseline's throughput by 55.6% (from 59.3 to 92.3 tokens/s) using the exact same compiled binary. Measuring tree speculation against a naive replaying baseline would have massively overstated the tree's true benefit.
  • Compiled Shapes Quietly Alter Math: Changing a compiled graph's query size—even from 16 to 32 rows on identical linear tokens—changes parallel floating-point reduction orders inside the attention layer. Under greedy decoding, tiny $10^{-4}$ shifts can flip near-tie token choices, altering output trajectories without any bug in the algorithm!

Key Results

In a pre-specified, locked confirmation study on 120 untouched GSM8K test questions:

  • Throughput: T32-H32 beat the fastest direct-start linear baseline by 12.2% on Qwen3-4B (reaching 106.24 tok/s) and 13.2% on Qwen3-8B (89.56 tok/s).
  • Energy Efficiency: Gross NPU board energy per generated token dropped by 10.0% on 4B (0.590 J to 0.531 J) and 11.1% on 8B (1.694 J to 1.507 J).
  • Numerical Drift vs. Accuracy: Because compiled shapes shift floating-point math, outputs differed on 55/120 prompts for 4B and 9/120 for 8B. However, GSM8K accuracy remained statistically unchanged (104 vs. 103 on 4B; 104 vs. 105 on 8B), and diagnostic tracing proved the single lost 4B answer came purely from compiling for 32 rows rather than tree mechanics.
Figure 4: Change vs. D16-H16 (aggregate throughput with 95% bootstrap CI; energy: gross board J/token). The tree gains 12–13% throughput and saves 10–11% energy on both models; the 32-row head alone does neither.

Limitations and Future Work

The authors are admirably transparent about the scope of their findings:

  • Hardware & Workload Scope: Results are tied to one NPU architecture (Rebellions ATOM+ on SDK 0.10.2), two Qwen3 models, and greedy decoding on 120 math prompts (which lacks statistical power to rule out tiny accuracy shifts). Compiling the 16- and 32-row graphs also required bypassing a wrapper shape check.
  • Bundled Components & Partial Probes: The confirmation runs test rotary tables, ancestor masking, in-call repair, and the 32-row head as a single package rather than ablating each piece individually. Power figures also measure gross NPU board draw without subtracting idle power or including host CPU/DRAM energy.
  • Unexplored Comparisons: Future engineering comparisons remain open, such as testing the NPU runtime's explicit KV-copy primitive against in-call watermark repair, or benchmarking newer vendor SDK plugins that natively integrate linear DFlash.

Summary updated

BibTeX
@misc{woo2026tree,
  author = {Sungwon Woo and Seyeon Kim},
  title = {{Tree Speculative Decoding with In-Call KV Repair on a Commercial Static-Graph NPU}},
  year = {2026},
  eprint = {2611.35587},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.35587},
}
Figure