Model Tells Itself Where to Attend: Faithfulness Meets Automatic Attention Steering

Qingru Zhang, Xiaodong Yu, Chandan Singh, Liyuan Liu, Jianfeng Gao, Tuo Zhao, Dan Roth, Hao ChengarXiv 2024 · DOI

Abstract

Large Language Models (LLMs) frequently exhibit "contextual unfaithfulness," failing to leverage provided evidence correctly despite its presence in the input. This paper introduces AutoPASTA (Automatic Post-hoc Attention Steering Approach), an inference-only technique designed to improve LLM faithfulness. AutoPASTA identifies key evidence through iterative prompting and then applies "hard" attention steering to force the model to focus on these critical tokens. Evaluated on Llama-3-70B, the method yields performance improvements of up to nearly 9% without requiring model fine-tuning or retraining.

1. Introduction

While LLMs have demonstrated remarkable capabilities in reasoning and knowledge retrieval, they often struggle to remain faithful to long or complex contexts. Even when relevant information is provided, models may hallucinate or prioritize internal biases over external evidence. Traditional "Iterative Prompting" attempts to solve this by asking the model to first identify evidence and then answer. However, this "soft" nudge in the token space is often insufficient; the model may identify the correct sentence but fail to "attend" to it during the final generation phase.

Figure 1: Overview of AutoPASTA compared to Direct and Iterative Prompting. While traditional methods may fail to correctly utilize evidence, AutoPASTA steers internal attention to ensure the model focuses on the key sentence.

2. Methodology: The AutoPASTA Framework

AutoPASTA addresses unfaithfulness through a three-stage post-hoc process:

2.1 Automatic Identification and Semantic Mapping

The process begins by prompting the LLM to extract a "key sentence" from the context that supports the final answer. To account for potential hallucinations or minor misquotations during this extraction, AutoPASTA employs a semantic mapping step. Using an efficient encoder (e.g., all-MiniLM-L6-v2), the generated key sentence is mapped back to the exact token spans in the original source document.

2.2 Attention Steering

The core innovation involves manipulating the model's internal attention mechanism. Once the key tokens are identified, AutoPASTA upweights their attention scores at specific, pre-identified attention heads. This acts as an "internal spotlight," ensuring the model prioritizes the most relevant information during the generation of the final response.

Figure 2: The attention steering mechanism scales up the attention weights of highlighted tokens within selected attention heads.

2.3 Coarse-to-Fine Model Profiling

To minimize the computational overhead of identifying which attention heads to steer, the authors developed a coarse-to-fine profiling strategy. This method first identifies the most responsive layers and then searches for the optimal heads within those layers, reducing the profiling search time by a factor of 4.5x.

3. Experimental Evaluation

The effectiveness of AutoPASTA was tested on two major open-book QA benchmarks: Natural Questions (NQ) and HotpotQA. The evaluation spanned several state-of-the-art open-source models, including Vicuna-7B, Llama-3-8B-Instruct, and Llama-3-70B-Instruct.

3.1 Key Results

  • Significant Performance Gains: AutoPASTA consistently outperformed standard prompting. On Llama-3-70B-Instruct, it achieved an average Exact Match (EM) score improvement of 7.95%.
  • Robustness to Noise: The method maintained high performance even in the presence of distracting or irrelevant context, demonstrating its ability to effectively filter information.
  • Model Scaling: While all models benefited, smaller models like Vicuna-7B showed the most dramatic relative improvements, suggesting that attention steering can help smaller models emulate the reasoning precision of larger counterparts.

4. Discussion and Insights

A key finding is that the attention heads effective for steering are often task-agnostic. Heads identified as "steerable" on one dataset typically performed well on others, allowing for a "profile once, use everywhere" deployment strategy. Furthermore, the failure of iterative prompting on smaller models—often due to error propagation—was mitigated by AutoPASTA’s grounding in the original source text.

5. Conclusion

AutoPASTA provides a powerful, inference-only mechanism to enhance LLM faithfulness by bridging the gap between identifying evidence and utilizing it. By directly manipulating attention scores, it ensures that models "look" at the evidence they have identified, leading to more accurate and grounded generations.

Summary updated

BibTeX
@misc{zhang2024model,
  author = {Qingru Zhang and Xiaodong Yu and Chandan Singh and Xiaodong Liu and Liyuan Liu and Jianfeng Gao and Tuo Zhao and Dan Roth and Hao Cheng},
  title = {{Model Tells Itself Where to Attend: Faithfulness Meets Automatic Attention Steering}},
  year = {2024},
  eprint = {2409.10790},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.10790},
}
Figure