mlsanityData to 13 Oct 2026

LongSpec: Long-Context Lossless Speculative Decoding with Efficient Drafting and Verification

arXiv 2502.17421 ↗First posted 24 Feb 2025cs.CL cs.AI cs.LGcited by 19

On the map: LLM agents and tool use → Software engineering coding agents

also in 1 more
Abstract (arXiv)

As Large Language Models (LLMs) can now process extremely long contexts, efficient inference over these extended inputs has become increasingly important, especially for emerging applications like LLM agents that highly depend on this capability. Speculative decoding (SD) offers a promising lossless acceleration technique compared to lossy alternatives such as quantization and model cascades. However, most state-of-the-art SD methods are trained on short texts (typically fewer than 4k tokens), making them unsuitable for long-context scenarios. Specifically, adapting these methods to long contexts presents three key challenges: (1) the excessive memory demands posed by draft models due to large Key-Value (KV) cache; (2) performance degradation resulting from the mismatch between short-context training and long-context inference; and (3) inefficiencies in tree attention mechanisms when managing long token sequences. This work introduces LongSpec, a framework that addresses these challenges through three core innovations: a memory-efficient draft model with a constant-sized KV cache; novel position indices that mitigate the training-inference mismatch; and an attention aggregation strategy that combines fast prefix computation with standard tree attention to enable efficient decoding. Experimental results confirm the effectiveness of LongSpec, achieving up to a 3.26x speedup over strong Flash Attention baselines across five long-context understanding datasets, as well as a 2.25x reduction in wall-clock time on the AIME24 long reasoning task with the QwQ model, demonstrating significant latency improvements for long-context applications. The code is available at https://github.com/sail-sg/LongSpec.

