Chimera: A Lossless Decoding Method for Accelerating Large Language Models Inference by Fusing all Tokens

Ziqian Zeng, Jiahong Yu, Qianshi Pang, Zihao Wang, Huiping Zhuang, Cen ChenarXiv 2024 · DOI

Abstract

Chimera is a novel "self-drafting" framework designed to accelerate Large Language Model (LLM) inference by up to 2.7x without compromising output quality. By integrating a lightweight trigram encoder and a single Transformer block that "recycles" the main model’s hidden states, Chimera generates highly accurate multi-token speculations. These speculations pass the main model's verification more frequently than previous methods, effectively mitigating the auto-regressive bottleneck in LLM deployment.

Introduction

The primary bottleneck in deploying Large Language Models (LLMs) is their auto-regressive nature: they generate text one token at a time. To produce each subsequent word, the model must process the entire preceding sequence, leading to high latency and underutilized GPU resources.

"Speculative decoding" has emerged as a solution, using a small "draft" model to quickly guess several future tokens, which the large "target" model then verifies in a single parallel pass. However, existing approaches face a significant trade-off. Independent drafting models (e.g., TinyLlama) are cumbersome to maintain and often suffer from distribution shifts. Conversely, self-drafting methods like Medusa, which add simple prediction heads to the main LLM, often lack accuracy because they predict future tokens ($i+1, i+2, \dots$) based only on the current token ($i$), ignoring the context of the tokens they are currently speculating.

Methodology

Chimera introduces a lightweight draft model integrated directly into the target LLM architecture. It relies on three core components to provide contextualized, high-quality speculations:

  • Trigram Encoder: Instead of a heavy embedding layer, Chimera uses a trigram-based approach to capture short-range dependencies. These trigram representations are stored in a pre-computed lookup table (cache), allowing the model to retrieve hidden states instantly.
  • Full Context Encoder: This single Transformer block acts as a bridge, fusing the "mature" hidden states from the main LLM with the "green" hidden states from the trigram encoder. This allows the draft model to "see" the full context of the sequence it is speculating, rather than guessing tokens in isolation.
  • Residual Decoding Heads: Chimera’s heads utilize a residual connection to the main LLM’s last hidden state. This ensures that predictions remain grounded in the high-quality representations of the massive target model, even with a minimal draft architecture.
Figure 2: The Chimera architecture integrates with the base LLM, utilizing a Trigram Encoder and Full Context Encoder to generate speculative tokens.

The Chimera Workflow

The inference process follows a three-stage pipeline: Drafting, Verification, and Acceptance. During Drafting, multiple Chimera heads generate top-k candidates in parallel. In the Verification stage, these candidates are organized into a tree structure and processed by the target LLM in a single pass. Finally, the Acceptance stage determines which tokens are logically sound according to the target model, ensuring the output remains identical to standard auto-regressive generation.

Figure 6: The three-stage inference pipeline: Drafting candidates, parallel Tree Verification, and final sequence Acceptance.

Experimental Evaluation

Chimera was trained using the ShareGPT dataset, containing approximately 70,000 real-world human-AI dialogues. Performance was evaluated across two major benchmarks: MT-bench (multi-turn conversations) and Vicuna-bench (general capabilities including coding and math).

Key Results

  • Significant Speedup: Chimera achieved an average wall-clock speedup of 2.7x across Vicuna and Llama-2-chat models (7B to 33B parameters).
  • Enhanced Accuracy: In head-to-head comparisons on Vicuna-7B, Chimera’s "Top-1" accuracy for the fourth predicted token reached 0.33, a substantial improvement over Medusa's 0.09. This demonstrates Chimera's superior ability to predict longer, coherent sequences.
  • Domain-Specific Performance: The method proved particularly effective in structured domains, reaching a 3.11x speedup in Coding and 3.03x in Mathematics, where logical dependencies are strongest.

Conclusion and Future Work

Chimera demonstrates that "recycling" hidden states from the target LLM allows a lightweight draft model to perform far above its weight class. While it requires a distillation training phase and additional memory for the trigram cache, the resulting acceleration is lossless and significant. Future research may explore extending this framework to Mixture of Experts (MoE) architectures and even larger models exceeding 100B parameters.

Summary updated

BibTeX
@misc{zeng2024chimera,
  author = {Ziqian Zeng and Jiahong Yu and Qianshi Pang and Zihao Wang and Huiping Zhuang and Cen Chen},
  title = {{Chimera: A Lossless Decoding Method for Accelerating Large Language Models Inference by Fusing all Tokens}},
  year = {2024},
  eprint = {2402.15758},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.15758},
}
Figure