TL;DR
Large Language Models (LLMs) are memory-hungry, and serving them efficiently is a major challenge. This paper introduces "Oneiros," a novel system that reclaims GPU memory used by inactive LLM parameters to dynamically expand the KV cache for active models. This approach significantly boosts throughput and reduces latency in multi-tenant LLM serving environments.
What Problem Does This Paper Address?
LLMs require vast amounts of memory, primarily for their parameters and the KV cache, which stores intermediate results to speed up inference. As LLMs grow, their memory demands often outstrip GPU capacity, leading to performance bottlenecks. A common solution is CPU offloading, where parts of the KV cache are moved to CPU memory. However, this involves frequent, costly data transfers between CPU and GPU, especially when the KV cache is constantly updated. This problem is exacerbated in multi-tenant environments where multiple LLMs share GPU resources, leading to contention and performance degradation. Existing methods struggle to efficiently manage this memory pressure, particularly when dealing with dynamic workloads and varying request patterns.
Methods
The core innovation of Oneiros is parameter remapping. Instead of swapping KV cache data between CPU and GPU, Oneiros repurposes GPU memory that is already allocated to the parameters of inactive LLMs. When an active LLM needs more KV cache space, Oneiros dynamically reclaims a portion of the inactive LLM's parameter memory and uses it for the KV cache.
Key components and techniques include:
- Remapping Controller: This component dynamically decides when to remap, which inactive models to target, how many parameter layers to remap, and which specific layers to remap.
- Metadata Store: Tracks active and inactive models and their memory utilization.
- Async Transfer Engine: Manages the unidirectional data transfer of parameters from GPU memory to CPU memory (for remapping) and back, overlapping these transfers with ongoing GPU computation to hide latency.
- Layer Eviction Algorithm: A novel algorithm that selects specific layers to remap based on their execution patterns, aiming to balance performance and minimize overhead. It leverages the circular execution of LLM layers to ensure that remapped parameters can be brought back to GPU memory in time for their next use.
- Dynamic KV Cache Allocation: Oneiros supports runtime dynamic allocation and deallocation of GPU memory for KV cache, allowing efficient reuse of freed parameter memory.
Datasets
The paper evaluates Oneiros using:
- Azure coding LLM inference traces: These traces capture real-world query arrival patterns, including burstiness, and are scaled to different arrival rates.
- ShareGPT and Alpaca datasets: Standard datasets for LLM evaluation.
- Synthetically generated requests: Used to simulate realistic multi-tenant scenarios with varying sequence lengths.
Key Insights and Ideas
- Model parameters are static, KV cache is dynamic: This fundamental observation is the bedrock of Oneiros. While KV cache constantly changes, model parameters remain fixed during inference, making their memory a more predictable and reusable resource.
- Unidirectional remapping is key: Unlike bidirectional KV cache swapping, parameter remapping is a one-way data movement from GPU to CPU (for parameter storage) and back (when needed). This significantly reduces synchronization overhead.
- Multi-tenancy is a prime use case: Inactive models in multi-tenant setups are a perfect source of reclaimable memory. Oneiros can efficiently leverage these idle resources without impacting active models.
- Layer selection matters: Simply remapping random layers can hurt performance. Oneiros's layer eviction algorithm, based on the circular nature of LLM inference, is crucial for maintaining efficiency.
- Hardware trends favor this approach: The increasing CPU-GPU bandwidth (e.g., NVIDIA Grace Hopper) makes parameter remapping a more viable and performant strategy than CPU offloading of computation.
Key Results
Oneiros demonstrates significant improvements over the baseline vLLM, particularly in multi-tenant scenarios:
- Latency Reduction:
- Tail TBT (Time-Between-Tokens) latency reduced by 44.8%-82.5%.
- Tail TTFT (Time-To-First-Token) latency reduced by 20.7%-99.3%.
- Throughput Increase: Achieved 6.6%-86.7% higher throughput.
- Comparison to KV Cache Swapping (Pie): Oneiros achieved 47.1% higher throughput and reduced tail latency by 35.0% (TBT) and 93.6% (TTFT).
- Effectiveness across sharing strategies: Oneiros showed strong performance gains under both temporal and spatial GPU sharing configurations.
Limitations and Future Work
- Dynamic Reversion: The paper introduces "Dynamic Reversion" to halt parameter remapping during non-peak periods, improving performance when KV cache is not exhausted. However, it notes that during peak load, remapping is consistently required.
- Capped Remapping Percentage: Aggressive remapping can reduce tail latency but increase average latency due to higher data transfer overhead. The paper suggests capping the remapping percentage to balance these factors.
- Future Work: The paper mentions that Oneiros can integrate with CPU offloading methods (like NEO) when its remapping limit is reached, suggesting further hybrid approaches. The authors also note that their layer selection strategy can be adapted for models with heterogeneous layers.
Summary updated