提出零开销方法PEAR,提升大模型检索生成的上下文感知能力
PEAR: Position-Embedding-Agnostic Attention Re-weighting Enhances Retrieval-Augmented Generation with Zero Inference Overhead
- 通过可学习系数重加权抑制上下文的注意力头,提升模型感知能力
- 在多个RAG任务中性能优于基线,且推理时无额外内存或时间开销
- 不依赖特定位置编码,适用于多种模型和场景
增强检索生成(RAG)的大语言模型(LLM)已成为网络搜索的新范式。然而,LLM的有限上下文感知能力会降低RAG任务表现。现有提升方法常带来推理时的时间或内存开销,且多针对特定位置嵌入设计。本文提出位置嵌入无关的注意力重加权方法PEAR,以零推理开销增强LLM的上下文感知能力。具体地,在一个聚焦上下文复制的代理任务中,我们识别出抑制模型上下文感知的注意力头,并通过可学习系数对其输出进行重加权。在保持模型参数冻结的前提下,仅优化这些系数以最小化代理任务损失。结果表明,优化后的系数普遍小于1,有效缓解了对RAG性能的抑制。推理阶段固定这些系数即可实现重加权,不依赖具体任务。PEAR具有两大优势:(1)在内存和推理时间上均无额外开销,且在多个RAG任务中同时提升准确率与效率;(2)与位置嵌入算法无关,具备更广适用性。
原文摘要 · Abstract (English)
Large language models (LLMs) enhanced with retrieval-augmented generation (RAG) have introduced a new paradigm for web search. However, the limited context awareness of LLMs degrades their performance on RAG tasks. Existing methods to enhance context awareness are often inefficient, incurring time or memory overhead during inference, and many are tailored to specific position embeddings. In this paper, we propose Position-Embedding-Agnostic attention Re-weighting (PEAR), which enhances the context awareness of LLMs with zero inference overhead. Specifically, on a proxy task focused on context copying, we first detect heads which suppress the models' context awareness thereby diminishing RAG performance. To weaken the impact of these heads, we re-weight their outputs with learnable coefficients. The LLM (with frozen parameters) is optimized by adjusting these coefficients to minimize loss on the proxy task. As a result, the coefficients are optimized to values less than one, thereby reducing their tendency to suppress RAG performance. During inference, the optimized coefficients are fixed to re-weight these heads, regardless of the specific task at hand. Our proposed PEAR offers two major advantages over previous approaches: (1) It introduces zero additional inference overhead in terms of memory usage or inference time, while outperforming competitive baselines in accuracy and efficiency across various RAG tasks. (2) It is independent of position embedding algorithms, ensuring broader applicability.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。