Abstract
Early-exit Large Language Models (LLMs) provide a mechanism to reduce inference costs by terminating computation once a confidence threshold is reached at intermediate layers. However, standard serving frameworks like vLLM are ill-equipped to handle the resulting batching asynchrony and Key-Value (KV) cache inconsistencies. We present a specialized inference framework that introduces iteration-level batching and proactive KV cache filling. Our prototype achieves up to a 1.25x increase in throughput and a 3.39x reduction in latency on T5 architectures while maintaining competitive ROUGE-L scores.
Introduction
The computational intensity of standard LLMs stems from the requirement that every token must traverse the entire depth of the model. Early-exit architectures, such as CALM, mitigate this by allowing tokens to exit early if the model is sufficiently confident. Despite their potential, high-performance serving frameworks like vLLM or Orca struggle with two primary technical hurdles:
- Batching Inefficiency: Variations in exit layers across a batch lead to asynchronous processing that standard frameworks cannot handle efficiently.
- KV Cache Gaps: Skipping layers leaves the KV cache incomplete. If subsequent tokens do not exit early, the missing data from skipped layers causes system failures or significant performance degradation.
Methodology
To address these challenges, we developed a prototype system built upon vLLM featuring two core innovations:
Iteration-Level Batching
The framework monitors the exit status of each sequence within a batch. Processing continues layer-by-layer until every sequence in the batch satisfies its confidence threshold. This approach ensures that the entire batch terminates only when all constituent requests are ready, optimizing resource utilization during the early-exit process.
Proactive KV Cache Filling
To maintain KV cache integrity without the overhead of full transformer block execution, we utilize the "saturated" hidden state from the exit layer. By performing a single, computationally inexpensive matrix multiplication for each skipped layer, the framework generates the necessary KV tensors. This ensures that the cache is populated for future tokens while bypassing the heavy attention and feed-forward operations of the skipped layers.
We evaluated three exit strategies: Softmax Response, Hidden State Similarity, and Dedicated Classifiers.
Experimental Setup
The framework was evaluated using the CNN/DM text summarization dataset. We implemented the early-exit mechanism on T5-v1.1-small (8 layers) and T5-v1.1-base (12 layers) models. Experiments were conducted on NVIDIA RTX 4090 GPUs.
Results and Discussion
Our results indicate that the "Hidden State Similarity" strategy offers the most robust balance between performance and accuracy. This method leverages the observation that once a hidden state stabilizes, further processing yields diminishing returns.
As shown in Figure 2, the framework achieves an early-exit rate of over 57% for the T5-base model using the state similarity strategy, resulting in a 1.25x throughput improvement. Crucially, this speedup is achieved with minimal impact on ROUGE-L scores, demonstrating the effectiveness of the proactive KV cache filling in preserving model quality.
Latency improvements were even more pronounced. As illustrated in Figure 5, the "inner-token latency"—the time required to generate tokens post-prompt processing—decreased by up to 3.39x. The framework also incorporates "sticky" exit logic to manage internal fluctuations, ensuring that once a sequence is eligible for exit, it does not revert to requiring more layers.
Conclusion
While our framework demonstrates significant gains for encoder-decoder models like T5, future work is required to adapt these techniques for massive decoder-only architectures (e.g., Llama 3). Additionally, exploring the benefits for deeper models with 70+ layers and testing on data-center grade hardware like H100s will be critical for scaling these efficiency gains to production-level LLM serving.
Summary updated