arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2406.05317cs.LGcs.CL
收藏

LoCoCo:为长上下文压缩而置入卷积的丢弃方法

LoCoCo: Dropping In Convolutions for Long Context Compression

University of Texas at Austin(德克萨斯大学奥斯汀分校);Meta AI (FAIR)(Meta AI(FAIR));Carnegie Mellon University(卡内基梅隆大学)

Ruisi Cai, Yuandong Tian, Zhangyang Wang, Beidi Chen

AI总结:

本文提出 LoCoCo,通过一维卷积核自适应融合 KV 对,在固定大小 KV 缓存下实现长上下文压缩,并在推理与训练后微调中验证了高压缩率和性能保持。

摘要:

本文解决大型语言模型(LLM)在处理长上下文序列时面临的内存障碍,提出了一种新方法,即 Dropping In Convolutions for Long Context Compression(LoCoCo,为长上下文压缩而置入卷积的丢弃方法)。LoCoCo 仅使用固定大小的键值(KV)缓存,并且能够提升推理和微调两个阶段的效率。与以往基于启发式方法选择性丢弃 KV 对的方法不同,LoCoCo 利用数据驱动的自适应融合技术,将先前的 KV 对与新进入的 token 混合,以尽量减少上下文信息损失,并确保准确的注意力建模。这种 token 整合通过注入一维卷积核实现,卷积核会为每个 KV 缓存槽动态计算混合权重。LoCoCo 被设计为可广泛兼容现有 LLM 框架,无需修改架构即可直接“即插即用”地集成,同时只产生极小的调优开销。实验表明,LoCoCo 在各种上下文长度上均能保持持续出色的性能,并且在推理和微调阶段都能实现较高的上下文压缩率。在推理过程中,我们成功将多达 3482 个 token 压缩到大小为 128 的 KV 缓存中,同时保持了与完整序列相当的性能;在相同缓存大小下,相比基线的准确率提升最高达 0.2791。在训练后微调过程中,我们还使用固定大小为 512 的 KV 缓存,有效地将上下文长度从 4K 扩展到 32K,并取得了与使用完整序列微调相似的性能。

英文摘要:

This paper tackles the memory hurdle of processing long context sequences in Large Language Models (LLMs), by presenting a novel approach, Dropping In Convolutions for Long Context Compression (LoCoCo). LoCoCo employs only a fixed-size Key-Value (KV) cache, and can enhance efficiency in both inference and fine-tuning stages. Diverging from prior methods that selectively drop KV pairs based on heuristics, LoCoCo leverages a data-driven adaptive fusion technique, blending previous KV pairs with incoming tokens to minimize the loss of contextual information and ensure accurate attention modeling. This token integration is achieved through injecting one-dimensional convolutional kernels that dynamically calculate mixing weights for each KV cache slot. Designed for broad compatibility with existing LLM frameworks, LoCoCo allows for straightforward "drop-in" integration without needing architectural modifications, while incurring minimal tuning overhead. Experiments demonstrate that LoCoCo maintains consistently outstanding performance across various context lengths and can achieve a high context compression rate during both inference and fine-tuning phases. During inference, we successfully compressed up to 3482 tokens into a 128-size KV cache, while retaining comparable performance to the full sequence - an accuracy improvement of up to 0.2791 compared to baselines at the same cache size. During post-training tuning, we also effectively extended the context length from 4K to 32K using a KV cache of fixed size 512, achieving performance similar to fine-tuning with entire sequences.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