Abstract
Large Language Models (LLMs) face significant scaling challenges due to the memory and computational demands of the Key-Value (KV) cache. This paper introduces ECHO-LLaMA, a novel architecture and training strategy designed to mitigate these bottlenecks by sharing KV caches across layers. Unlike previous rigid architectures that require training from scratch, ECHO-LLaMA utilizes a flexible "incremental adaptation" technique to convert existing pretrained LLaMA models into more efficient versions. Our approach achieves up to 77% higher training throughput and a 2.33x reduction in memory usage while maintaining or improving task performance across standard benchmarks.
Introduction
As Large Language Models (LLMs) scale toward trillions of parameters, the memory required to store the KV cache—the keys and values of previous tokens used during autoregressive generation—has become a primary bottleneck. For a 500B parameter model, the KV cache can demand upwards of three terabytes of memory, making both training and long-context deployment prohibitively expensive.
While architectures like YOCO (You Only Cache Once) have attempted to address this through cache sharing, they typically impose a fixed 50/50 layer split and require training from scratch. ECHO-LLaMA addresses these limitations by providing a flexible framework that "recycles" high-quality pretrained models into efficient, shared-cache architectures without the astronomical cost of full retraining.
Methodology
Hybrid Architecture
ECHO-LLaMA employs a hybrid structure consisting of two distinct components:
- Standard Self-Attention Layers: The first $N$ layers function as traditional LLaMA layers.
- Cross-Decoders: The output of layer $N$ is used to generate a Global KV Cache. All subsequent layers reuse this single global cache instead of calculating their own independent keys and values.
Key Innovations
- Flexible Sharing: Users can define the ratio of layers that share the cache (e.g., 25% or 50%). This allows for a customizable balance between computational efficiency and the model's learning capacity.
- Incremental Adaptation: To avoid the cost of training from scratch, the researchers developed a stage-wise training strategy. Layers are converted one by one, starting from the end of the model. Each layer undergoes brief "micro-tuning" (approximately 150 steps). This gradual process prevents catastrophic forgetting and allows the model to adapt its internal representations to the shared global cache.
Experimental Setup
Datasets and Benchmarks
The model was evaluated across a comprehensive suite of benchmarks:
- General Knowledge & Reasoning: MMLU, C-Eval, ARC (Easy/Challenge), HellaSwag, and BoolQ.
- Math & Coding: GSM8K, MATH, HumanEval, and MBPP.
- Pretraining Data: A 4-billion token subset of the SlimPajama-627B dataset was utilized for the incremental adaptation process.
Results and Discussion
Efficiency Gains
ECHO-LLaMA demonstrates substantial improvements in hardware utilization and speed:
- Throughput: The 1.1B model achieved up to 77% higher token-per-second throughput during training and a 7% boost in inference speed.
- Memory Footprint: In long-context scenarios (32k tokens), ECHO-LLaMA reduced GPU memory consumption by 2.33x compared to the standard TinyLLaMA baseline.
- Hardware Utilization: The researchers reported a 16% improvement in Model FLOPs Utilization (MFU), indicating that the hardware spends significantly more time on computation rather than data movement.
Performance and Scaling
Surprisingly, the "recycling" of pretrained weights proved highly effective. When trained on an equal number of tokens, ECHO-LLaMA models achieved up to 14% lower loss than their baseline counterparts. Furthermore, the benefits of the architecture appear to scale with model size; the 7B parameter experiments showed more significant reductions in training loss and higher throughput gains than the 125M parameter versions.
Interestingly, the "25% shared" configuration often outperformed the baseline LLaMA model in accuracy. This suggests that standard LLMs may contain redundant layers, and forcing a shared representation can act as a beneficial form of regularization.
Conclusion and Future Work
ECHO-LLaMA provides a viable path for making large-scale model training and deployment more sustainable. By enabling the conversion of existing pretrained models into efficient architectures, it bypasses the need for expensive scratch-training.
Future research will focus on exploring non-linear mappings for the shared KV cache and dynamic caching mechanisms. Additionally, while the current study focused on zero-shot and few-shot performance, further investigation is needed to evaluate how these shared-cache models behave during complex, multi-task fine-tuning and in extreme context lengths exceeding hundreds of thousands of tokens.
Summary updated