SpecExtend: A Drop-in Enhancement for Speculative Decoding of Long Sequences

Jungyoub Cha, Hyunjong Kim, Sungzoon Cho
5/27/2025
6 citations
cs.CLcs.AIcs.LG
transformer-attention

Official code: jycha98/SpecExtend (6 stars, Python, last commit 2026-01-19).

Abstract

Speculative decoding is a widely used technique for accelerating inference in large language models (LLMs), but its performance degrades as input length grows, with significant drops even at moderate lengths. Yet, this early degradation has remained largely underexplored.

Show full abstract

We introduce SpecExtend, a drop-in enhancement that improves speculative decoding on long sequences without additional training. SpecExtend integrates efficient attention mechanisms such as FlashAttention and Hybrid Tree Attention to accelerate prefill and verification steps. To improve both draft accuracy and speed on long inputs without retraining, we propose Cross-model Retrieval, a novel KV cache eviction strategy that leverages the target model's attention scores to dynamically select relevant context for the smaller draft model. Extensive evaluations show that SpecExtend accelerates speculative decoding by up to 2.84x on 16K-token long document summarization and up to 3.86x on long-form reasoning, while preserving the short-input performance of state-of-the-art frameworks. Our code is available at https://github.com/jycha98/SpecExtend .

View on arXivView PDF

Code Implementations(1)

jycha98/SpecExtendOfficial100%
64PythonMay 24, 202510 months ago

Similar Papers

Cite this paper

@article{cha2025specextend,
  title  = {SpecExtend: A Drop-in Enhancement for Speculative Decoding of Long Sequences},
  author = {Jungyoub Cha and Hyunjong Kim and Sungzoon Cho},
  year   = {2025},
  eprint = {2505.20776},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.20776v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.20776.svg)](https://codeofpaper.com/paper/2505.20776)

Discussion