SpecHub: Provable Acceleration to Multi-Draft Speculative Decoding

Ryan Sun, Tianyi Zhou, Xun Chen, Lichao Sun
11/8/2024
cs.CLcs.AI

Official code: MasterGodzilla/Speculative_decoding_OT (6 stars, last commit 2024-09-06).

Abstract

Large Language Models (LLMs) have become essential in advancing natural language processing (NLP) tasks, but their sequential token generation limits inference speed. Multi-Draft Speculative Decoding (MDSD) offers a promising solution by using a smaller draft model to generate multiple token sequences, which the target LLM verifies in parallel. However, current heuristic approaches, such as Recursive Rejection Sampling (RRS), suffer from low acceptance rates in subsequent drafts, limiting the advantages of using multiple drafts. Meanwhile, Optimal Transport with Membership Cost (OTM) can theoretically improve acceptance rates, but its computational cost is too high for real-time use. We present SpecHub, a novel, efficient sampling-verification method for MDSD that improves acceptance rates with only linear computational overhead. By simplifying the OTM problem into a compact Linear Programming model, SpecHub significantly reduces computational complexity. It further accelerates sampling by leveraging a sparse joint distribution, focusing computation on high-probability token sequences. In extensive experiments, Spechub consistently generates 0.05-0.27 and 0.02-0.16 more tokens per step than RRS and RRS without replacement. We attach our code at \url{https://github.com/MasterGodzilla/Speculative_decoding_OT}.

View on arXivView PDF

Code Implementations(1)

61Shell, PythonApr 5, 20242 years ago

Similar Papers

Cite this paper

@article{sun2024spechub,
  title  = {SpecHub: Provable Acceleration to Multi-Draft Speculative Decoding},
  author = {Ryan Sun and Tianyi Zhou and Xun Chen and Lichao Sun},
  year   = {2024},
  eprint = {2411.05289},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.05289v1}
}

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

Discussion