NACL: A General and Effective KV Cache Eviction Framework for LLMs at Inference Time

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Chen, Yilong, Wang, Guoxia, Shang, Junyuan, Cui, Shiyao, Zhang, Zhenyu, Liu, Tingwen, Wang, Shuohuan, Sun, Yu, Yu, Dianhai, Wu, Hua
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866916350362910720
author Chen, Yilong
Wang, Guoxia
Shang, Junyuan
Cui, Shiyao
Zhang, Zhenyu
Liu, Tingwen
Wang, Shuohuan
Sun, Yu
Yu, Dianhai
Wu, Hua
author_facet Chen, Yilong
Wang, Guoxia
Shang, Junyuan
Cui, Shiyao
Zhang, Zhenyu
Liu, Tingwen
Wang, Shuohuan
Sun, Yu
Yu, Dianhai
Wu, Hua
contents Large Language Models (LLMs) have ignited an innovative surge of AI applications, marking a new era of exciting possibilities equipped with extended context windows. However, hosting these models is cost-prohibitive mainly due to the extensive memory consumption of KV Cache involving long-context modeling. Despite several works proposing to evict unnecessary tokens from the KV Cache, most of them rely on the biased local statistics of accumulated attention scores and report performance using unconvincing metric like perplexity on inadequate short-text evaluation. In this paper, we propose NACL, a general framework for long-context KV cache eviction that achieves more optimal and efficient eviction in a single operation during the encoding phase. Due to NACL's efficiency, we combine more accurate attention score statistics in PROXY TOKENS EVICTION with the diversified random eviction strategy of RANDOM EVICTION, aiming to alleviate the issue of attention bias and enhance the robustness in maintaining pivotal tokens for long-context modeling tasks. Notably, our method significantly improves the performance on short- and long-text tasks by 80% and 76% respectively, reducing KV Cache by up to 50% with over 95% performance maintenance. The code is available at https://github.com/PaddlePaddle/Research/tree/master/NLP/ACL2024-NACL.
format Preprint
id arxiv_https___arxiv_org_abs_2408_03675
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle NACL: A General and Effective KV Cache Eviction Framework for LLMs at Inference Time
Chen, Yilong
Wang, Guoxia
Shang, Junyuan
Cui, Shiyao
Zhang, Zhenyu
Liu, Tingwen
Wang, Shuohuan
Sun, Yu
Yu, Dianhai
Wu, Hua
Computation and Language
Large Language Models (LLMs) have ignited an innovative surge of AI applications, marking a new era of exciting possibilities equipped with extended context windows. However, hosting these models is cost-prohibitive mainly due to the extensive memory consumption of KV Cache involving long-context modeling. Despite several works proposing to evict unnecessary tokens from the KV Cache, most of them rely on the biased local statistics of accumulated attention scores and report performance using unconvincing metric like perplexity on inadequate short-text evaluation. In this paper, we propose NACL, a general framework for long-context KV cache eviction that achieves more optimal and efficient eviction in a single operation during the encoding phase. Due to NACL's efficiency, we combine more accurate attention score statistics in PROXY TOKENS EVICTION with the diversified random eviction strategy of RANDOM EVICTION, aiming to alleviate the issue of attention bias and enhance the robustness in maintaining pivotal tokens for long-context modeling tasks. Notably, our method significantly improves the performance on short- and long-text tasks by 80% and 76% respectively, reducing KV Cache by up to 50% with over 95% performance maintenance. The code is available at https://github.com/PaddlePaddle/Research/tree/master/NLP/ACL2024-NACL.
title NACL: A General and Effective KV Cache Eviction Framework for LLMs at Inference Time
topic Computation and Language
url https://arxiv.org/abs/2408.03675