Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

PyramidInfer: Pyramid KV Cache Compression for High-throughput LLM Inference

About

Large Language Models (LLMs) have shown remarkable comprehension abilities but face challenges in GPU memory usage during inference, hindering their scalability for real-time applications like chatbots. To accelerate inference, we store computed keys and values (KV cache) in the GPU memory. Existing methods study the KV cache compression to reduce memory by pruning the pre-computed KV cache. However, they neglect the inter-layer dependency between layers and huge memory consumption in pre-computation. To explore these deficiencies, we find that the number of crucial keys and values that influence future generations decreases layer by layer and we can extract them by the consistency in attention weights. Based on the findings, we propose PyramidInfer, a method that compresses the KV cache by layer-wise retaining crucial context. PyramidInfer saves significant memory by computing fewer keys and values without sacrificing performance. Experimental results show PyramidInfer improves 2.2x throughput compared to Accelerate with over 54% GPU memory reduction in KV cache.

Dongjie Yang, XiaoDong Han, Yan Gao, Yao Hu, Shilin Zhang, Hai Zhao• 2024

Related benchmarks

TaskDatasetResultRank
Long-context Language UnderstandingLongBench
M-Avg35.62
219
Long-context Language UnderstandingLongBench (test)
Average Score47.01
133
Long-context UnderstandingRULER
Performance @ 4K Context157
65
Long-context Question AnsweringLongBench (test)
HotpotQA30.97
59
Needle-in-a-HaystackNeedle-in-a-Haystack
Accuracy62.1
44
Long-context language modelingRULER
Accuracy (8K Context)3.38
34
Long-context UnderstandingLongBench v0.2
Na.QA (NER QA)23.75
16
Long-context performance evaluationRULER--
10
Showing 8 of 8 rows

Other info

Follow for update