Lune

EMNLP2024Top-tier venue

Interpreting Context Look-ups in Transformers: Investigating Attention-MLP Interactions

Clement Neo, Shay B. Cohen, Fazl Barez

Abstract

Understanding the inner workings of large language models (LLMs) is crucial for advancing their theoretical foundations and real-world applications. While the attention mechanism and multi-layer perceptrons (MLPs) have been studied independently, their interactions remain largely unexplored. This study investigates how attention heads and next-token neurons interact in LLMs to predict new words. We propose a methodology to identify next-token neurons, find prompts that highly activate them, and determine the upstream attention heads responsible. We then generate and evaluate explanations for the activity of these attention heads in an automated manner. Our findings reveal that some attention heads recognize specific contexts relevant to predicting a token and activate a downstream token-predicting neuron accordingly. This mechanism provides a deeper understanding of how attention heads work with MLP neurons to perform next-token prediction. Our approach offers a foundation for further research into the intricate workings of LLMs and their impact on text generation and understanding.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

4 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Mass-Editing Memory in a Transformer cites Transformer Feed-Forward Layers Are Key-Value Memories
  • Mass-Editing Memory in a Transformer cites Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Space
  • Understanding Addition in Transformers cites Transformer Feed-Forward Layers Are Key-Value Memories
  • Detecting Edit Failures In Large Language Models: An Improved Specificity Benchmark cites Transformer Feed-Forward Layers Are Key-Value Memories
  • Detecting Edit Failures In Large Language Models: An Improved Specificity Benchmark cites Mass-Editing Memory in a Transformer
  • Intrinsic Self-correction for Enhanced Morality: An Analysis of Internal Mechanisms and the Superficial Hypothesis cites Transformer Feed-Forward Layers Are Key-Value Memories
  • Intrinsic Self-correction for Enhanced Morality: An Analysis of Internal Mechanisms and the Superficial Hypothesis cites Mass-Editing Memory in a Transformer
  • Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Space cites Transformer Feed-Forward Layers Are Key-Value Memories
  • Capturing Polysemanticity with PRISM: A Multi-Concept Feature Description Framework cites Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 Small
  • Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 Small cites Transformer Feed-Forward Layers Are Key-Value Memories
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers4

  1. Understanding Addition in TransformersPhilip Quirke, Fazl BarezICLR 2024 · 36 citations
  2. Intrinsic Self-correction for Enhanced Morality: An Analysis of Internal Mechanisms and the Superficial HypothesisGuangliang Liu, Haitao Mao, Jiliang Tang, Kristen Marie JohnsonEMNLP 2024 · 21 citations
  3. Capturing Polysemanticity with PRISM: A Multi-Concept Feature Description FrameworkLaura Kopf, Nils Feldhus, Kirill Bykov, Philine Lou Bommer et al.NeurIPS 2025 · 12 citations
  4. Spectral Attention Steering for Prompt HighlightingWeixian Waylon Li, Yuchen Niu, Yongxin Yang, Keshuang Li et al.ICLR 2026 · 6 citations

Builds on8

  1. Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary SpaceMor Geva, Avi Caciularu, Kevin Ro Wang, Yoav GoldbergEMNLP 2022 · 92 citations
  2. Mass-Editing Memory in a TransformerKevin Meng, Arnab Sen Sharma, Alex J. Andonian, Yonatan Belinkov et al.ICLR 2023 · 52 citations
  3. Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 SmallKevin Ro Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris et al.ICLR 2023 · 50 citations
  4. Transformer Feed-Forward Layers Are Key-Value MemoriesMor Geva, Roei Schuster, Jonathan Berant, Omer LevyEMNLP 2021 · 33 citations
  5. Detecting Edit Failures In Large Language Models: An Improved Specificity BenchmarkJason Hoelscher-Obermaier, Julia Persson, Esben Kran, Ioannis Konstas et al.ACL Findings 2023 · 19 citations

Related papers

  1. Unlocking the Future: Exploring Look-Ahead Planning Mechanistic Interpretability in Large Language ModelsTianyi Men, Pengfei Cao, Zhuoran Jin, Yubo Chen et al.EMNLP 2024 · 20 citations
  2. Length Representations in Large Language ModelsSangjun Moon, Dasom Choi, Jingun Kwon, Hidetaka Kamigaito et al.EMNLP Findings 2025
  3. Interpreting and Improving Large Language Models in Arithmetic CalculationWei Zhang, Chaoqun Wan, Yonggang Zhang, Yiu-ming Cheung et al.ICML 2024 · 47 citations
  4. Token Alignment Heads: Unveiling Attention's Role in LLM Multilingual TranslationBinbin Liu, Wenhan Han, Feng Chen, Yifan Zhang et al.ICLR 2026
  5. Token-wise Decomposition of Autoregressive Language Model Hidden States for Analyzing Model PredictionsByung-Doh Oh, William SchulerACL 2023 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines