KVSink: Understanding and Enhancing the Preservation of Attention Sinks in KV Cache Quantization for LLMs

2508.04257v1 cs.CL 2025-08-09
Авторы:

Zunhai Su, Kehong Yuan

Резюме на русском

**Резюме** Повышение эффективности и снижение потребления ресурсов при интерпретации крупных лингвистических моделей (LLMs) являются текущими целями исследований в области AI. Одной из важных оптимизаций является квантование кэша Key-Value (KV), позволяющее экономить память и уменьшить зависимость от высокопроизводительной памяти. Ранее известно, что квантование KV может негативно сказаться на качестве модели, особенно если оно затрагивает "attention sinks" — ключевые точки, где модель придает большое значение некоторым токенам. Однако ранее не было достаточно глубокого понимания процесса образования таких точек и их взаимосвязи с квантованием. В данной работе предлагается новый подход **KVSink**, который не только эффективно определяет "attention sinks", но и позволяет лучше их защитить, не ухудшая качество модели. Это достигается за счет уточненного понимания роли этих точек в процессе вывода и их взаимодействия с квантованием KV. Тестирование показало, что KVSink превосходит предыдущие методы, обеспечивая более точную защиту ключевых точек и уменьшая зависимость от высокопроизводительных чисел в 16-битном представлении.

Abstract

Key-Value (KV) cache quantization has become a widely adopted optimization technique for efficient large language models (LLMs) inference by reducing KV cache memory usage and mitigating memory-bound constraints. Recent studies have emphasized the importance of preserving the original precision of KVs for the first few tokens to ensure the protection of attention sinks. While this approach has proven effective in mitigating performance degradation, its underlying principles remain insufficiently understood. Moreover, it fails to address the recent discovery that attention sinks can emerge beyond the initial token positions. In this work, we elucidate the underlying mechanisms of attention sinks during inference by examining their role in the cross-layer evolution of extreme activation outliers. Additionally, we provide a comprehensive analysis of the interplay between attention sinks and KV cache quantization. Based on our enhanced understanding, we introduce \textit{\textbf{KVSink}}, a plug-and-play method that effectively predicts sink tokens with negligible overhead, enabling more thorough preservation. Extensive experiments demonstrate that KVSink outperforms the existing Preserve-First-N (PFN) strategy, offering more effective preservation of attention sinks during KV cache quantization. Moreover, when applied to the well-established KVQuant method, KVSink further improves perplexity (PPL) and reduces reliance on 16-bit numerical outliers.

Ссылки и действия