Key facts. Cited by 19 papers in the map (data through 13 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 54 of its 75 references that are in the map. First posted on arXiv 24 Feb 2025.

Builds on

54 of 75 references.

References · 54

  1. 2023GPT-4 Technical Reportcited by 18,278
  2. 2024The Llama 3 Herd of Modelscited by 14,486
  3. 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,247
  4. 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,831
  5. 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,270
  6. 2016SGDR: Stochastic Gradient Descent with Warm Restartscited by 5,021
  7. 2024Qwen2.5 Technical Reportcited by 4,840
  8. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,628
  9. 2020Longformer: The Long-Document Transformercited by 3,393
  10. 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,197
  11. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,137
  12. 2022Fast Inference from Transformers via Speculative Decodingcited by 1,625
38 more
  1. 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,386
  2. 2022Solving Quantitative Reasoning Problems with Language Modelscited by 1,369
  3. 2023AWQ: Activation-aware Weight Quantization for LLM Compression and Accelerationcited by 1,272
  4. 2024SnapKV: LLM Knows What You are Looking for Before Generationcited by 856
  5. 2024Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Headscited by 829
  6. 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 589
  7. 2024EAGLE: Speculative Sampling Requires Rethinking Feature Uncertaintycited by 569
  8. 2019Multi-News: a Large-Scale Multi-Document Summarization Dataset and Abstractive Hierarchical Modelcited by 429
  9. 2021QMSum: A New Benchmark for Query-based Multi-domain Meeting Summarizationcited by 363
  10. 2023SpecInfer: Accelerating Generative Large Language Model Serving with Tree-based Speculative Inference and Verificationcited by 361
  11. 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 350
  12. 2021Efficient Attentions for Long Document Summarizationcited by 342
  13. 2024LayerSkip: Enabling Early Exit Inference and Self-Speculative Decodingcited by 301
  14. 2024Break the Sequential Dependency of LLM Inference Using Lookahead Decodingcited by 295
  15. 2022Speculative Decoding: Exploiting Speculative Execution for Accelerating Seq2seq Generationcited by 169
  16. 2023Speculative Decoding with Big Little Decodercited by 162
  17. 2023REST: Retrieval-Based Speculative Decodingcited by 148
  18. 2024How to Train Long-Context Language Models (Effectively)cited by 144
  19. 2023SpecTr: Fast Speculative Decoding via Optimal Transportcited by 129
  20. 2024Liger Kernel: Efficient Triton Kernels for LLM Trainingcited by 127
  21. 2023Scaling Laws of RoPE-based Extrapolationcited by 125
  22. 2024Language Model Cascades: Token-level uncertainty and beyondcited by 117
  23. 2024Cradle: Empowering Foundation Agents Towards General Computer Controlcited by 115
  24. 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 113
  25. 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completioncited by 111
  26. 2023Online Speculative Decodingcited by 109
  27. 2025Reward-Guided Speculative Decoding for Efficient LLM Reasoningcited by 106
  28. 2024TriForce: Lossless Acceleration of Long Sequence Generation with Hierarchical Speculative Decodingcited by 99
  29. 2024MagicDec: Breaking the Latency-Throughput Tradeoff for Long Context Generation with Speculative Decodingcited by 87
  30. 2023Cascade Speculative Drafting for Even Faster LLM Inferencecited by 83
  31. 2024PEARL: Parallel Speculative Decoding with Adaptive Draft Lengthcited by 83
  32. 2023Fast and Robust Early-Exiting Framework for Autoregressive Language Models with Synchronized Parallel Decodingcited by 80
  33. 2024GliDe with a CaPE: A Low-Hassle Method to Accelerate Speculative Decodingcited by 74
  34. 2024SWIFT: On-the-Fly Self-Speculative Decoding for LLM Inference Accelerationcited by 69
  35. 2024Why Does the Effective Context Length of LLMs Fall Short?cited by 61
  36. 2025Judge Decoding: Faster Speculative Sampling Requires Going Beyond Model Alignmentcited by 59
  37. 2024Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recyclingcited by 47
  38. 2024Faster Cascades via Speculative Decodingcited by 38

50 most cited of 54 All 54 (JSON)

Built on by

Cited by year (2026 to 13 Oct)

Citing papers per year: 2025: 2; 2026: 17.

19 papers.

Sort:

By area:

  1. 2025LogitSpec: Accelerating Retrieval-based Speculative Decoding via Next Next Token Speculationcited by 14
  2. 2026Speculative Speculative Decodingcited by 14
  3. 2026SPEED-Bench: A Unified and Diverse Benchmark for Speculative Decodingcited by 8
  4. 2026Draft Less, Retrieve More: Hybrid Tree Construction for Speculative Decodingcited by 6
  5. 2026When Hidden States Drift: Can KV Caches Rescue Long-Range Speculative Decoding?cited by 4
  6. 2026Attention Drift: What Autoregressive Speculative Decoding Models Learncited by 4
  7. 2026Test-Time Speculationcited by 3
  8. 2026TailSieve: Partial-Rollout-Guided Tail Routing for LLM Rolloutscited by 2
  9. 2026Online Draft Co-Training for Speculative Decoding in Large-Scale, Long-Context RL Post-Trainingcited by 2
  10. 2025SpecMemo: Speculative Decoding is in Your Pocketcited by 1
  11. 2026Dustin: Draft-Augmented Sparse Verification for Efficient Long-Context Generation with Speculative Decodingcited by 0
  12. 2026Windowed-MTP: Removing the Full-Context Draft-KV Tax at Million-Token Contextcited by 0
7 more
  1. 2026KAP: Bridging the Knowledge Selection-Runtime Consumption Gap in LLM Systemscited by 0
  2. 2026LibraSpec: Dynamic Diffusion-Based Speculative Decoding via Marginal-Gain-Driven Optimizationcited by 0
  3. 2026Strong Drafts Need Compact Memories: Long-Context Speculative Decoding with Compressed KV Cachecited by 0
  4. 2026On-Demand Attention: Language Models Know When to Recallcited by 0
  5. 2026LongSpark: Efficient speculative decoding with a fixed-cost parallel draftercited by 0
  6. 2026UBTree: Parallel Tree Drafting via Unigram and Bigram Models for Speculative Decodingcited by 0
  7. 2026SharpDraft: Accelerating Long-Context Speculative Decoding with Cardinality-Aware Query Scalingcited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2025RAPID: Long-Context Inference with Retrieval-Augmented Speculative Decoding
  2. 2025OWL: Overcoming Window Length-Dependence in Speculative Decoding for Long-Context Inputs
  3. 2025DEL: Context-Aware Dynamic Exit Layer for Efficient Self-Speculative Decoding
  4. 2025SpecExtend: A Drop-in Enhancement for Speculative Decoding of Long Sequences
  5. 2026TriSpec: Ternary Speculative Decoding via Lightweight Proxy Verification
  6. 2026A Sparse Glimpse of the Whole: Train-Free Self-Speculative Decoding
  7. 2025Speculative Decoding: Performance or Illusion?
  8. 2025DynaSpec: Context-aware Dynamic Speculative Sampling for Large-Vocabulary Language Models