FIER:用于长上下文LLM推理的细粒度且高效的KV缓存检索
FIER: Fine-Grained and Efficient KV Cache Retrieval for Long-context LLM Inference
AI总结:
针对长上下文LLM推理中KV缓存读取延迟高及重要token稀疏分布导致页级检索不准确的问题,提出Fier方法,利用1-bit量化keys进行细粒度且高效的KV缓存检索,在仅用11%缓存预算匹配全KV性能的同时显著降低解码延迟。
摘要:
Key-Value(KV)缓存读取延迟随着上下文长度的增加而显著增加,阻碍了长上下文LLM推理的效率。为了解决这个问题,先前的工作提出基于token重要性保留一小部分KV缓存。例如,KV驱逐使用静态启发式方法保留token,而KV检索则动态选择与query相关的token以实现更具适应性的缓存管理。然而,我们观察到重要token通常稀疏地分布在长上下文中。这种稀疏性使得现有的页级KV检索不准确,因为每个页面可能包含不相关的token并遗漏关键的token。在这项工作中,我们提出了Fier,一种细粒度且高效的KV缓存检索方法。Fier使用1-bit量化的keys来估计每个token的重要性,从而实现高效且精确的检索。实验表明,Fier在各种长上下文任务中仅使用11%的缓存预算即可匹配全KV性能,将解码延迟降低了1.2倍至1.5倍。代码可在https://github.com/SimWangArizona/FIER获取
英文摘要:
The Key-Value (KV) cache reading latency increases significantly with context lengths, hindering the efficiency of long-context LLM inference. To address this, previous works propose retaining a small fraction of KV cache based on token importance. For example, KV eviction uses static heuristics to retain tokens, while KV retrieval dynamically selects query-relevant tokens for more adaptive cache management. However, we observe that important tokens are often sparsely distributed across the long context. This sparsity makes existing page-level KV retrieval inaccurate, as each page may include irrelevant tokens and miss critical ones. In this work, we propose Fier, a \underline{Fi}ne-Grained and \underline{E}fficient KV cache \underline{R}etrieval method. Fier uses 1-bit quantized keys to estimate the importance of each token, resulting in efficient and precise retrieval. Experiments show that Fier matches full KV performance using only 11\% of the cache budget across various long-context tasks, reducing decoding latency by 1.2$\times$ to 1.5$\times$.Code is available at https://github.com/SimWangArizona/FIER
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。