Training-Free Exponential Context Extension via Cascading KV Cache

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Willette, Jeffrey, Lee, Heejun, Lee, Youngwan, Jeon, Myeongjae, Hwang, Sung Ju
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866908291056009216
author Willette, Jeffrey
Lee, Heejun
Lee, Youngwan
Jeon, Myeongjae
Hwang, Sung Ju
author_facet Willette, Jeffrey
Lee, Heejun
Lee, Youngwan
Jeon, Myeongjae
Hwang, Sung Ju
contents The transformer's context window is vital for tasks such as few-shot learning and conditional generation as it preserves previous tokens for active memory. However, as the context lengths increase, the computational costs grow quadratically, hindering the deployment of large language models (LLMs) in real-world, long sequence scenarios. Although some recent key-value caching (KV Cache) methods offer linear inference complexity, they naively manage the stored context, prematurely evicting tokens and losing valuable information. Moreover, they lack an optimized prefill/prompt stage strategy, resulting in higher latency than even quadratic attention for realistic context sizes. In response, we introduce a novel mechanism that leverages cascading sub-cache buffers to selectively retain the most relevant tokens, enabling the model to maintain longer context histories without increasing the cache size. Our approach outperforms linear caching baselines across key benchmarks, including streaming perplexity, question answering, book summarization, and passkey retrieval, where it retains better retrieval accuracy at 1M tokens after four doublings of the cache size of 65K. Additionally, our method reduces prefill stage latency by a factor of 6.8 when compared to flash attention on 1M tokens. These innovations not only enhance the computational efficiency of LLMs but also pave the way for their effective deployment in resource-constrained environments, enabling large-scale, real-time applications with significantly reduced latency.
format Preprint
id arxiv_https___arxiv_org_abs_2406_17808
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Training-Free Exponential Context Extension via Cascading KV Cache
Willette, Jeffrey
Lee, Heejun
Lee, Youngwan
Jeon, Myeongjae
Hwang, Sung Ju
Computation and Language
Artificial Intelligence
Machine Learning
The transformer's context window is vital for tasks such as few-shot learning and conditional generation as it preserves previous tokens for active memory. However, as the context lengths increase, the computational costs grow quadratically, hindering the deployment of large language models (LLMs) in real-world, long sequence scenarios. Although some recent key-value caching (KV Cache) methods offer linear inference complexity, they naively manage the stored context, prematurely evicting tokens and losing valuable information. Moreover, they lack an optimized prefill/prompt stage strategy, resulting in higher latency than even quadratic attention for realistic context sizes. In response, we introduce a novel mechanism that leverages cascading sub-cache buffers to selectively retain the most relevant tokens, enabling the model to maintain longer context histories without increasing the cache size. Our approach outperforms linear caching baselines across key benchmarks, including streaming perplexity, question answering, book summarization, and passkey retrieval, where it retains better retrieval accuracy at 1M tokens after four doublings of the cache size of 65K. Additionally, our method reduces prefill stage latency by a factor of 6.8 when compared to flash attention on 1M tokens. These innovations not only enhance the computational efficiency of LLMs but also pave the way for their effective deployment in resource-constrained environments, enabling large-scale, real-time applications with significantly reduced latency.
title Training-Free Exponential Context Extension via Cascading KV Cache
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2406.17808