paper-with-me

Papers

Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads

2024-01-19 · Tianle Cai, Yuhong Li, Zhengyang Geng, Hongwu Peng, Jason D. Lee, Deming Chen, Tri Dao

Large Language Models (LLMs) employ auto-regressive decoding that requires sequential computation, with each step reliant on the previous one's output. This creates a bottleneck as each step necessitates moving the full model parameters from High-Bandwidth Memory (HBM) to the accelerator's cache. While methods such as speculative decoding have been suggested to address this issue, their implementation is impeded by the challenges associated with acquiring and maintaining a separate draft model. In this paper, we present Medusa, an efficient method that augments LLM inference by adding extra decoding heads to predict multiple subsequent tokens in parallel. Using a tree-based attention mechanism, Medusa constructs multiple candidate continuations and verifies them simultaneously in each decoding step. By leveraging parallel processing, Medusa substantially reduces the number of decoding steps required. We present two levels of fine-tuning procedures for Medusa to meet the needs of different use cases: Medusa-1: Medusa is directly fine-tuned on top of a frozen backbone LLM, enabling lossless inference acceleration. Medusa-2: Medusa is fine-tuned together with the backbone LLM, enabling better prediction accuracy of Medusa heads and higher speedup but needing a special training recipe that preserves the backbone model's capabilities. Moreover, we propose several extensions that improve or expand the utility of Medusa, including a self-distillation to handle situations where no training data is available and a typical acceptance scheme to boost the acceptance rate while maintaining generation quality. We evaluate Medusa on models of various sizes and training procedures. Our experiments demonstrate that Medusa-1 can achieve over 2.2x speedup without compromising generation quality, while Medusa-2 further improves the speedup to 2.3-3.6x.

📄 PDF Abstract BibTeX arXiv:2401.10774

Code (1)

fasterdecoding/medusa 공식 구현 pytorch

Similar Papers 제목 키워드 기반

Amphista: Bi-directional Multi-head Decoding for Accelerating LLM Inference

2024-06-19 · Zeping Li, Xinlong Yang, Ziheng Gao, Ji Liu 외

Large Language Models (LLMs) inherently use autoregressive decoding, which lacks parallelism in inference and results in significantly slow inference speed. While methods such as Medusa constructs parallelized heads, the…

Whisper in Medusa's Ear: Multi-head Efficient Decoding for Transformer-based ASR

2024-09-24 · Yael Segal-Feldman, Aviv Shamsian, Aviv Navon, Gill Hetz 외

Large transformer-based models have significant potential for speech transcription and translation. Their self-attention mechanisms and parallel processing enable them to capture complex patterns and dependencies in audi…

Parallel Decoding via Hidden Transfer for Lossless Large Language Model Acceleration

2024-04-18 · Pengfei Wu, Jiahao Liu, Zhuocheng Gong, Qifan Wang 외

Large language models (LLMs) have recently shown remarkable performance across a wide range of tasks. However, the substantial number of parameters in LLMs contributes to significant latency during model inference. This …

Language ModelingLanguage ModellingLarge Language Model

Hydra: Sequentially-Dependent Draft Heads for Medusa Decoding

2024-02-07 · Zachary Ankner, Rishab Parthasarathy, Aniruddha Nrusimha, Christopher Rinard 외

To combat the memory bandwidth-bound nature of autoregressive LLM inference, previous research has proposed the speculative decoding frame-work. To perform speculative decoding, a small draft model proposes candidate con…

Cerberus: Efficient Inference with Adaptive Parallel Decoding and Sequential Knowledge Enhancement

2024-10-17 · Yuxuan Liu, Wenyuan Li, Laizhong Cui, Hailiang Yang

Large language models (LLMs) often face a bottleneck in inference speed due to their reliance on auto-regressive decoding. Recently, parallel decoding has shown significant promise in enhancing inference efficiency. Howe…