Online Speculative Decoding

Xiaoxuan Liu, Lanxiang Hu, Peter Bailis, Ion Stoica, Zhijie Deng +2 more
2/12/2026

No official code found. Best implementation: LiuXiaoxuanPKU/OSD (68 stars, last commit 2024-12-03).

Abstract

Speculative decoding is a pivotal technique to accelerate the inference of large language models (LLMs) by employing a smaller draft model to predict the target model's outputs. However, its efficacy can be limited due to the low predictive accuracy of the draft model, particularly when faced with diverse text inputs and a significant capability gap between the draft and target models. We introduce online speculative decoding to address this challenge. The main idea is to continuously update the (multiple) draft model(s) on observed user query data. Adapting to query distribution mitigates the shifts between the training distribution of the draft model and the query distribution, enabling the draft model to more accurately predict the target model's outputs. We develop a prototype of online speculative decoding based on knowledge distillation and evaluate it using both synthetic and real query data. The results show a substantial increase in the token acceptance rate by 0.1 to 0.65, bringing 1.42x to 2.17x latency reduction. Our code is available at https://github.com/LiuXiaoxuanPKU/OSD.

View on arXivView PDF

Code Implementations(1)

LiuXiaoxuanPKU/OSDCommunity100%
686C++, ShellAug 2, 20231 years ago

Similar Papers

Cite this paper

@article{liu2026online,
  title  = {Online Speculative Decoding},
  author = {Xiaoxuan Liu and Lanxiang Hu and Peter Bailis and Ion Stoica and Zhijie Deng and Alvin Cheung and Hao Zhang},
  year   = {2026},
  eprint = {2310.07177},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2310.07177},
  journal = {ICML 2023 2023}
}

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

Discussion