paper-with-me

Papers

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

2025-02-24 · Penghui Yang, Cunxiao Du, Fengzhuo Zhang, Haonan Wang, Tianyu Pang, Chao Du, Bo An

Speculative decoding has become a promising technique to mitigate the high inference latency of autoregressive decoding in Large Language Models (LLMs). Despite its promise, the effective application of speculative decoding in LLMs still confronts three key challenges: the increasing memory demands of the draft model, the distribution shift between the short-training corpora and long-context inference, and inefficiencies in attention implementation. In this work, we enhance the performance of speculative decoding in long-context settings by addressing these challenges. First, we propose a memory-efficient draft model with a constant-sized Key-Value (KV) cache. Second, we introduce novel position indices for short-training data, enabling seamless adaptation from short-context training to long-context inference. Finally, we present an innovative attention aggregation method that combines fast implementations for prefix computation with standard attention for tree mask handling, effectively resolving the latency and memory inefficiencies of tree decoding. Our approach achieves strong results on various long-context tasks, including repository-level code completion, long-context summarization, and o1-like long reasoning tasks, demonstrating significant improvements in latency reduction. The code is available at https://github.com/sail-sg/LongSpec.

📄 PDF Abstract BibTeX arXiv:2502.17421

Code (1)

sail-sg/longspec 공식 구현 pytorch

Tasks

Code Completion

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Attention 설명 없음

Similar Papers 제목 키워드 기반

OWL: Overcoming Window Length-Dependence in Speculative Decoding for Long-Context Inputs

2025-10-08 · Jaeseong Lee, seung-won hwang, Aurick Qiao, Gabriele Oliaro 외 arxiv

Speculative decoding promises faster inference for large language models (LLMs), yet existing methods fail to generalize to real-world settings. Benchmarks typically assume short contexts (e.g., 2K tokens), whereas pract…

DeLS-Spec: Decoupled Long-Short Contexts for Parallel Speculative Drafting

2026-07-08 · Hong-Kai Zheng, Piji Li arxiv

Speculative decoding accelerates LLM inference by drafting multiple tokens and verifying them in parallel. Block-parallel drafters such as DFlash further improve drafting efficiency by predicting an entire block in one p…

Ouroboros: Generating Longer Drafts Phrase by Phrase for Faster Speculative Decoding

2024-02-21 · Weilin Zhao, Yuxiang Huang, Xu Han, Wang Xu 외

Speculative decoding is a widely used method that accelerates the generation process of large language models (LLMs) with no compromise in model performance. It achieves this goal by using an existing smaller model for d…

Text Generation

A Sparse Glimpse of the Whole: Train-Free Self-Speculative Decoding

2026-07-30 · Yuesong Liu, Yuan Zeng, Min Lyu, Ruilin Liu 외 arxiv

Speculative decoding alleviates the memory-bandwidth bottleneck in large language model inference, but its acceleration is jointly constrained by drafting overhead, token acceptance, and speculation length. We present a …

Cascade Speculative Drafting for Even Faster LLM Inference

2023-12-18 · Ziyi Chen, Xiaocong Yang, Jiacheng Lin, Chenkai Sun 외

Introduced to enhance the efficiency of large language model (LLM) inference, speculative decoding operates by having a smaller model generate a draft. A larger target model then reviews this draft to align with its outp…

Language ModelingLanguage ModellingLarge Language Model