An explainable transformer circuit for compositional generalization

Cheng Tang, Brenden Lake, Mehrdad Jazayeri
2/19/2025
cs.LGcs.AIcs.CL
transformer-attention

No confident code implementation found for this paper.

Abstract

Compositional generalization-the systematic combination of known components into novel structures-remains a core challenge in cognitive science and machine learning. Although transformer-based large language models can exhibit strong performance on certain compositional tasks, the underlying mechanisms driving these abilities remain opaque, calling into question their interpretability.

Show full abstract

In this work, we identify and mechanistically interpret the circuit responsible for compositional induction in a compact transformer. Using causal ablations, we validate the circuit and formalize its operation using a program-like description. We further demonstrate that this mechanistic understanding enables precise activation edits to steer the model's behavior predictably. Our findings advance the understanding of complex behaviors in transformers and highlight such insights can provide a direct pathway for model control.

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{tang2025explainable,
  title  = {An explainable transformer circuit for compositional generalization},
  author = {Cheng Tang and Brenden Lake and Mehrdad Jazayeri},
  year   = {2025},
  eprint = {2502.15801},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.15801v1}
}

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

Discussion