Causal Head Gating: A Framework for Interpreting Roles of Attention Heads in Transformers

Andrew Nam, Henry Conklin, Yu-Kang Yang, Thomas L. Griffiths, Jonathan D. Cohen +1 more
5/1/2025
28 citations
transformer-attention

No official code found. Best implementation: andrewnam/causal_head_gating (8 stars, Jupyter Notebook, MIT, last commit 2026-02-02).

Abstract

We present causal head gating (CHG), a scalable method for interpreting the functional roles of attention heads in transformer models. CHG learns soft gates over heads and assigns them a causal taxonomy - facilitating, interfering, or irrelevant - based on their impact on task performance.

Show full abstract

Unlike prior approaches in mechanistic interpretability, which are hypothesis-driven and require prompt templates or target labels, CHG applies directly to any dataset using standard next-token prediction. We evaluate CHG across multiple large language models (LLMs) in the Llama 3 model family and diverse tasks, including syntax, commonsense, and mathematical reasoning, and show that CHG scores yield causal, not merely correlational, insight validated via ablation and causal mediation analyses. We also introduce contrastive CHG, a variant that isolates sub-circuits for specific task components. Our findings reveal that LLMs contain multiple sparse task-sufficient sub-circuits, that individual head roles depend on interactions with others (low modularity), and that instruction following and in-context learning rely on separable mechanisms.

View on arXivView PDF

Code Implementations(1)

MIT

Accompanying repository for the paper "Causal Head Gating: A Framework for Interpreting Roles of Attention Heads in Transformers" by Andrew Nam, Henry Conklin, Yukang Yang, Thomas Griffiths, Jonathan Cohen, and Sarah-Jane Leslie, published in NeurIPS 2025.

80Jupyter Notebook, PythonOct 23, 202510 months agoMIT

Similar Papers

Cite this paper

@article{nam2025causal,
  title  = {Causal Head Gating: A Framework for Interpreting Roles of Attention Heads in Transformers},
  author = {Andrew Nam and Henry Conklin and Yu-Kang Yang and Thomas L. Griffiths and Jonathan D. Cohen and Sarah-Jane Leslie},
  year   = {2025},
  eprint = {2505.13737},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2505.13737},
  url    = {https://doi.org/10.48550/arXiv.2505.13737},
  journal = {Neural Information Processing Systems}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.13737.svg)](https://codeofpaper.com/paper/2505.13737)

Discussion