Circuit explained: How does a transformer perform compositional generalization
Cheng Tang, Brenden Lake, Mehrdad Jazayeri, Constantine Dovrolis, Constantine Dovrolis, Constantine Dovrolis

TL;DR
This paper explains how a transformer model achieves compositional generalization by identifying and analyzing a specific circuit that enables predictable output through token remapping.
Contribution
The paper identifies and mechanistically interprets a circuit in a transformer that enables compositional generalization through token remapping.
Findings
The circuit performs function composition using a disentangled representation of token position and identity.
Causal ablations show that the circuit can be isolated and edited to steer model outputs predictably.
The mechanism suggests how symbolic compositionality might emerge in larger transformer models.
Abstract
Compositional generalization—the systematic combination of known components into novel structures—is fundamental to flexible human cognition, yet the mechanisms that enable it in neural networks remain poorly understood in both machine learning and cognitive science. [1] showed that a compact encoder-decoder transformer can achieve simple forms of compositional generalization in a sequence arithmetic task. In this work, we identify and mechanistically interpret the circuit responsible for this behavior in such a model. Using causal ablations, we isolate the circuit and show that this understanding enables precise activation edits to steer the model’s outputs predictably. We find that the circuit performs function composition without encoding the specific semantics of any given function—instead, it leverages a disentangled representation of token position and identity to apply a general…
Genes, proteins, chemicals, diseases, species, mutations and cell lines named across the full text — each resolved to its canonical identifier and authoritative record.
Click any figure to enlarge with its caption.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11
Figure 12
Figure 13
Figure 14
Figure 15
Figure 16
Figure 17
Figure 18
Figure 19
Figure 20
Figure 21
Figure 22
Figure 23
Figure 24
Figure 25
Figure 26
Figure 27
Figure 28
Figure 29
Figure 30
Figure 31
Figure 32
Figure 33
Figure 34
Figure 35
Figure 36
Figure 37
Figure 38Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsFerroelectric and Negative Capacitance Devices · Embodied and Extended Cognition · Face Recognition and Perception
