Interpreting Affine Recurrence Learning in GPT-style Transformers

Samarth Bhargav, Alexander Gu
10/22/2024
cs.LGcs.AI
transformer-attention

No confident code implementation found for this paper.

Abstract

Understanding the internal mechanisms of GPT-style transformers, particularly their capacity to perform in-context learning (ICL), is critical for advancing AI alignment and interpretability. In-context learning allows transformers to generalize during inference without modifying their weights, yet the precise operations driving this capability remain largely opaque.

Show full abstract

This paper presents an investigation into the mechanistic interpretability of these transformers, focusing specifically on their ability to learn and predict affine recurrences as an ICL task. To address this, we trained a custom three-layer transformer to predict affine recurrences and analyzed the model's internal operations using both empirical and theoretical approaches. Our findings reveal that the model forms an initial estimate of the target sequence using a copying mechanism in the zeroth layer, which is subsequently refined through negative similarity heads in the second layer. These insights contribute to a deeper understanding of transformer behaviors in recursive tasks and offer potential avenues for improving AI alignment through mechanistic interpretability. Finally, we discuss the implications of our results for future work, including extensions to higher-dimensional recurrences and the exploration of polynomial sequences.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{bhargav2024interpreting,
  title  = {Interpreting Affine Recurrence Learning in GPT-style Transformers},
  author = {Samarth Bhargav and Alexander Gu},
  year   = {2024},
  eprint = {2410.17438},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.17438v1}
}

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/2410.17438.svg)](https://codeofpaper.com/paper/2410.17438)

Discussion