arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.16092cs.LGcs.AI
收藏

压缩上下文学习中的多样本(Many-Shots)

Compressing Many-Shots in In-Context Learning

Google(谷歌);UCLA(加州大学洛杉矶分校);University of Texas at Austin(德克萨斯大学奥斯汀分校)
Devvrit Khatri, Pranamya Kulkarni, Nilesh Gupta, Yerram Varun, Liqian Peng, Jay Yagnik, Praneeth Netrapalli, Cho-Jui Hsieh, Alec Go, Inderjit S Dhillon, Aditya … 展开作者

Devvrit Khatri, Pranamya Kulkarni, Nilesh Gupta, Yerram Varun, Liqian Peng, Jay Yagnik, Praneeth Netrapalli, Cho-Jui Hsieh, Alec Go, Inderjit S Dhillon, Aditya Kusupati, Prateek Jain

AI总结:

针对 ICL 中多样本提示导致的内存与计算开销,论文提出逐层软 token 压缩方法 MemCom,并证明其在 3x–8x 压缩率下显著优于基线。

摘要:

大型语言模型(LLM)已被证明能够在无需显式微调的情况下,通过上下文学习(ICL)获得大量输入-输出示例/演示,从而学习不同任务。增加示例(称为“shots”)的数量可以提升下游任务性能,但也会带来更高的内存和计算成本。在本研究中,我们研究了一种通过压缩多样本提示词来提高 ICL 推理内存和计算效率的方法。给定由 t 个 token 组成的多个 shots,我们的目标是生成一个包含 m 个软 token 的摘要,其中 m < t。我们首先表明,现有的提示词压缩方法对于多样本压缩是无效的,而简单地使用更少 shots 作为基线却出奇地有效。为了实现有效压缩,我们发现:(a)具有更多可训练参数的更强压缩器模型是必要的;(b)在每个 transformer 层压缩多样本表示,能够通过为每一层提供其自身的压缩表示来实现更细粒度的压缩。基于这些洞察,我们提出了 MemCom,这是一种逐层压缩方法。我们系统评估了不同模型规模(2B 和 7B)、架构(Gemma 和 Mistral)、多样本序列长度(3k-6k 个 token)以及压缩率(3 倍至 8 倍)下的各种压缩器模型和训练方法。在多个具有大标签集的分类任务上,MemCom 在所有压缩率下均优于强基线。值得注意的是,尽管基线性能在较高压缩率下会急剧下降,通常下降超过 20-30%,但 MemCom 仍能保持高准确率且退化极小,通常下降不到 10%。

英文摘要:

Large Language Models (LLMs) have been shown to be able to learn different tasks without explicit finetuning when given many input-output examples / demonstrations through In-Context Learning (ICL). Increasing the number of examples, called ``shots'', improves downstream task performance but incurs higher memory and computational costs. In this work, we study an approach to improve the memory and computational efficiency of ICL inference by compressing the many-shot prompts. Given many shots comprising t tokens, our goal is to generate a m soft-token summary, where m < t. We first show that existing prompt compression methods are ineffective for many-shot compression, and simply using fewer shots as a baseline is surprisingly strong. To achieve effective compression, we find that: (a) a stronger compressor model with more trainable parameters is necessary, and (b) compressing many-shot representations at each transformer layer enables more fine-grained compression by providing each layer with its own compressed representation. Based on these insights, we propose MemCom, a layer-wise compression method. We systematically evaluate various compressor models and training approaches across different model sizes (2B and 7B), architectures (Gemma and Mistral), many-shot sequence lengths (3k-6k tokens), and compression ratios (3x to 8x). MemCom outperforms strong baselines across all compression ratios on multiple classification tasks with large label sets. Notably, while baseline performance degrades sharply at higher compression ratios, often by over 20-30%, MemCom maintains high accuracy with minimal degradation, typically dropping by less than 10%.

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

↑