通过增强指令注意力提升大模型遵循指令的能力,避免上下文干扰。
Instruction Following by Principled Boosting Attention of Large Language Models
- 用规则竞争理论解释指令与上下文的对抗关系,指导注意力调整。
- 在15个任务中表现优于基线方法,兼顾指令遵循与任务理解质量。
- 适合需要高可靠性、强安全性的实际部署场景,如客服与医疗问答。
大型语言模型的行为常受系统提示、拒绝边界、隐私约束和工具使用规则等指令影响,这些约束需在推理时保持有效。然而,在长上下文或用户输入与指令冲突时,模型可能违背指令,带来可靠性和安全风险。为此,本文提出一种无需重训练的推理阶段干预机制——注意力引导。我们建立统一理论,将指令遵循建模为指令规则与上下文衍生规则之间的竞争,注意力决定谁占主导。证明增加指令令牌注意力可使上下文更难覆盖指令。但过度增强会抑制应被纳入的任务相关上下文。基于此,提出指令注意力增强(InstABoost),在所有层和注意力头对指令键注意力日志进行恒定加性偏置。在15项任务上评估,其性能优于提示工程、潜在空间引导及先前注意力引导方法,既避免了潜在方法的流畅性下降,也克服了旧方法对指令的过度聚焦,实现更优的引导质量权衡。
原文摘要 · Abstract (English)
Large language models' behavior is often shaped by instructions such as system prompts, refusal boundaries, privacy constraints, and tool-use rules that must hold at inference time. Yet in practice these constraints can be violated under long contexts or when user-provided context conflicts with them, creating reliability and safety risks. This motivates inference-time interventions that strengthen instruction influence without retraining. One such intervention is attention steering, which biases attention toward instruction tokens. In this work, we present a unifying theory for attention steering methods by formalizing instruction following as rule-based competition between instruction rules and context-derived rules, with attention mediating which rules dominate. We prove that boosting attention to instruction tokens tilts this competition, making it harder for context to override instruction-following. However, excessive boosting can suppress task-relevant context that should be incorporated alongside the instruction. Guided by this theory, we propose Instruction Attention Boosting (InstABoost), a simple intervention that applies a constant additive bias to instruction-key attention logits across all layers and heads. We evaluate InstABoost against prompting, latent steering, and prior attention steering methods across 15 tasks. InstABoost matches or outperforms all baselines while avoiding the fluency collapse of latent methods and the instruction over-focus of prior attention methods, achieving a stronger steering-quality tradeoff.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。