Table of Contents
Fetching ...

Attention Heads of Large Language Models: A Survey

Zifan Zheng, Yezhaohui Wang, Yuxin Huang, Shichao Song, Mingchuan Yang, Bo Tang, Feiyu Xiong, Zhiyu Li

TL;DR

<3-5 sentence high-level summary>

Abstract

Since the advent of ChatGPT, Large Language Models (LLMs) have excelled in various tasks but remain as black-box systems. Understanding the reasoning bottlenecks of LLMs has become a critical challenge, as these limitations are deeply tied to their internal architecture. Among these, attention heads have emerged as a focal point for investigating the underlying mechanics of LLMs. In this survey, we aim to demystify the internal reasoning processes of LLMs by systematically exploring the roles and mechanisms of attention heads. We first introduce a novel four-stage framework inspired by the human thought process: Knowledge Recalling, In-Context Identification, Latent Reasoning, and Expression Preparation. Using this framework, we comprehensively review existing research to identify and categorize the functions of specific attention heads. Additionally, we analyze the experimental methodologies used to discover these special heads, dividing them into two categories: Modeling-Free and Modeling-Required methods. We further summarize relevant evaluation methods and benchmarks. Finally, we discuss the limitations of current research and propose several potential future directions.

Attention Heads of Large Language Models: A Survey

TL;DR

<3-5 sentence high-level summary>

Abstract

Since the advent of ChatGPT, Large Language Models (LLMs) have excelled in various tasks but remain as black-box systems. Understanding the reasoning bottlenecks of LLMs has become a critical challenge, as these limitations are deeply tied to their internal architecture. Among these, attention heads have emerged as a focal point for investigating the underlying mechanics of LLMs. In this survey, we aim to demystify the internal reasoning processes of LLMs by systematically exploring the roles and mechanisms of attention heads. We first introduce a novel four-stage framework inspired by the human thought process: Knowledge Recalling, In-Context Identification, Latent Reasoning, and Expression Preparation. Using this framework, we comprehensively review existing research to identify and categorize the functions of specific attention heads. Additionally, we analyze the experimental methodologies used to discover these special heads, dividing them into two categories: Modeling-Free and Modeling-Required methods. We further summarize relevant evaluation methods and benchmarks. Finally, we discuss the limitations of current research and propose several potential future directions.
Paper Structure (41 sections, 7 equations, 11 figures, 7 tables)

This paper contains 41 sections, 7 equations, 11 figures, 7 tables.

Figures (11)

  • Figure 1: The global Google Trends Popularity of the keywords "Attention Head" and "Model Interpretability". The data retrieval date is December 4th, 2024.
  • Figure 2: The framework of this survey.
  • Figure 3: The overall structure of decoder-only LLMs.
  • Figure 4: The diagram of residual streams. From the perspective of residual streams, the inference process of LLMs can be understood at a micro-level where attention heads access latent state matrices from several residual streams, as indicated by the gray arrows across layers in the diagram. At a macro-level, different residual streams control the information flow through attention heads, as shown by the gray wavy lines in the diagram.
  • Figure 5: Three different types of calculating effects.
  • ...and 6 more figures