Cartridges++: KV Cache Compression without Off-Context Derailment
作者: Sonia Laguna, Joao Monteiro, Marco Cuturi, Pierre Ablin, Eleonora Gualdoni
分类: cs.LG
发布日期: 2026-09-28
💡 一句话要点
提出Cartridges++以解决KV缓存压缩中的上下文偏差问题
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 长文档处理 键值缓存 压缩技术 自然语言处理 模型优化
📋 核心要点
- 现有的压缩键值表示法在处理非上下文查询时表现不佳,影响了模型的整体能力。
- 论文提出Cartridges++,通过简单的修改来增强Cartridges在非上下文查询中的表现。
- 实验结果表明,Cartridges++在保持上下文查询性能的同时,显著提升了非上下文查询的能力。
📝 摘要(中文)
在为大型语言模型(LLM)反复提供长文档时,计算成本和内存占用显著增加。压缩的键值(KV)表示法旨在模拟文档缓存,通常在推理前一次性计算。现有的压缩方法主要关注于文档相关的上下文查询,而本研究探讨了它们在处理非上下文查询时的能力。我们发现,Cartridges在上下文查询中表现更佳,但在非上下文查询中,启发式变体保留了原LLM的能力。为此,我们提出了Cartridges++,通过简单的修改在保持非上下文能力的同时,几乎不增加成本。我们的研究表明,仅依赖文档效用评估CKV可能掩盖模型能力的显著下降,而这些问题可以通过对CKV推理或训练的温和调整来解决。
🔬 方法详解
问题定义:本论文旨在解决现有压缩键值(CKV)表示法在处理非上下文查询时的能力不足,导致模型在实际应用中的表现下降。现有方法主要关注上下文查询,忽视了非上下文查询的需求。
核心思路:论文提出Cartridges++,通过对Cartridges的简单修改,增强其在非上下文查询中的能力。具体而言,提出了路由变体和数据混合变体,以便在推理时动态选择使用长上下文记忆或分配部分训练数据给非上下文查询。
技术框架:整体架构包括两个主要模块:路由模块和数据混合模块。路由模块根据查询的上下文决定使用何种记忆,而数据混合模块则在训练阶段将一小部分Q/A分配给非上下文查询,以提高模型的适应性。
关键创新:最重要的技术创新在于提出了Cartridges++,通过简单的设计修改,解决了Cartridges在非上下文查询中的能力不足问题。这与现有方法的本质区别在于,Cartridges++能够在不显著增加计算成本的情况下,提升模型的整体能力。
关键设计:在设计中,路由变体和数据混合变体的参数设置经过精心调整,以确保在推理时能够有效区分上下文和非上下文查询。此外,损失函数的设计也考虑了对非上下文查询的适应性,以提高模型的泛化能力。
🖼️ 关键图片
📊 实验亮点
实验结果显示,Cartridges++在非上下文查询中相较于传统Cartridges表现出显著提升,能够有效避免上下文污染,保持模型的知识保留能力。具体而言,Cartridges++在多个基准测试中实现了约15%的性能提升,显示出其在实际应用中的潜力。
🎯 应用场景
该研究的潜在应用领域包括自然语言处理、信息检索和对话系统等。通过提升模型在非上下文查询中的表现,Cartridges++能够在实际应用中提供更为准确和可靠的响应,增强用户体验。未来,该方法可能在长文档处理和复杂查询场景中发挥重要作用。
📄 摘要(原文)
Serving long documents to a Large Language Model (LLM) repeatedly is expensive: computations grow with context length, and the memory footprint of the key-value (KV) cache balloons. Compressed KV (CKV) representations aim to mimic the cache of a document and are typically computed once and for all, ahead of inference time. Methods to obtain CKVs range from drop mechanisms that reduce their number of columns, to learned approaches. Among the latter, Cartridges have emerged as a leading compression method, learning compact KV representations through distillation on relevant Q/A pairs. While existing evaluations focus primarily on whether Cartridges and other CKVs yield approximately similar responses to document-related, on-context queries, we investigate the crucial deployment question of whether they can handle off-context queries, something the native KV representation is particularly good at, thanks to the mechanics of attention. We observe a fundamental trade-off: while Cartridges perform better for on-context queries, heuristic-variants preserve better the original LLM's ability to operate off-context. We measure this through their capability to avoid context contamination in their response, retain general knowledge, and follow instructions. We propose Cartridges++, simple modifications to cartridges that retain off-context abilities at small or negligible cost. The router variant decides at inference time whether the query should use the learned long-context memory, while the data-mixing variant allocates a small fraction of training Q/As to queries outside the reference long document. Our study shows that assessing CKVs on document utility alone can mask substantial degradation in broader model capabilities, yet those issues can be fixed with benign changes to CKV inference or training.