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

XC-Cache:通过交叉注意力关注缓存上下文以实现高效大语言模型推理

XC-Cache: Cross-Attending to Cached Context for Efficient LLM Inference

ServiceNow Research(ServiceNow研究院);Québec Artificial Intelligence Institute(魁北克人工智能研究所);Autodesk(欧特克公司)

João Monteiro, Étienne Marcotte, Pierre-André Noël, Valentina Zantedeschi, David Vázquez, Nicolas Chapados, Christopher Pal, Perouz Taslakian

AI总结:

针对大语言模型推理中上下文学习缓存空间占用大、未知上下文难缓存的问题,提出基于交叉注意力的XC-Cache方法,仅训练少量新增层,在QA任务上性能优于ICL、媲美微调带提示LLM,空间占用比标准KV缓存低两个数量级。

摘要:

上下文学习(ICL)方法通常利用提示词,让仅解码器架构的语言模型基于参考信息生成内容。由于自注意力操作的二次方开销,上下文的即时处理效率很低,因此缓存机制很有必要。然而,缓存Transformer状态所需的空间几乎与模型参数相当。当无法提前获知所需的正确上下文时,缓存ICL的实现颇具挑战。本研究受编码器-解码器架构启发,提出了一类新模型,通过交叉注意力让生成过程无需提示词即可基于参考文本进行条件生成,以此解决上述局限。具体而言,我们利用预训练的仅解码器模型,仅训练少量新增的层。我们以问答(QA)任务为测试平台,评估模型执行条件生成的能力,实验结果显示,该模型性能优于ICL,与经过微调的带提示大语言模型(LLM)表现相当,并且相比标准KV缓存,空间占用大幅降低了两个数量级。

英文摘要:

In-context learning (ICL) approaches typically leverage prompting to condition decoder-only language model generation on reference information. Just-in-time processing of a context is inefficient due to the quadratic cost of self-attention operations, and caching is desirable. However, caching transformer states can easily require almost as much space as the model parameters. When the right context isn't known in advance, caching ICL can be challenging. This work addresses these limitations by introducing models that, inspired by the encoder-decoder architecture, use cross-attention to condition generation on reference text without the prompt. More precisely, we leverage pre-trained decoder-only models and only train a small number of added layers. We use Question-Answering (QA) as a testbed to evaluate the ability of our models to perform conditional generation and observe that they outperform ICL, are comparable to fine-tuned prompted LLMs, and drastically reduce the space footprint relative to standard KV caching by two orders of magnitude.

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

↑