Learning Harmonized Representations for Speculative Sampling

Lefan Zhang, Xiaodan Wang, Yanhua Huang, Ruiwen Xu
8/28/2024
cs.LGcs.CL

Official code: HArmonizedSS/HASS (56 stars, last commit 2025-03-14).

Abstract

Speculative sampling is a promising approach to accelerate the decoding stage for Large Language Models (LLMs). Recent advancements that leverage target LLM's contextual information, such as hidden states and KV cache, have shown significant practical improvements. However, these approaches suffer from inconsistent context between training and decoding. We also observe another discrepancy between the training and decoding objectives in existing speculative sampling methods. In this work, we propose a solution named HArmonized Speculative Sampling (HASS) that learns harmonized representations to address these issues. HASS accelerates the decoding stage without adding inference overhead through harmonized objective distillation and harmonized context alignment. Experiments on four LLaMA models demonstrate that HASS achieves 2.81x-4.05x wall-clock time speedup ratio averaging across three datasets, surpassing EAGLE-2 by 8%-20%. The code is available at https://github.com/HArmonizedSS/HASS.

View on arXivView PDF

Code Implementations(1)

HArmonizedSS/HASSOfficial100%

Official Implementation of "Learning Harmonized Representations for Speculative Sampling" (HASS)

566Shell, PythonSep 27, 20241 years ago

Similar Papers

Cite this paper

@article{zhang2024learning,
  title  = {Learning Harmonized Representations for Speculative Sampling},
  author = {Lefan Zhang and Xiaodan Wang and Yanhua Huang and Ruiwen Xu},
  year   = {2024},
  eprint = {2408.15766},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.15766v3},
  journal = {ICLR 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/2408.15766.svg)](https://codeofpaper.com/paper/2408.15766)

Discussion