The Atlas of In-Context Learning: How Attention Heads Shape In-Context Retrieval Augmentation
Patrick Kahardipraja, Reduan Achtibat, Thomas Wiegand, Wojciech Samek, Sebastian Lapuschkin

TL;DR
This paper investigates how attention heads in large language models facilitate in-context retrieval augmentation, revealing their roles in understanding instructions and retrieving relevant information to improve transparency and safety.
Contribution
It introduces an attribution-based method to identify and analyze specialized attention heads, enhancing understanding of in-context learning mechanisms in language models.
Findings
Attention heads are specialized for instruction comprehension and information retrieval.
Modifying attention weights influences answer generation, demonstrating control over model responses.
Insights enable tracing knowledge sources, improving model transparency and safety.
Abstract
Large language models are able to exploit in-context learning to access external knowledge beyond their training data through retrieval-augmentation. While promising, its inner workings remain unclear. In this work, we shed light on the mechanism of in-context retrieval augmentation for question answering by viewing a prompt as a composition of informational components. We propose an attribution-based method to identify specialized attention heads, revealing in-context heads that comprehend instructions and retrieve relevant contextual information, and parametric heads that store entities' relational knowledge. To better understand their roles, we extract function vectors and modify their attention weights to show how they can influence the answer generation process. Finally, we leverage the gained insights to trace the sources of knowledge used during inference, paving the way towards…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
Taxonomy
TopicsAdvanced Image and Video Retrieval Techniques · Visual Attention and Saliency Detection
MethodsSoftmax · Attention Is All You Need
