SAM Decoding: Speculative Decoding via Suffix Automaton
Yuxuan Hu, Ke Wang, Xiaokang Zhang, Fanjin Zhang, Cuiping Li, Hong Chen, Jing Zhang
Abstract
Speculative decoding (SD) has been demonstrated as an effective technique for lossless LLM inference acceleration. Retrieval-based SD methods, one kind of model-free method, have yielded promising speedup, but they often rely on incomplete retrieval resources, inefficient retrieval methods, and are constrained to certain domains. This paper presents a novel retrieval-based speculative decoding method that adapts suffix automaton (SAM) for efficient and accurate draft generation by utilizing common text corpus and dynamic text sequence. Unlike existing n-gram matching methods, SAM-Decoding finds the exact longest suffix match, achieving an average time complexity of O(1) per generation step of SAM update and suffix retrieval. It can also integrate with existing methods, adaptively selecting a draft generation strategy based on match length to generalize to broader domains. Extensive experiments on Spec-Bench show that our method is 18%+ faster than other retrieval-based SD methods. Additionally, when combined with advanced EAGLE-2, it provides an additional speedup of 3.28% -11.13% across varioussized LLM backbones. Our code is available at our repository.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
9 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- CopySpec: Accelerating LLMs with Speculative Copy-and-Paste cites Fast Inference from Transformers via Speculative Decoding
- A Simple and Effective Pruning Approach for Large Language Models cites SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models
- A Simple and Effective Pruning Approach for Large Language Models cites Language Models are Few-Shot Learners
- A Simple and Effective Pruning Approach for Large Language Models cites SparseGPT: Massive Language Models Can be Accurately Pruned in One-Shot
- Parallel Token Prediction for Language Models cites Fast Inference from Transformers via Speculative Decoding
- SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models cites Language Models are Few-Shot Learners
- BanditSpec: Adaptive Speculative Decoding via Bandit Algorithms cites Language Models are Few-Shot Learners
- BanditSpec: Adaptive Speculative Decoding via Bandit Algorithms cites Fast Inference from Transformers via Speculative Decoding
- Scaling Up, Speeding Up: A Benchmark of Speculative Decoding for Efficient LLM Test-Time Scaling cites Fast Inference from Transformers via Speculative Decoding
- Fast Inference from Transformers via Speculative Decoding cites Language Models are Few-Shot Learners
- Seer: Online Context Learning for Fast Synchronous LLM Reinforcement Learning cites Fast Inference from Transformers via Speculative Decoding
Cited by top-tier papers9
- Seer: Online Context Learning for Fast Synchronous LLM Reinforcement LearningRuoyu Qin, Weiran He, Weixiao Huang, Yangkun Zhang et al.OSDI 2026 · 32 citations
- Parallel Token Prediction for Language ModelsFelix Draxler, Justus C. Will, Farrin Marouf Sofian, Theofanis Karaletsos et al.ICLR 2026 · 6 citations
- Scaling Up, Speeding Up: A Benchmark of Speculative Decoding for Efficient LLM Test-Time ScalingShengyin Sun, Yiming Li, Xing Li, Yingzhao Lian et al.ICLR 2026 · 6 citations
- CopySpec: Accelerating LLMs with Speculative Copy-and-PasteRazvan-Gabriel Dumitru, Minglai Yang, Vikas Yadav, Mihai SurdeanuEMNLP 2025
- BanditSpec: Adaptive Speculative Decoding via Bandit AlgorithmsYunlong Hou, Fengzhuo Zhang, Cunxiao Du, Xuan Zhang et al.ICML 2025
Builds on17
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language ModelsGuangxuan Xiao, Ji Lin, Mickaël Seznec, Hao Wu et al.ICML 2023 · 1,493 citations
- Fast Inference from Transformers via Speculative DecodingYaniv Leviathan, Matan Kalman, Yossi MatiasICML 2023 · 1,472 citations
- SparseGPT: Massive Language Models Can be Accurately Pruned in One-ShotElias Frantar, Dan AlistarhICML 2023 · 1,240 citations
- A Simple and Effective Pruning Approach for Large Language ModelsMingjie Sun, Zhuang Liu, Anna Bair, J. Zico KolterICLR 2024 · 794 citations
Related papers
- EAGLE-2: Faster Inference of Language Models with Dynamic Draft TreesYuhui Li, Fangyun Wei, Chao Zhang, Hongyang ZhangEMNLP 2024 · 16 citations
- SuffixDecoding: Extreme Speculative Decoding for Emerging AI ApplicationsGabriele Oliaro, Zhihao Jia, Daniel F. Campos, Aurick QiaoNeurIPS 2025 · 34 citations
- LogitSpec: Accelerating Retrieval-based Speculative Decoding via Next Next Token SpeculationTianyu Liu, Qitan Lv, Hao Li, Xing Gao et al.ACL Findings 2026
- Not-a-Bandit: Provably No-Regret Drafter Selection in Speculative Decoding for LLMsHongyi Liu, Jiaji Huang, Zhen Jia, Youngsuk Park et al.ICLR 2026 · 5 citations
- RACER: Retrieval-Augmented Contextual Rapid Speculative DecodingZihong Zhang, Zuchao Li, Lefei Zhang, Ping Wang et al.ACL Findings 2026 · 1 citation
