Circuit explained: How does a transformer perform compositional generalization

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 token remapping rule across an entire family of functions. Although the circuit mechanism was identified in a limited number of small scale models with a synthetic task, it sheds light to how symbolic compositionality can emerge in transformers and offer testable hypotheses for similar mechanisms in large-scale models. Code for model and analysis is publicly available.

Authors

Institutions

Publication Details

Journal
PLoS ONE
Published
2026-02-04
DOI
https://doi.org/10.1371/journal.pone.0340088
Primary Topic
Ferroelectric and Negative Capacitance Devices
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Circuit explained: How does a transformer perform compositional generalization

Cheng Tang, Mehrdad Jazayeri, Brenden Lake
PLoS ONE
Ferroelectric and Negative Capacitance Devices
article

Circuit explained: How does a transformer perform compositional generalization

Cheng Tang, Mehrdad Jazayeri, Brenden Lake
article en

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 token remapping rule across an entire family of functions. Although the circuit mechanism was identified in a limited number of small scale models with a synthetic task, it sheds light to how symbolic compositionality can emerge in transformers and offer testable hypotheses for similar mechanisms in large-scale models. Code for model and analysis is publicly available.

PLoS ONEVol. 21(2)
Howard Hughes Medical Institute (US), Princeton University (US), Massachusetts Institute of Technology (US)
Quality Education
Openalex Percentile: Top 67%
Ferroelectric and Negative Capacitance Devices
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Circuit explained: How does a transformer perform compositional generalization — Cheng Tang, Mehrdad Jazayeri, et al. · PLoS ONE (2026) | TGRS Research Map | TGRS