Tell Your Model Where to Attend: Post-hoc Attention Steering for LLMs
作者: Qingru Zhang, Chandan Singh, Liyuan Liu, Xiaodong Liu, Bin Yu, Jianfeng Gao, Tuo Zhao
分类: cs.CL, cs.LG
发布日期: 2023-11-03 (更新: 2024-10-01)
备注: The 12th International Conference on Learning Representations (ICLR 2024)
🔗 代码/项目: GITHUB
💡 一句话要点
提出PASTA以解决大语言模型注意力引导问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大语言模型 注意力机制 用户交互 文本处理 模型优化
📋 核心要点
- 现有方法无法处理用户指定的文本强调,限制了大语言模型的注意力引导能力。
- PASTA方法通过识别特定的注意力头并对其进行重加权,允许模型关注用户指定的信息。
- 实验结果显示,PASTA在多项任务上显著提升了模型性能,LLAMA-7B的准确率平均提高了22%。
📝 摘要(中文)
在人类撰写的文章中,文本样式的细微差别(如粗体和斜体)用于引导读者的注意力。与此类似,在与大语言模型(LLMs)交互时,我们也希望能够引导模型关注用户指定的信息。现有方法仅能处理普通文本,无法实现这一机制。为此,本文提出了PASTA(后期注意力引导方法),允许LLMs读取带有用户指定强调标记的文本。PASTA识别少量注意力头,并对其进行精确的注意力重加权,从而引导模型关注用户指定的部分。实验表明,PASTA显著提升了LLM遵循用户指令和整合新知识的能力,LLAMA-7B模型的平均准确率提高了22%。
🔬 方法详解
问题定义:本文旨在解决大语言模型在处理用户指定信息时的注意力引导问题。现有方法仅能处理普通文本,无法有效引导模型关注特定信息,导致用户指令的遵循性不足。
核心思路:PASTA方法的核心在于通过后期注意力引导,允许用户在文本中添加强调标记,从而引导模型关注这些特定部分。该方法在推理时应用,无需修改模型参数,便于实际使用。
技术框架:PASTA的整体架构包括两个主要模块:首先是用户输入的文本处理模块,识别用户指定的强调部分;其次是注意力重加权模块,针对特定的注意力头进行精确的重加权。
关键创新:PASTA的主要创新在于其后期注意力引导机制,能够在不改变模型参数的情况下,灵活地引导模型关注用户指定的信息。这与传统的提示方法形成了鲜明对比。
关键设计:在实现过程中,PASTA选择了一小部分注意力头进行重加权,具体的参数设置和重加权策略经过实验验证,以确保模型在不同任务上的性能提升。
🖼️ 关键图片
📊 实验亮点
实验结果表明,PASTA在多项任务上显著提升了模型性能,LLAMA-7B的平均准确率提高了22%。这一提升不仅展示了PASTA的有效性,还表明其在实际应用中的潜力,尤其是在遵循用户指令和整合新知识方面。
🎯 应用场景
PASTA方法具有广泛的应用潜力,尤其在需要用户与大语言模型进行高效交互的场景中,如智能助手、教育工具和内容生成等领域。通过引导模型关注特定信息,PASTA可以提升用户体验和模型的实用性,未来可能推动人机交互的进一步发展。
📄 摘要(原文)
In human-written articles, we often leverage the subtleties of text style, such as bold and italics, to guide the attention of readers. These textual emphases are vital for the readers to grasp the conveyed information. When interacting with large language models (LLMs), we have a similar need -- steering the model to pay closer attention to user-specified information, e.g., an instruction. Existing methods, however, are constrained to process plain text and do not support such a mechanism. This motivates us to introduce PASTA -- Post-hoc Attention STeering Approach, a method that allows LLMs to read text with user-specified emphasis marks. To this end, PASTA identifies a small subset of attention heads and applies precise attention reweighting on them, directing the model attention to user-specified parts. Like prompting, PASTA is applied at inference time and does not require changing any model parameters. Experiments demonstrate that PASTA can substantially enhance an LLM's ability to follow user instructions or integrate new knowledge from user inputs, leading to a significant performance improvement on a variety of tasks, e.g., an average accuracy improvement of 22% for LLAMA-7B. Our code is publicly available at https://github.com/QingruZhang/PASTA .