RAP: KV-Cache Compression via RoPE-Aligned Pruning
Jihao Xin, Tian Lvu, Hatem Ltaief, David Keyes, Marco Canini
TL;DR
RAP tackles the KV-Cache memory bottleneck in long-context LLM inference by introducing RoPE-Aligned Pruning, a structured pruning approach that preserves RoPE's 2×2 rotation blocks to maintain RoPE-commutativity. By pruning entire RoPE-aligned column pairs and absorbing the remaining factor into downstream weights, RAP eliminates reconstruction overhead while jointly reducing KV-Cache, attention parameters, and FLOPs. The method employs Fisher-information-based pair scoring, adaptive budget allocation, and a KD/LoRA-based accuracy recovery, with practical considerations for RoPE variants and hybrid compression. Empirical results on LLaMA-3-8B-Instruct and Mistral-7B-v0.3 show 20–30% joint savings and substantial latency reductions (prefill 83%, decode 77% of baseline at moderate compression) while preserving accuracy, making RAP a drop-in upgrade for RoPE-based LLMs.
Abstract
Long-context inference in large language models is increasingly bottlenecked by the memory and compute cost of the KV-Cache. Low-rank factorization compresses KV projections by writing $W \approx A * B$, where A produces latent KV states and B can be absorbed into downstream weights. In modern RoPE-based LLMs, this absorption fails: RoPE forces latent KV states to be reconstructed to full dimension, reintroducing substantial memory and compute overhead. We propose RoPE-Aligned Pruning (RAP), which prunes entire RoPE-aligned column pairs to preserve RoPE's 2x2 rotation structure, restore B absorption, and eliminate reconstruction. Our evaluation on LLaMA-3-8B and Mistral-7B shows that RAP enables joint reduction of KV-Cache, attention parameters, and FLOPs by 20-30%, all at once, while maintaining strong accuracy. Notably, RAP reduces attention latency to 83% (prefill) and 77% (decode) of baseline.
