ShadowKV compresses LLM memory by storing simplified keys on GPU and values on CPU
π https://arxiv.org/abs/2410.21465
Original Problem π―:
Long-context LLM inference faces throughput bottlenecks due to expanding Key-Value (KV) cache memory footprint. Existing solutions either compromise accuracy or fail to reduce GPU memory usage effectively.
-----
Solution in this Paper π§:
β ShadowKV stores low-rank pre-RoPE key cache on GPU while offloading value cache to CPU
β Uses chunk-level approximation strategy with 1.56% sparse budgets
β Maintains minimal outlier chunks (0.3%) as static cache on GPU
β Employs CUDA multi-streams to overlap key cache reconstruction with value cache fetching
β Implements cache-aware optimization reducing computation and data movement by 60%
-----
Key Insights π‘:
β Pre-RoPE keys are exceptionally low-rank compared to other components
β High cosine similarity exists between adjacent tokens in post-RoPE key cache
β Only a small fraction of chunks (0.3%) are outliers needing special handling
β KV cache exhibits strong temporal locality enabling efficient caching
-----
Results π:
β Supports 6x larger batch sizes across various models
β Boosts throughput by 3.04x on A100 GPU
β Achieves 7.2 TB/s equivalent bandwidth
β Maintains accuracy with just 1.56% sparse KV cache budget
β Successfully tested on models up to 1M context length










