CLMay 24, 2025

Unifying Attention Heads and Task Vectors via Hidden State Geometry in In-Context Learning

arXiv:2505.18752v26 citationsh-index: 4
Originality Incremental advance
AI Analysis

This work addresses the gap in understanding in-context learning mechanisms for researchers in machine learning and natural language processing, but it is incremental as it builds on prior studies of attention heads and task vectors.

The paper tackles the problem of understanding the internal mechanisms of in-context learning in large language models by proposing a unified framework linking attention heads and task vectors to hidden state geometry. The result reveals a two-stage mechanism where separability emerges in early layers and alignment develops in later layers, with specific attention heads driving these factors.

The unusual properties of in-context learning (ICL) have prompted investigations into the internal mechanisms of large language models. Prior work typically focuses on either special attention heads or task vectors at specific layers, but lacks a unified framework linking these components to the evolution of hidden states across layers that ultimately produce the model's output. In this paper, we propose such a framework for ICL in classification tasks by analyzing two geometric factors that govern performance: the separability and alignment of query hidden states. A fine-grained analysis of layer-wise dynamics reveals a striking two-stage mechanism: separability emerges in early layers, while alignment develops in later layers. Ablation studies further show that Previous Token Heads drive separability, while Induction Heads and task vectors enhance alignment. Our findings thus bridge the gap between attention heads and task vectors, offering a unified account of ICL's underlying mechanisms.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes