Break the Sequential Dependency of LLM Inference Using Lookahead Decoding

Yichao Fu, Peter Bailis, Ion Stoica, Hao Zhang
2/3/2024
cs.LGcs.CL

Official code: hao-ai-lab/LookaheadDecoding (1,339 stars, Apache-2.0, last commit 2025-03-06).

Abstract

Autoregressive decoding of large language models (LLMs) is memory bandwidth bounded, resulting in high latency and significant wastes of the parallel processing power of modern accelerators. Existing methods for accelerating LLM decoding often require a draft model (e.g., speculative decoding), which is nontrivial to obtain and unable to generalize. In this paper, we introduce Lookahead decoding, an exact, parallel decoding algorithm that accelerates LLM decoding without needing auxiliary models or data stores. It allows trading per-step log(FLOPs) to reduce the number of total decoding steps, is more parallelizable on single or multiple modern accelerators, and is compatible with concurrent memory-efficient attention (e.g., FlashAttention). Our implementation of Lookahead decoding can speed up autoregressive decoding by up to 1.8x on MT-bench and 4x with strong scaling on multiple GPUs in code completion tasks. Our code is avialable at https://github.com/hao-ai-lab/LookaheadDecoding

View on arXivView PDF

Code Implementations(1)

Apache-2.0

[ICML 2024] Break the Sequential Dependency of LLM Inference Using Lookahead Decoding

1,33983Shell, PythonNov 21, 20231 years agoApache-2.0

Similar Papers

Cite this paper

@article{fu2024break,
  title  = {Break the Sequential Dependency of LLM Inference Using Lookahead Decoding},
  author = {Yichao Fu and Peter Bailis and Ion Stoica and Hao Zhang},
  year   = {2024},
  eprint = {2402.02057},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.02057v1},
  journal = {ICML 2024 2024}
}

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/2402.02057.svg)](https://codeofpaper.com/paper/2402.02057)

Discussion