FastKV: KV-Cache-Komprimierung für schnelle Langkontextverarbeitung mit tokenselektiver Propagation.
FastKV: KV Cache Compression for Fast Long-Context Processing with Token-Selective Propagation
February 3, 2025
Autoren: Dongwon Jo, Jiwon Song, Yulhwa Kim, Jae-Joon Kim
cs.AI
Zusammenfassung
Obwohl große Sprachmodelle (LLMs) darin herausragend sind, lange Kontextsequenzen zu verarbeiten, benötigen sie erhebliche Schlüssel-Wert (KV)-Caches, um Kontextinformationen zu speichern, was die Rechen- und Speichereffizienz stark belasten kann. Frühere Bemühungen zur Komprimierung dieser KV-Caches konzentrierten sich hauptsächlich auf die Reduzierung des Speicherbedarfs, waren jedoch in der Verbesserung der Latenz begrenzt. Um dieses Problem anzugehen, stellen wir FastKV vor, eine KV-Cache-Komprimierungsmethode, die darauf abzielt, die Latenz für lange Kontextsequenzen zu verbessern. Um die Verarbeitungsgeschwindigkeiten zu erhöhen und gleichzeitig die Genauigkeit beizubehalten, verwendet FastKV einen neuartigen Token-selektiven Propagierungsansatz (TSP), der die vollständigen Kontextinformationen in den ersten Schichten von LLMs beibehält und nur einen Teil dieser Informationen selektiv in den tieferen Schichten auch im Vorausfüllungsstadium propagiert. Darüber hinaus integriert FastKV eine gruppierte Abfrage-Aufmerksamkeit (GQA)-bewusste KV-Cache-Komprimierung, um die Vorteile von GQA sowohl in Bezug auf Speicher- als auch Recheneffizienz zu nutzen. Unsere experimentellen Ergebnisse zeigen, dass FastKV im Vergleich zu HeadKV, der modernsten KV-Cache-Komprimierungsmethode, Verbesserungen von 2,00-facher und 1,40-facher Zeit bis zum ersten Token (TTFT) bzw. Durchsatz erzielt. Darüber hinaus behält FastKV erfolgreich die Genauigkeit bei langen Kontext-Benchmarks auf einem mit den Baselines vergleichbaren Niveau bei. Unser Code ist unter https://github.com/dongwonjo/FastKV verfügbar.
English
While large language models (LLMs) excel at handling long-context sequences,
they require substantial key-value (KV) caches to store contextual information,
which can heavily burden computational efficiency and memory usage. Previous
efforts to compress these KV caches primarily focused on reducing memory
demands but were limited in enhancing latency. To address this issue, we
introduce FastKV, a KV cache compression method designed to enhance latency for
long-context sequences. To enhance processing speeds while maintaining
accuracy, FastKV adopts a novel Token-Selective Propagation (TSP) approach that
retains the full context information in the initial layers of LLMs and
selectively propagates only a portion of this information in deeper layers even
in the prefill stage. Additionally, FastKV incorporates grouped-query attention
(GQA)-aware KV cache compression to exploit the advantages of GQA in both
memory and computational efficiency. Our experimental results show that FastKV
achieves 2.00times and 1.40times improvements in time-to-first-token
(TTFT) and throughput, respectively, compared to HeadKV, the state-of-the-art
KV cache compression method. Moreover, FastKV successfully maintains accuracy
on long-context benchmarks at levels comparable to the baselines. Our code is
available at https://github.com/dongwonjo/FastKV.Summary
AI-Generated Summary