Understanding reasoning in large language models is complicated by evaluations that conflate multiple reasoning types. We isolate analogical reasoning, where a model transfers an attribute between entities that share known properties, and study when such transfer can emerge from training. To make the problem analytically tractable, we study a minimal transformer-style abstraction that isolates how learned representations support analogical reasoning. Within this setting, we prove three key results. First, joint training on similarity and attribution premises enables analogical reasoning through aligned representations. Second, sequential training succeeds only when similarity structure is learned before specific attributes, revealing a curriculum asymmetry. Third, in our stylized setting, two-hop reasoning (a→b,b→c⇒a→c) can be viewed as analogical reasoning with identity bridges (b=b), which appear explicitly in training data. Together, these results reveal a unified mechanism: entities with shared properties become aligned in representation space, enabling property transfer through feature resemblance. Experiments with architectures up to 8B parameters show qualitative agreement with the theory and suggest that representational geometry plays an important role in analogical reasoning beyond the stylized model.
Figures & tables
Training tasks for Analogical Reasoning
Architecture
Training loss
Feature similarity
Success rate on A
Joint training on ⨄k=1κ(S1∪S2)⨄S3
GPT-2
0.0077 ± 1e-4
0.995 ± 6e-4
100% ± 0%
Joint training on ⨄k=1κ(S1∪S2)⨄S3
One-layer
0.001 ± 5e-5
0.9202 ± 7e-4
100% ± 0%
Late training on the attribution premise S3
GPT-2
0.0845 ± 3e-4
0.7983 ± 0.027
100% ± 0%
Late training on the attribution premise S3
One-layer
0.0024 ± 0
0.9689 ± 4e-4
100% ± 0%
Late training on the similarity premise S2
GPT-2
0.0085 ± 1e-4
0.4326 ± 0.012
0.7% ± 0.471%
Late training on the similarity premise S2
One-layer
0.0061 ± 5e-5
0.0014 ± 3.7e-3
0% ± 0%
Table 1: Training loss, feature similarity, and success rate: mean ± standard deviation of analogical reasoning and two-hop reasoning tasks over one-layer and GPT-2 transformers. GPT-2 is trained end-to-end with AdamW. We set κ=3 and show the impact of κ in Appendix C .
Models
Tasks
Fea. Sim.
Success rate
Llama
Joint training
0.8174
73%
Late on attribution
0.7990
86%
Late on similarity
0.6431
53%
Qwen
Joint training
0.8488
85%
Late on attribution
0.7971
72%
Late on similarity
0.7455
33%
Table 2: Feature similarity and success rate over Llama-3-1B and Qwen-2.5-1.5B.
Tasks
Fea. Sim.
Success rate
Joint training
0.3785
84%
Late on Attribution
0.3757
75%
Late on Similarity
0.2704
34%
Table 3: Feature similarity and success rate over Qwen-3-8B.
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Training tasks for Analogical Reasoning
Architecture
Training loss
Feature similarity
Success rate on A
Joint training on ⨄k=1κ(S1∪S2)⨄S3
One-layer
0.0133 ± 2e-4
0.9413 ± 3e-4
100% ± 0%
Late training on the attribution premise S3
One-layer
0.0198 ± 1e-4
0.7116 ± 2.2e-3
100% ± 0%
Late training on the similarity premise S2
One-layer
0.0138 ± 1e-4
0.4367 ± 1.2e-3
0.67% ± 0.47%
Appendix
Table 4: Training loss, feature similarity, and success rate: mean ± standard deviation of analogical reasoning tasks over one-layer transformers. These results are under end-to-end training .
Values of κ
Architecture
Training loss
Feature similarity
Success rate on A
κ=1
GPT-2
0.0294 ± 3e-4
0.9756 ± 5e-4
100% ± 0%
κ=1
One-layer
0.0079 ± 5e-5
0.6706 ± 9e-4
100% ± 0%
κ=3
GPT-2
0.0077 ± 1e-4
0.995 ± 6e-4
100% ± 0%
κ=3
One-layer
0.001 ± 5e-5
0.9202 ± 7e-4
100% ± 0%
κ=5
GPT-2
0.0039 ± 5e-4
0.9979 ± 3e-4
100% ± 0%
κ=5
One-layer
5e-4 ± 1e-4
0.9405 ± 2e-4
100% ± 0%
Appendix
Table 5: Training loss, feature similarity, and success rate: mean ± standard deviation of analogical reasoning tasks over one-layer and GPT-2 transformers. These results are under end-to-end training .
Figure 1: Feature cosine similarity of data with the same labels of deep linear neural networks and GPT-2 trained on orthogonal data.
Analogical reasoning studies how systems transfer relations and solutions between situations with shared structure, enabling inference beyond direct examples.
Analogical reasoning is a hallmark of human intelligence, enabling us to solve new problems by transferring knowledge from one situation to another. Yet, developing artificial intelligence systems capable of robust human-like analogical reasoning has proven difficult. In this work, we train transformers using Meta-Learning for Compositionality (MLC) on an analogical reasoning task (letter-string analogies) and assess their generalization capabilities. We find that letter-string analogies become learnable when guiding the models to attend to the most informative problem elements, induced by including copy tasks in the training data. Furthermore, generalization to new alphabets improves when models are trained with more heterogeneous datasets. For the best training run, our 3-layer encoder-decoder model performs on par with frontier models on our letter-string analogy datasets. The MLC approach also enables some generalization to compositions of trained transformations, but not to completely novel transformations. To understand how the model solves the analogies, we identify an algorithm for one analogy task that approximates the model's computations. We verify this using interpretability analyses and show that head-level attention weights causally affect model output, allowing steering between different analogy tasks. We discuss the implications of our findings for generalization capabilities of larger models and the parallels to human analogical reasoning.
Philipp Hellwig, Willem Zuidema, Claire E. Stevenson +1
Psychological Methods, University of Amsterdam · Institute for Logic, Language and Computation, University of Amsterdam
Identifying and exploiting common features across domains is at the heart of the human ability to make analogies, and is believed to be crucial for the ability to continually learn. To do this successfully, general and flexible computational strategies must be developed. While the extent to which Transformer neural network models can perform compositional reasoning has been the subject of intensive recent investigation, little work has been done to systematically understand how well these models can leverage their representations to learn new, related experiences. To address this gap, we expand the previously developed Learning Equality and Group Operations (LEGO) framework to a continual learning (CL) setting ("continual LEGO"). Using this continual LEGO experimental paradigm, we study the capability of feedforward and recurrent Transformer models to perform CL. We find that BERT, a canonical feedforward Transformer model, learns shortcut solutions that limits its ability to generalize and prevents strong forward transfer to new experiences. In contrast, we find evidence supporting the hypothesis that ALBERT, a recurrent version of BERT, learns a For loop-esque solution, which leads to better CL performance. When applying BERT and ALBERT models to a CL setting that requires composition across experiences, we find that both model families fail. Our investigation suggests that ALBERT models can have their performance drop rescued by use of training strategies that combine data across experiences, but this is not true for BERT models, where a detrimental shortcut solution becomes entrenched with initial training. Our results demonstrate that the recurrent ALBERT model may have an inductive bias better suited for CL and motivate future investigation of the interplay between Transformer architecture and computational solutions that emerge in modern models and tasks.
William T. Redman, Erik C. Johnson, Brian Robinson
Chain-of-Thought (CoT) prompting substantially improves the sample efficiency of transformers, reducing the complexity of tasks like parity learning from exponential to polynomial in the input length. However, generating explicit reasoning steps at inference is computationally expensive. Implicit Chain-of-Thought (ICoT) has emerged as a promising empirical remedy that trains models to internalize intermediate steps within their hidden states, but its theoretical foundations remain poorly understood. We give the first theoretical analysis of ICoT, proving that an L-layer transformer trained under our proposed Log-ICoT curriculum learns k-parity with poly(n) samples and L=log2k training stages. This matches the sample efficiency of explicit CoT while eliminating its inference overhead, and extends prior one-layer parity guarantees to multi-layer architectures. Compared to standard ICoT, which removes thinking tokens one at a time, Log-ICoT removes them in geometric chunks, reducing the number of stages from linear in k to logarithmic. Experiments on multi-layer transformers confirm the theory and visualize how reasoning is progressively absorbed into deeper layers.