TriForce: Lossless Acceleration of Long Sequence Generation with Hierarchical Speculative Decoding

With large language models (LLMs) widely deployed in long content generation recently, there has emerged an increasing demand for efficient long-sequence inference support. However, key-value (KV) cache, which is stored to avoid re-computation, has emerged as a critical bottleneck by growing linearly in size with the sequence length. Due to the auto-regressive nature of LLMs, the entire KV cache will be loaded for every generated token, resulting in low utilization of computational cores and high latency. While various compression methods for KV cache have been proposed to alleviate this issue, they suffer from degradation in generation quality. We introduce TriForce, a hierarchical speculative decoding system that is scalable for long sequence generation. This approach leverages the original model weights and dynamic sparse KV cache via retrieval as a draft model, which serves as an intermediate layer in the hierarchy and is further speculated by a smaller model to reduce its drafting latency. TriForce not only facilitates impressive speedups for Llama2-7B-128K, achieving up to 2.31$\times$ on an A100 GPU but also showcases scalability in handling even longer contexts. For the offloading setting on two RTX 4090 GPUs, TriForce achieves 0.108s/token$\unicode{x2014}$only half as slow as the auto-regressive baseline on an A100, which attains 7.78$\times$ on our optimized offloading system. Additionally, TriForce performs 4.86$\times$ than DeepSpeed-Zero-Inference on a single RTX 4090 GPU. TriForce's robustness is highlighted by its consistently outstanding performance across various temperatures. The code is available at https://github.com/Infini-AI-Lab/TriForce.

Paper

Similar papers

Reviewer FT2L7/10 · confidence 4/52024-05-11

Summary

This research introduces TRIFORCE, a novel hierarchical speculative decoding system that significantly accelerates inference efficiency for large language models on long context settings while fully preserving output quality. By leveraging insights from attention sparsity and contextual locality, the authors propose innovative techniques such as retrieval-based drafting (large model with retrieved cache) and hierarchical speculation (small model with StreamingLLM cache) to effectively mitigate the dual memory bottlenecks posed by KV cache and model weights. Comprehensive experiments on the PG-19 dataset demonstrate the effectiveness and practicality of the proposed approach, achieving up to 2.31x speedup on A100 GPUs and 11.65x speedup in offloading scenarios, as well as strong performance on large-batch inference tasks.

Rating

7

Confidence

4

Ethics flag

1

Reasons to accept

1. Insightful observations in Sections 3.1 and 3.2 effectively motivate the design of TRIFORCE's key techniques. 2. TRIFORCE consistently outperforms existing methods in long-context settings, demonstrating its effectiveness in efficiently handling long sequences.

Reasons to reject

1. The evaluation focuses on a single setting with a long input (120K tokens) and a short output (256 tokens). To better understand TRIFORCE's generalizability, it would be valuable to test its performance on scenarios with longer output sequences and analyze how the method scales with increasing output length. 2. The paper does not specify the hyperparameters γ1 and γ2 values, which control the speculation lengths in the hierarchical system. To facilitate reproducibility and deeper understanding, it is important to list all the hyperparameters used in the experiments and discuss their impact on the system's performance, as the effects of these hyperparameters remain unclear.

Reviewer myEE6/10 · confidence 4/52024-05-16

Summary

The paper focuses on improving the decoding efficiency of language models on long context generation, where KV cache IO can be a major bottleneck. The goal is to improve the generation latency without sacrificing accuracy of the language models. The paper proposes TriForce, a speculative decoding method. TriForce is a hierarchical speculative decoding method, where there are two draft models, one is based on a small language model with StreamingLLM KV cache, and the other is based on the original target model but with a small subset of KV cache (obtained by retrieval). It can achieve more than 2x speedup when context is long (e.g., >120K tokens).

Rating

6

Confidence

4

Ethics flag

1

Reasons to accept

- Lossless efficient decoding for long-context generation, I believe, has become more and more important. It is good to study this problem, as it is very different scenario compared to what people used to study widely (e.g., speculative decoding with less than one thousand tokens). - The general idea that using the model with a subset of KV cache as a draft model makes sense to me, especially in the case of long-context generation. - The method is well-motivated by a couple of great observations (section 3 and figure 3). Those observations can be insightful themself, and facilitate other research. - The idea of selecting KV cache via retrieval is valid. It is also good that the paper shows that existing methods (StreamingLLM and H2O) perform poorly on the needle retrieval task. - The experimental results are fairly strong.

Reasons to reject

- The presentation of the paper can be improved. There are quite a few places, which can be hard to follow without being very familiar with the related work/concepts. (I list some of them in the “Questions” section) - This approach requires a small draft model for the hierarchical speculation. This may not easily exist and may also take other resources during inference. - I think some ablation studies will be good to add. For example, what if only using StreamingLLM as the draft model, or only using the JF68M model as the draft model. - The approach, while being very efficient for 128K-token sequences. However, it may not further extend to much longer input (e.g., 1M), as the memory will be the bottleneck in that case.

Questions to authors

- In Figure 3(b): what does “Top-K” mean? Is this to take the subset of KV cache with top-k largest attention weights? Also, for “acceptance rate”: I would suggest defining what it is before talking about the results. - What do you mean by “maintain a full cache for the initial two layers”? - In Figure 3(c): what is the x-axis? What does “recovery rate” mean? - Table 2/3: What is “JF68M Eviction”?

Reviewer ByTv7/10 · confidence 3/52024-05-16

Summary

The paper introduces TRIFORCE, a novel speculative decoding system aimed at accelerating long-sequence generation in large language models (LLMs). The proposed method integrates Retrieval-based Drafting and Hierarchical Speculation to tackle the dual bottlenecks of model weights and key-value (KV) cache. TRIFORCE leverages the original model weights and partial KV cache to create a draft model, which is further speculated by a lightweight model using StreamingLLM cache. The approach is shown to provide significant speedups, particularly for the Llama2-7B-128K model, without compromising the quality of the generated sequences.

Rating

7

Confidence

3

Ethics flag

1

Reasons to accept

1. The proposed method is straightforward and easy to follow. 2. Using partial KV cache as a draft model is novel in the field of speculative decoding. 3. The method indeed shows notable speedup, particularly in long context scenarios.

Reasons to reject

The main weakness is the lack of comparisons or discussions of related work: 1. The Hierarchical Speculation in Section 4.2 is not novel. [1] has proposed similar ideas but is not compared or discussed in related work (Section 2.1). 2. [2] shows similar ideas as Retrieval-based Drafting in section 4.1, but is not compared or discussed in related work. 3. Skipping layers[3] as a draft model is a similar method to your using partial KV cache, but is not compared or discussed in related work. My intention is not that TriForce should beat these methods, since using partial KV cache as a draft model is new and should be useful in some scenarios (e.g. long context). However, I wonder why these related works are missed. I would raise my score if the authors justify the reasons. [1] Accelerating LLM Inference with Staged Speculative Decoding [2] REST: Retrieval-Based Speculative Decoding [3] Draft & Verify: Lossless Large Language Model Acceleration via Self-Speculative Decoding

Reviewer myEE2024-06-06

Thank authors for the response. I will keep my score as it is.

Program Chairsdecision2024-07-10

Decision

Accept

© 2026 NYSGPT2525 LLC