Emergent Analogical Reasoning in Transformers
Gouki Minegishi, Jingyuan Feng, Hiroki Furuta, Takeshi Kojima, Yusuke Iwasawa, Yutaka Matsuo
TL;DR
The paper tackles how Transformers realize abstract analogy by formalizing analogical reasoning as functor‑driven correspondences between categories and by designing synthetic tasks that jointly test compositional and analogical generalization. It reveals a discriminative two‑part mechanism: geometric alignment of relational embeddings across categories and a functor‑like operation within Transformer layers that maps $e_s$ to its counterpart $e_t$ via $e_t \,\approx\, e_s + f$, with Dirichlet Energy $E$ serving as a quantitative anchor of alignment. The emergence of analogical reasoning is shown to be highly sensitive to data properties and optimization choices and does not monotonically scale with model size, though similar mechanistic signatures appear in pretrained LLMs under in‑context learning. Collectively, the work provides a mechanistic grounding for analogy in neural networks, bridging category theory, synthetic reasoning tasks, and large‑scale language models to illuminate cross‑domain generalization beyond sequential compositionality.
Abstract
Analogy is a central faculty of human intelligence, enabling abstract patterns discovered in one domain to be applied to another. Despite its central role in cognition, the mechanisms by which Transformers acquire and implement analogical reasoning remain poorly understood. In this work, inspired by the notion of functors in category theory, we formalize analogical reasoning as the inference of correspondences between entities across categories. Based on this formulation, we introduce synthetic tasks that evaluate the emergence of analogical reasoning under controlled settings. We find that the emergence of analogical reasoning is highly sensitive to data characteristics, optimization choices, and model scale. Through mechanistic analysis, we show that analogical reasoning in Transformers decomposes into two key components: (1) geometric alignment of relational structure in the embedding space, and (2) the application of a functor within the Transformer. These mechanisms enable models to transfer relational structure from one category to another, realizing analogy. Finally, we quantify these effects and find that the same trends are observed in pretrained LLMs. In doing so, we move analogy from an abstract cognitive notion to a concrete, mechanistically grounded phenomenon in modern neural networks.
