arXiv:2612.05048 · Speculative Decoding

Spancast: Native Draft Architectures for Speculative Decoding in the Coding Era

Haoyang Su1,2 · Weiran Huang2,3
1Fudan University 2Shanghai Innovation Institute 3Shanghai Jiao Tong University
17 LLMs
Zero-shot · 15 families (3B–32B)
7.80
Mean accepted tokens / step
2.9×–5.0×
Wall-clock speedup on H100
~2.25 ms
127-node parallel tree draft
Figure 1. Mean accepted length (τ) versus wall-clock speedup across 17 target models in 15 families and 18 benchmarks (bfloat16, greedy decoding, batch size 1 on H100). (a) 18-benchmark mean per model against target-agnostic and target-coupled baselines on Qwen3-8B. (b) 17-model mean per benchmark across target-agnostic methods.

Abstract

Modern AI increasingly relies on language model agents that solve tasks by iteratively generating and editing code. Repeatedly producing long code blocks makes token-by-token decoding a major latency bottleneck. Speculative decoding accelerates generation while preserving model outputs by combining a fast draft model with parallel target verification. Unlike natural language, executable code consists largely of predictable syntax and repeated identifiers broken by occasional branching points. However, existing speculative decoding methods fail to exploit the distinct structure of code. Learned drafters rely on stateless Transformer blocks designed for single-step text prediction, while retrieval methods stop at exact substring copies. We introduce Spancast, a native non-Transformer draft architecture with Masked Parallel Tree Decoding. Spancast replaces Transformer layers with Grouped State Channel for stateful recurrence across tokens and Null-Key Attention to skip the prefix via a zero-value key. Masked Parallel Tree Decoding drafts spans in parallel and expands likely branches in constant steps. Spancast surpasses existing learned and retrieval baselines in average acceptance length, lowers inter-token latency across target models, and transfers zero-shot to unseen target models.

Architecture & Decoding Workflow

Three components derived natively for parallel span drafting over plain text with an independent vocabulary.

Figure 2. (a) An Lpref-layer prefix encoder feeds a shared R-layer parallel draft decoder through an all-layer shared KV memory bank and state bridge. (b) Grouped State Channel decouples unit-RMS spherical state carry from unconstrained gated outputs. (c) Null-Key Attention adds a learned zero-value key (∅) and continuous-phase RoPE.
01 · Sequence & State

Grouped State Channel (GSC)

Maintains G parallel unit-RMS recurrent states on the hypersphere while leaving gated bilinear feature readouts unconstrained, paired with orthogonal cross-group mixing for multi-token syntactic continuity.

02 · Retrieval & Abstention

Null-Key Attention

Augments causal prefix and draft attention with a learned zero-value null key (∅) and continuous-phase RoPE, letting novel tokens abstain cleanly from attending to the prefix while sharpening verbatim span copying.

03 · Constant-Depth Drafting

Masked Parallel Tree Decoding

Compiles multi-layer prefix states into one shared KV bank and drafts 127-node candidate trees across two branching levels in constant parallel depth (~2.25 ms CUDA-Graph latency at K = 32).

Zero-Shot Transfer Across 17 Target LLMs

18-benchmark means under greedy decoding (bfloat16, batch size 1, max length 8,192) on an NVIDIA H100 GPU.

Metric
Scale
Target Model Family Size AR ITL (ms/tok) Spancast Mean τ Spancast ITL (ms/tok) Speedup

Mechanistic & System Analysis

Direct probes of the draft backbone and end-to-end latency behavior across workloads and target scales.

Figure 3. Internal architectural mechanisms on Qwen3-8B. (a) Novel-token position-0 attention mass per head with layer medians. (b) Prefix-head null-key weights on novel tokens vs. long copies by match length. (c) Prefix survival over a 32-token horizon vs. a matched Transformer.

Eliminating Attention Sinks

Without a null key, standard softmax concentrates over 40% of decoder attention mass onto position 0 during novel generation. Null-Key Attention removes this sink almost completely.

Dynamic Abstention vs. Copying

Specialized prefix copy heads assign high null-key weight on novel tokens (match length 0) and drop it sharply on repeated code spans (match length ≥ 6) to retrieve verbatim tokens.

Survival Beyond Perplexity

GSC slows survival decay past step 4 relative to a matched Transformer. Lower single-step prefix NLL alone (e.g., Mamba-2 or RWKV-7) does not maximize parallel span acceptance.

Figure 4. (a) Accepted length (τ) versus context reuse fraction across Qwen3-8B samples alongside Coding and General QA densities. (b, top) Isolated drafting latency across draft horizon K = 4–32. (b, bottom) Normalized decoding step time across 17 target models from 3B to 32B parameters.

Context Reuse Spectrum

Spancast matches neural drafters on novel general QA, overtakes target-coupled DFlash under moderate reuse, and reaches ~16.5 median accepted tokens on edit-heavy code spans.

Constant-Depth Horizon Scaling

Expanding the draft horizon 8× (from K = 4 to K = 32) leaves full-tree CUDA-Graph drafting latency nearly flat near ~2 ms, whereas sequential drafters scale linearly.

Cross-Scale Amortization

As target models scale from 3B to 32B, constant drafting overhead amortizes cleanly, bringing 32B step-time ratios close to non-parametric SuffixTree.

Quickstart & Release Roadmap

Run Spancast on vLLM with the released checkpoint and draft tokenizer.

bash
git clone https://github.com/Hoyant-Su/Spancast.git
cd Spancast
pip install -r requirements.txt

huggingface-cli download Hoyant-Su/Spancast \
  step_72000.pt drafter_tokenizer.json \
  --local-dir checkpoints/spancast_98m

bash run_inference.sh \
  --model qwen3_8b \
  --benchmark canitedit \
  --checkpoint checkpoints/spancast_98m/step_72000.pt \
  --tokenizer checkpoints/spancast_98m/drafter_tokenizer.json
Live
Phase 1 — Inference & Evaluation Suite

Standalone vLLM inference engine, fused Triton & Hopper CUDA kernels, Rust PyO3 tree-verification host, 17 target model configs, 18 benchmark suites, and run_inference.sh.

Live
Phase 2 — Preprint & Pretrained Weights

arXiv preprint (2612.05048) and public Hugging Face release (Hoyant-Su/Spancast) of step_72000.pt and drafter_tokenizer.json.

Citation

If you find Spancast useful in your research, please cite:

bibtex
@misc{su2026nativedraftarchitecturesspeculative,
      title={Native Draft Architectures for Speculative Decoding in the Coding Era},
      author={Haoyang Su and Weiran Huang},
      year={2026},
      eprint={2612.05048},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2612.05048},
}