BaKlaVa -- Budgeted Allocation of KV cache for Long-context Inference

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Gulhan, Ahmed Burak, Chitty-Venkata, Krishna Teja, Emani, Murali, Kandemir, Mahmut, Vishwanath, Venkatram
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909507691479040
author Gulhan, Ahmed Burak
Chitty-Venkata, Krishna Teja
Emani, Murali
Kandemir, Mahmut
Vishwanath, Venkatram
author_facet Gulhan, Ahmed Burak
Chitty-Venkata, Krishna Teja
Emani, Murali
Kandemir, Mahmut
Vishwanath, Venkatram
contents In Large Language Model (LLM) inference, Key-Value (KV) caches (KV-caches) are essential for reducing time complexity. However, they result in a linear increase in GPU memory as the context length grows. While recent work explores KV-cache eviction and compression policies to reduce memory usage, they often consider uniform KV-caches across all attention heads, leading to suboptimal performance. We introduce BaKlaVa, a method to allocate optimal memory for individual KV-caches across the model by estimating the importance of each KV-cache. Our empirical analysis demonstrates that not all KV-caches are equally critical for LLM performance. Using a one-time profiling approach, BaKlaVa assigns optimal memory budgets to each KV-cache. We evaluated our method on LLaMA-3-8B, and Qwen2.5-7B models, achieving up to a 70\% compression ratio while keeping baseline performance and delivering up to an order-of-magnitude accuracy improvement at higher compression levels.
format Preprint
id arxiv_https___arxiv_org_abs_2502_13176
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle BaKlaVa -- Budgeted Allocation of KV cache for Long-context Inference
Gulhan, Ahmed Burak
Chitty-Venkata, Krishna Teja
Emani, Murali
Kandemir, Mahmut
Vishwanath, Venkatram
Machine Learning
Artificial Intelligence
In Large Language Model (LLM) inference, Key-Value (KV) caches (KV-caches) are essential for reducing time complexity. However, they result in a linear increase in GPU memory as the context length grows. While recent work explores KV-cache eviction and compression policies to reduce memory usage, they often consider uniform KV-caches across all attention heads, leading to suboptimal performance. We introduce BaKlaVa, a method to allocate optimal memory for individual KV-caches across the model by estimating the importance of each KV-cache. Our empirical analysis demonstrates that not all KV-caches are equally critical for LLM performance. Using a one-time profiling approach, BaKlaVa assigns optimal memory budgets to each KV-cache. We evaluated our method on LLaMA-3-8B, and Qwen2.5-7B models, achieving up to a 70\% compression ratio while keeping baseline performance and delivering up to an order-of-magnitude accuracy improvement at higher compression levels.
title BaKlaVa -- Budgeted Allocation of KV cache for Long-context Inference
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2502.13176