Lossless but Not Free: An Empirical Anatomy of Speculative Decoding on Consumer Hardware
Abstract
Single-stream autoregressive decoding of large language models is bound by memory bandwidth: each generated token requires one full forward pass through the target model, and successive passes cannot be parallelized. Speculative decoding restructures this computation: a small draft model proposes tokens autoregressively, the target model scores all of them in one batched pass, and a rejection-sampling rule provably preserves the target model's output distribution. We present a from-scratch, device-agnostic (CUDA/MPS/CPU) implementation and an empirical study across five draft/target backend configurations on a consumer Apple-silicon laptop. Distribution equivalence is verified at three levels, culminating in a two-sample test over roughly 9,200 real-model tokens per method (, dof , ) and exact greedy-sequence agreement. The best configuration reaches a measured wall-clock speedup at , on an acceptance profile declining from 69.7% at to 37.8% at the optimum, while three of five configurations decelerate, either because the draft fails to out-speed a small target or because the quantized Metal backend executes "parallel" verification serially, an effect we isolate and quantify. The failures are as instructive as the successes: speculative decoding pays off only when verification is genuinely batch-parallel and the draft/target latency gap is real.
Create a lesson
Metadata
- Categories
- cs.AI, cs.LG
- Comments
- 15 pages, 5 figures, 4 tables. Code, benchmark harness, and all result artifacts: https://github.com/ParamChordiya/speculative_decoding_engine
Related papers
Dynamic Reasoning in Next-Gen Detection and Response: An Empirical Study of LLM Triage, Reinforcement Tuning, and Adversarial Evasion
Shared title terminologycs.AIJeremy Canale
Certify What You Plant: Shortcut-Free Proof Depth in Logical Reasoning Data
Shared title terminologycs.AIBaptiste Juran, Dimitri Kachler, Damien Sileo
LoomKV: Lossless KV Cache Compression from GPU Memory to SSD for LLM Serving
Shared title terminologycs.AIWentao Zhu, Ziao Sheng, Peng Deng et al.
How Much Dependency Can a Marginal Rule See? Total Correlation in Diffusion LM Parallel Decoding
Shared title terminologycs.AIDovud Asadov, Rustambek Urokov, Qobiljon Toshnazarov et al.
Fishing Out Free Riders: Shapley-Based Reward Attribution for Parallel Reasoning via Reinforcement Learning
Shared title terminologycs.AIWentao Zhang, Haoyu Zhang, Xinke Jiang et al.
A Hardware-oriented Approach for Efficient Bayesian Inference Computation and Deployment
Shared title terminologycs.AINikola Pižurica, Matteo Risso, Nikola Milović et al.