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

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Yang, Haolin, Cho, Hakaze, Zhong, Yiqiao, Inoue, Naoya
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866917023261392896
author Yang, Haolin
Cho, Hakaze
Zhong, Yiqiao
Inoue, Naoya
author_facet Yang, Haolin
Cho, Hakaze
Zhong, Yiqiao
Inoue, Naoya
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2505_18752
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Unifying Attention Heads and Task Vectors via Hidden State Geometry in In-Context Learning
Yang, Haolin
Cho, Hakaze
Zhong, Yiqiao
Inoue, Naoya
Computation and Language
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.
title Unifying Attention Heads and Task Vectors via Hidden State Geometry in In-Context Learning
topic Computation and Language
url https://arxiv.org/abs/2505.18752