Geometric and algebraic inference in humans and neural networks
Authors: Jacob Russin, Joonhwa Kim, Ellie Pavlick, Michael J. Frank
Organizations: Department of Computer Science, Brown University · Department of Cognitive and Psychological Sciences, Brown University · Department of Neuroscience, Brown University · Carney Institute for Brain Science, Brown University
Humans possess a remarkable ability to draw inferences from limited data. While some inferences are made intuitively from past experience, others require online reasoning based on novel information given in context. Here, we formalize these strategies, which we term geometric and algebraic inference, and study their computational tradeoffs in humans and neural networks. The geometric strategy gradually shapes representational geometry to reflect underlying relational structure, making subsequent inference cheap. The algebraic strategy flexibly attends to and reasons over novel relations given in context, but costs additional computation at inference time. We identify opposing signatures of these two strategies in transitive inference, a domain widely studied across species, and characterize the conditions under which each is observed. Our framework predicts that the geometric strategy should be dominant when relations are familiar, whereas the algebraic should emerge to support de novo inferences drawn in context. Multiple experiments demonstrate these opposing signatures in humans, neural networks trained from scratch, and large language models (LLMs). Causal interventions in the neural networks reveal that the geometric and algebraic strategies depend on representational geometry and selective attention mechanisms, respectively, and reproduce the effects of analogous neurobiological disruptions in humans. Our framework unifies these effects with disparate phenomena, including content effects observed in human and LLM reasoning and data-distribution effects observed in machine learning. Our findings reconcile competing views of cognitive flexibility that emphasize either representational geometry or algebraic manipulation by showing that each can have unique strengths, and can characterize different aspects of both human and neural network behavior.
Figures & tables
Figure 1: Two strategies for transitive inference. The geometric strategy pre-compiles item ranks into ordered representations. The algebraic strategy reasons step by step over relations given in context.
Figure 2: Symbolic distance effects (SDE). ( A ) Learning phase: participants were shown a query above a row of relations in context, and were given feedback. ( B ) IWL test (red): to test whether participants committed ranks of items to memory, we tested trained items with an uninformative context. ( C ) ICL test (blue): to test whether participants could make TIs in context, we tested them on novel items. ( D ) Under simple noise assumptions, the two strategies produce opposite distance effects on accuracy. ( E ) Expected reasoning steps grow with distance in the algebraic but not the geometric strategy. ( F ) Under the algebraic strategy, accuracy rises with reasoning budget, and longer distances require more steps. ( G ) Transformers trained from scratch exhibited an SDE on the IWL test and a reverse SDE on the ICL test. ( H ) The number of reasoning steps required to reach 90% of maximum accuracy increased with distance on the ICL, but not the IWL test. ( I ) ICL test accuracy increased with the number of reasoning steps, and longer distances required more steps. ( J ) Humans exhibited an SDE on the IWL test and a reverse SDE on the ICL test. ( K ) Human response times increased with distance on the ICL, but not the IWL test. ( L ) LLMs (Qwen3-32B shown) exhibited an SDE when discriminating familiar relations (country population), and a reverse SDE when tested on novel relations in context. ( M ) Across LLMs, the accuracy increased with symbolic distance on the IWL test and decreased on the ICL test for 15 of 18 models (lower right quadrant). ( N ) When evaluated with chain of thought (CoT), LLMs (Qwen3-32B shown) used more reasoning tokens for longer distances on the ICL test, and used fewer reasoning tokens on the IWL test (country population). ( O ) Across LLMs, the reasoning budget needed was larger on the ICL test than on the IWL test and increased with distance on the ICL test for 18 of 19 models (upper right quadrant). ( P ) The same held on the LLM ICL test as a function of the reasoning budget in tokens (Qwen3-32B shown). Panels F, I, and P show one line per symbolic distance (darker for larger distances); I and P show the best accuracy reached at each budget or below. Numbers show accuracy at the largest reasoning budget (eight steps; 1,024 tokens) over distances 2–6.
Figure 3: Content effects in transitive inference. ( A ) Context conditions. The ordering shown in the context was either congruent, reversed, or shuffled relative to prior knowledge, or was uninformative. ( B ) Content effects emerge in a system capable of both strategies. When context is congruent, the system performs well regardless of distance, but when it is reversed or shuffled, accuracy falls with distance. When context is uninformative (IWL test), the system shows an SDE. ( C ) Expected reasoning steps grow with distance on reversed and shuffled trials (identical; offset for visibility) but not on congruent trials. ( D ) On reversed trials, accuracy rises with reasoning steps; on congruent trials it stays near ceiling. ( E ) Transformer accuracy by symbolic distance with no reasoning steps. In the IWL test, an SDE was observed. Accuracy was near ceiling when the context was congruent but fell below chance when it was reversed and near chance when it was shuffled. ( F ) The number of reasoning steps required to reach 90% of maximum accuracy increased with distance on reversed and shuffled trials, but not on congruent. ( G ) Transformer accuracy on reversed trials recovered with reasoning steps, with longer distances requiring more steps; congruent accuracy remained high. ( H ) Humans exhibited an SDE in the congruent condition and a reverse SDE in the shuffled condition (uninformative and reversed contexts were not tested). ( I ) Human response times increased with distance in the shuffled, but not the congruent condition. ( J ) LLMs showed the predicted content effects without reasoning (Qwen3-32B, US state population). ( K ) Across LLMs and sets of items (one point per model × set), accuracy in the reversed condition decreased as accuracy in the no-context condition increased, suggesting a stronger prior increases interference. ( L ) With reasoning, the budget required to reach 90% of maximum accuracy increased with distance under a reversed and shuffled context (Qwen3-32B, US state population). ( M ) Across LLMs and real-world dimensions (one point per model × dimension), models showed content effects (higher accuracy on congruent than reversed), and reasoning effects (accuracy on reversed trials increased with reasoning; upper right quadrant). ( N ) LLM accuracy on reversed trials recovered with reasoning; longer distances required more reasoning tokens (Qwen3-32B, US state population). Panels G and N show the best accuracy reached at or below each budget. Numbers show accuracy at the largest reasoning budget (eight steps; 1,024 tokens) over distances 2–6.
Figure 4: Mechanisms underlying the geometric and algebraic strategies. ( A ) Interventions. The geometric strategy was targeted by erasing the rank direction in the model’s representations; the algebraic strategy was targeted by ablating context-reading heads. ( B ) In our transformers, erasing the rank direction impaired direct IWL responses and removed the bias on reversed trials, but left accuracy after reasoning intact. Ablating two context-reading heads impaired accuracy after reasoning but not direct responses. ( C ) The same interventions in an LLM (Qwen3-32B, US state population; 32 context-reading heads). Open bars show controls; accuracy is pooled over distances 2–6. ( D ) Patients with prefrontal damage could not order names from scrambled premises ( Waltz et al., (1999) ) . Humans given midazolam were more accurate on novel pairs ( Frank et al., (2006) ) . ( E ) Transformers that reasoned during finetuning, with two context-reading heads per network intact or ablated during finetuning and at test. Error bars: ± 1 SE; dashed lines indicate chance.
Figure 5: Data-distribution effects. ( A ) Schematic of the training frequency of orderings under Zipf distributions with different skew ( α ). ( B ) Learners should shift from geometric to algebraic as the data distribution becomes more diverse (smaller α ). ( C ) Final test accuracy versus skew. As data diversity decreases (i.e., α increases), final ICL test accuracy decreases, and final IWL test accuracy increases. ( D ) Predicted accuracy on novel versus familiar items as skew ( α ) varies. ( E ) ICL versus IWL test accuracy per seed. As skew ( α ) increases, ICL accuracy decreases and IWL accuracy increases, with a large range where models perform well on both tests.
Appendix figures & tables53 assets
Supplementary material from the paper’s appendix.
Appendix
Rank
Country
US state
City
Animal
Country
population
population
population
body mass
surface area
1
Jamaica
New Mexico
Vienna
wolf
Tajikistan
2
Panama
Kansas
Milan
cheetah
Romania
3
Singapore
Oklahoma
Chicago
jaguar
Japan
4
Belgium
Alabama
Chennai
gorilla
Kenya
5
Netherlands
Indiana
Ho Chi Minh City
elk
Tanzania
Appendix
Table S1: Main LLM item sets. Items are listed from smallest (rank 1) to largest (rank 11); the two endpoints were never queried. Spacing gives the target ratio between adjacent items; replicate sets are the additional disjoint item sets, with the same spacing, used to replicate the IWL test.
Figure S1: Additional symbolic-distance results. ( A ) IWL test accuracy for each pair of finetuned items with no reasoning steps, grouped by symbolic distance; A–G denote ranks in the learned ordering. ( B ) ICL test accuracy for each pair of ranks in a novel ordering shown in context, with one line per reasoning-step budget. ( C ) The same ICL test as a function of reasoning steps, with one line per symbolic distance. ( D ) Baseline test accuracy for finetuned items accompanied by a context that was congruent with the learned ordering. ( E ) Proportions of arbitrage responses consistent with the finetuned ordering or the reversed ordering shown in context, pooled over distances 2–6. Lines and bars show means across 10 seeds; bands and error bars show ±1 SE; faint dots show individual seeds where plotted; dashed lines indicate chance.
Figure S2: Alternative chain-of-thought algorithms. ( A–D ) ICL test accuracy as a function of reasoning steps after 100,000 pretraining steps for the main, inferred-relations, descend-first, and backtrack-at-dead-ends algorithms, respectively. ( E ) The smallest number of reasoning steps required to reach 90% of each seed’s maximum accuracy, by distance and algorithm. Lines show means across 10 seeds and bands show ±1 SE; dashed lines indicate chance.
Figure S3: Architecture and learning-rate sweep. Each panel shows ICL test accuracy against reasoning steps for one of the 24 architectures after 100,000 pretraining steps; the printed loss is the mean training loss over the last 5,000 steps. Lines and bands show mean ±1 SE across 10 seeds; dashed lines indicate chance.
Figure S4: Replay during finetuning. Columns show different finetuning learning rates and colors show different levels of replay. The top row reports ICL test accuracy (best over reasoning steps); the bottom row reports direct IWL test accuracy with no reasoning steps. Accuracy is averaged over symbolic distances 2–6. Lines and bands show mean ±1 SE across 10 checkpoints; dashed horizontal lines indicate chance.
Figure S5: Content effects across pretraining distributions. Columns vary the proportion of pretraining trials using the frequent cue c∗ , and rows vary the probability of CoT supervision, p(CoT) . ( A ) Direct accuracy by symbolic distance in the IWL test and under congruent, reversed, or shuffled contexts. ( B ) Reversed accuracy as a function of reasoning steps, with one line per non-adjacent symbolic distance. ( C ) Number of reasoning steps required to reach 90% of maximum accuracy, by symbolic distance, under congruent, reversed, and shuffled contexts. Crosses above the axis mark distances at which most seeds never rose above chance. Lines and bands show mean ±1 SE across 10 seeds; dashed lines indicate chance.
Figure S6: Additional mechanism results. ( A ) Pairwise ordering accuracy of linear rank probes evaluated on held-out items, by layer and the frequent-cue proportion used during training ( p(CoT) fixed at .9). ( B ) Direct IWL accuracy at distances 2–6 when the rank direction is intact, erased, or inverted, or a matched random direction is erased. ( C ) Agreement with a random unrelated ordering written along the rank direction on reversed-context trials, with zero or eight reasoning steps. Write strength ranges from untouched (0) to full replacement (1); the control bars show full-strength writes along a random direction. ( D ) Change in IWL-test accuracy (zero reasoning steps) and ICL-test accuracy (eight reasoning steps) when each attention head is ablated alone, for every head of every network, shaded by layer; each network’s two context-reading heads are outlined. Lines and bars show means across 10 seeds; bands and error bars show ±1 SE; dots show individual seeds; dashed lines indicate chance (in D, no change).
Figure S7: Ablating context-reading heads during finetuning. ( A ) Accuracy on the ICL test and on the IWL test for networks finetuned with or without reasoning, and with reasoning but ablating two context-reading heads or two random heads. IWL accuracy is split by trained pairs, non-adjacent pairs with an end item, and interior non-adjacent pairs. Ablated networks were tested with the same heads ablated. ( B ) The same measures over finetuning. Accuracy is the best of 0–8 reasoning steps at test; the ICL test pools distances 2–6. Bars and lines show means across 10 seeds; bands and error bars show ±1 SE; dots show individual seeds; dashed lines indicate chance.
Figure S8: Ablation during finetuning across learning rates and proportions of uninformative context trials. As in Fig. S7 A, accuracy for each learning rate (rows) and proportion of finetuning trials with an uninformative context (columns). Bars show means across 3 seeds; error bars show ±1 SE; dashed lines indicate chance.
Figure S9: Learning over pretraining by skew. ( A , B ) Test performance varied with data diversity. IWL generalization performance emerges rapidly with high skew (high α ), while ICL-CoT generalization emerges when orderings are more diverse (low α ). Lines and bands show mean ±1 SE across 10 seeds; dashed lines indicate chance.
Figure S10: Additional data-distribution manipulations. ( A ) Final ICL and IWL test accuracy after pretraining on different numbers of equally frequent orderings; ICL accuracy is the best over different numbers of reasoning steps, and IWL uses no reasoning steps. Both are averaged over distances 2–6. ( B ) Direct IWL test accuracy after finetuning on different numbers of conflicting orderings over shared items vs orderings over disjoint sets of items. The point at one ordering is shared by both lines. Lines and bands show mean ±1 SE across 10 seeds; dashed lines indicate chance.
Figure S11: Chain-of-thought supervision improves sample efficiency. ( A ) ICL test learning curves for values p(CoT)=0,.1,…,1 , scored at the best reasoning budget within seed and distance. ( B ) The corresponding reasoning gap, computed within seed and training step as best-over-budget accuracy minus accuracy with no reasoning steps. Both panels average distances 2–6. Lines and bands show mean ±1 SE across 10 seeds; dashed lines indicate chance in A and zero gain in B.
Figure S12: Experiments without an explicit cue. ( A , B ) IWL- and ICL-test accuracy against ordering-frequency skew, with and without the cue, at p(CoT)=.9 . The dotted line in A is the IWL test accuracy of answering each pair by the frequency-weighted majority of the training orderings. ( C ) Direct accuracy by symbolic distance under four contexts, without the cue, at frequent-ordering proportion .2 and p(CoT)=.9 . ( D ) Congruent- and reversed-context accuracy at the same settings, taking the best accuracy up to each number of reasoning steps within seed and distance; darker lines indicate larger distances. Lines and bands show mean ±1 SE across 10 seeds; faint dots show individual seeds; dashed horizontal lines indicate chance.
Effect
Estimate
SE
95% CI
z
p
Fixed effects
Intercept
0.759
0.245
[0.279, 1.240]
3.10
.002
Symbolic distance
0.286
0.072
[0.145, 0.427]
3.97
< .001
Random effects (SD)
Intercept
1.183
Symbolic distance
0.287
Appendix
Table S2: Experiment 1: IWL test accuracy (log-odds).
Effect
Estimate
SE
95% CI
z
p
Fixed effects
Intercept
3.183
0.427
[2.345, 4.020]
7.45
< .001
Symbolic distance
− 0.387
0.069
[ − 0.521, − 0.253]
− 5.65
< .001
Random effects (SD)
Intercept
2.130
Symbolic distance
0.217
Appendix
Table S3: Experiment 1: ICL test accuracy (log-odds).
Effect
Estimate
SE
95% CI
z
p
Fixed effects
Intercept
3.250
0.447
[2.374, 4.127]
7.27
< .001
Symbolic distance
− 0.399
0.071
[ − 0.538, − 0.260]
− 5.63
< .001
Test (IWL)
− 2.488
0.468
[ − 3.405, − 1.572]
− 5.32
< .001
Symbolic distance × test (IWL)
0.685
0.107
[0.475, 0.895]
6.40
< .001
Random effects (SD)
Appendix
Table S4: Experiment 1: accuracy on both tests (log-odds). Test coded ICL = 0, IWL = 1; distance not centered.
Effect
Estimate
SE
95% CI
t
df
p
Fixed effects
Intercept
7.491
0.064
[7.361, 7.621]
116.61
39.68
< .001
Symbolic distance
− 0.009
0.012
[ − 0.033, 0.015]
− 0.78
38.26
.442
Random effects (SD)
Intercept
0.361
Symbolic distance
0.052
Appendix
Table S5: Experiment 1: IWL test response times (log ms).
Effect
Estimate
SE
95% CI
t
df
p
Fixed effects
Intercept
8.187
0.112
[7.960, 8.414]
73.14
36.17
< .001
Symbolic distance
0.211
0.017
[0.177, 0.245]
12.53
34.28
< .001
Random effects (SD)
Intercept
0.672
Symbolic distance
0.083
Appendix
Table S6: Experiment 1: ICL test response times (log ms).
Figure S13: Learning phase. ( A , B ) Accuracy and response time in 20-trial bins with the context shown or masked. ( C , D ) Accuracy and response time by intervening distractors on trials where context was shown, comparing early and late trials. Lines and bands show mean ±1 SE across participants; response-time points average participant medians. Dashed horizontal lines indicate chance.
Figure S14: Additional human symbolic-distance results. ( A ) Accuracy and ( B ) response time for each item pair on the IWL and ICL tests, grouped by symbolic distance. A–G denote ranks from highest to lowest. Points and error bars show mean ±1 SE across participants; response-time points average participant medians. The dashed line marks chance.
Figure S15: Individual participants in Experiment 1. Accuracy (top) and response time (bottom) by symbolic distance on the IWL and ICL tests for each participant, ordered from slowest to fastest median ICL test response time. Response-time points are medians over correct trials; bands show 68% confidence intervals (accuracy) and ±1 bootstrap SD (response time) over each participant’s trials. The dashed line marks chance.
Figure S16: Individual symbolic-distance slopes in Experiment 1. Each participant’s slope of ( A ) accuracy and ( B ) log response time (shown as percent change) against symbolic distance on the IWL and ICL tests. Shaded regions mark an SDE on the IWL test with a reverse SDE on the ICL test in A and response times increasing with distance on the ICL test in B . Error bars show ±1 bootstrap SD.
Figure S17: Human arbitrage test. ( A ) Proportions of responses following the trained ordering or the reversed ordering shown in context, by symbolic distance. ( B ) Response times split by response type. Lines and bands show mean ±1 SE across participants; response-time points average participant medians. ( C ) Individual differences in context-following proportions.
Figure S18: Experiment 2 results for participants who finished the task. ( A ) Accuracy and ( B ) response time by symbolic distance for participants who finished (49 congruent, 66 shuffled), including shuffled participants excluded from the main analysis for answering at chance. Lines and bands show mean ±1 SE across participants; dots show individual participants; response-time points average participant medians. The dashed line marks chance.
Figure S19: Agree and conflict questions. ( A ) Accuracy and ( B ) response time by symbolic distance in the congruent condition and on shuffled-condition questions whose queried relation agreed or conflicted with the real-world ordering. Lines and bands show mean ±1 SE across participants; response-time points average participant medians over correct answers. The dashed line marks chance.
Figure S20: Strategies and self-reports. ( A ) Judged proportion of true statements and ( B ) self-rated use of real-world knowledge, by condition. ( C ) Each participant’s median response time against their RT vs distance slope: the percent change in response time per unit of symbolic distance, 100(eb−1) , where b is the distance coefficient of a least-squares regression of log response time on symbolic distance and question number over the participant’s correct answers. ( D ) The same slope by answer in B; violins show the distribution, points show individual participants, and lines mark medians.
Figure S21: Individual participants in the congruent condition of Experiment 2. Accuracy (top) and response time (bottom) by symbolic distance for each participant, ordered from slowest to fastest median response time. Response-time points are medians over correct answers; bands show 68% confidence intervals (accuracy) and ±1 bootstrap SD (response time) over each participant’s questions. The dashed line marks chance.
Figure S22: Individual participants in the shuffled condition of Experiment 2. Accuracy (top) and response time (bottom) by symbolic distance for each participant, ordered from slowest to fastest median response time. Response-time points are medians over correct answers; bands show 68% confidence intervals (accuracy) and ±1 bootstrap SD (response time) over each participant’s questions. The dashed line marks chance.
Figure S23: LLM symbolic-distance results: Qwen3 models. Direct accuracy on the IWL and ICL tests, with one panel per model (row) and dimension (column). All plots use the innermost seven ranks of 11-item orderings. Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S24: LLM symbolic-distance results: DeepSeek, Phi, and gpt-oss models. Direct IWL and ICL test accuracy, formatted as in Fig. S23 . The ICL measurement repeats across columns. Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S25: LLM symbolic-distance results: Qwen2.5, GLM, Gemma, and Mistral models. Direct IWL and ICL test accuracy, formatted as in Fig. S23 . The ICL measurement repeats across columns. Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S26: LLM symbolic-distance results: Llama and OLMo models. Direct IWL and ICL test accuracy, formatted as in Fig. S23 . The ICL measurement repeats across columns. Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S27: LLM reasoning requirements: Qwen3 models. Smallest reasoning budget reaching 90% of each series’ maximum accuracy, by distance; zero denotes a direct answer. IWL estimates pool all available item sets per dimension; the ICL measurement repeats across columns. Crosses mark distances where accuracy was not reliably above chance at any tested budget (the 95% Wilson lower bound on maximum accuracy did not exceed .5), so no budget is reported. City population has only two IWL trials at distance six, so this criterion cannot be met even at perfect accuracy. Bands show ±1 bootstrap SE over trials, bounded by zero and 1,024 tokens.
Figure S28: LLM reasoning requirements: DeepSeek, Phi, and gpt-oss models. Budget estimates are defined as in Fig. S27 ; the ICL measurement repeats across columns. Bands show ±1 bootstrap SE over trials. Crosses mark distances where accuracy was not reliably above chance at any tested budget, so no budget could be estimated.
Figure S29: LLM reasoning requirements: Qwen2.5, GLM, Gemma, and Mistral models. Budget estimates are defined as in Fig. S27 ; the ICL measurement repeats across columns. Bands show ±1 bootstrap SE over trials. Crosses mark distances where accuracy was not reliably above chance at any tested budget, so no budget could be estimated.
Figure S30: LLM reasoning requirements: Llama and OLMo models. Budget estimates are defined as in Fig. S27 ; the ICL measurement repeats across columns. Bands show ±1 bootstrap SE over trials. Crosses mark distances where accuracy was not reliably above chance at any tested budget, so no budget could be estimated.
Figure S31: LLM ICL accuracy by reasoning budget. ICL accuracy by reasoning budget, with one panel per model. Models trained to reason are in the top two rows and instruction-tuned models prompted to reason are in the bottom two. Darker lines indicate larger symbolic distances (1–6). Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S32: LLM content effects: Qwen3 models. Direct accuracy by distance under the five context conditions. All four conditions with context use the instruction to rely only on the comparisons given; the no-context control uses the original instruction. Congruent, reversed, and shuffled trials are scored against the context ordering; the other conditions are scored against the real-world ordering. Bands show 68% confidence intervals over trials; dashed horizontal lines indicate chance.
Figure S33: LLM content effects: DeepSeek, Phi, and gpt-oss models. Direct accuracy under the five context conditions, with the instruction and scoring described in Fig. S32 . Bands show 68% confidence intervals over trials; dashed horizontal lines indicate chance.
Figure S34: LLM content effects: Qwen2.5, GLM, Gemma, and Mistral models. Direct accuracy under the five context conditions, with the instruction and scoring described in Fig. S32 . Bands show 68% confidence intervals over trials; dashed horizontal lines indicate chance.
Figure S35: LLM content effects: Llama and OLMo models. Direct accuracy under the five context conditions, with the instruction and scoring described in Fig. S32 . Bands show 68% confidence intervals over trials; dashed horizontal lines indicate chance.
Figure S36: Recovery with reasoning: Qwen3 models. Context-consistent accuracy on congruent and reversed trials by reasoning budget. Darker lines indicate larger symbolic distances (1–6). Zero denotes direct answers; positive budgets score prefixes of the same generated trace, up to 1,024 tokens. Lines show accuracy at each budget, without taking a running maximum. Each series contains 120 trials at distance one, decreasing to 20 at distance six. Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S37: Recovery with reasoning: DeepSeek, Phi, and gpt-oss models. Congruent- and reversed-context accuracy by reasoning budget, formatted as in Fig. S36 . Darker lines indicate larger distances. Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S38: Recovery with reasoning: Qwen2.5, GLM, Gemma, and Mistral models. Congruent- and reversed-context accuracy by reasoning budget, formatted as in Fig. S36 . Darker lines indicate larger distances. Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S39: Recovery with reasoning: Llama and OLMo models. Congruent- and reversed-context accuracy by reasoning budget, formatted as in Fig. S36 . Darker lines indicate larger distances. Bands show 68% confidence intervals over trials; dashed lines indicate chance.
Figure S40: LLM reasoning requirements under content conditions: Qwen3 models. Smallest reasoning budget reaching 90% of each series’ maximum accuracy, by distance, under congruent, reversed, and shuffled contexts; zero denotes a direct answer. Shuffled distances are measured in the ordering shown. Each series contains 120 trials at distance one, decreasing to 20 at distance six. Crosses mark distances where accuracy was not reliably above chance at any tested budget (the 95% Wilson lower bound on maximum accuracy did not exceed .5), so no budget is reported. Bands show ±1 bootstrap SE over trials, bounded by zero and 1,024 tokens.
Figure S41: LLM reasoning requirements under content conditions: DeepSeek, Phi, and gpt-oss models. Budget estimates are defined as in Fig. S40 . Bands show ±1 bootstrap SE over trials. Crosses mark distances where accuracy was not reliably above chance at any tested budget, so no budget could be estimated.
Figure S42: LLM reasoning requirements under content conditions: Qwen2.5, GLM, Gemma, and Mistral models. Budget estimates are defined as in Fig. S40 . Bands show ±1 bootstrap SE over trials. Crosses mark distances where accuracy was not reliably above chance at any tested budget, so no budget could be estimated.
Figure S43: LLM reasoning requirements under content conditions: Llama and OLMo models. Budget estimates are defined as in Fig. S40 . Bands show ±1 bootstrap SE over trials. Crosses mark distances where accuracy was not reliably above chance at any tested budget, so no budget could be estimated.
Figure S44: LLM mechanism results: Qwen3-32B. ( A ) Pairwise ordering accuracy of the rank direction on held-out items, by layer, for three different real-world dimensions. ( B ) Direct IWL test accuracy for US state population when the rank direction is intact, erased, or inverted, or a random direction is erased. ( C ) Agreement with another ordering written along the rank direction on reversed-context trials for US state population, answering directly or after 1,024 reasoning tokens; the control shows full-strength writes along a random direction. ( D , E ) The interventions of Fig. 4 C for country population and city population. Bands and error bars show ±1 binomial SE over trials; dashed lines indicate chance.
Figure S45: Composed inferences in LLM reasoning chains. Mean number of inferences that the reasoning chain had composed by each reasoning budget, on ( A , B ) the ICL test and ( C , D ) a reversed context (US state population), for Qwen3-32B (left) and Qwen2.5-32B-Instruct (right). Darker lines indicate larger symbolic distances (2–6; distance one requires no inference); dotted lines mark the number required at each distance. Bands show ±1 SE over trials.
A defining feature of human intelligence is the ability to adapt to changing environments by inferring latent task structure from sparse observations. Neuroscientific research indicates that this capability relies on the hippocampus constructing abstract representations, expressed as low-dimensional, approximately orthogonal manifolds in neural state space. However, the internal mechanisms of large language models (LLMs) remain largely opaque, making it unclear whether they form comparable abstract representations or instead rely on task-specific statistical regularities when performing comparable reasoning tasks. Here we adapt a contextual reversal-learning paradigm to a text-based setting and compare humans and LLMs at both the Behavioural and representational levels. We report that although LLMs exhibit generalizable reasoning less frequently than humans, when such inference occurs, their internal states exhibit abstract geometric structures that resemble those reported in the hippocampus. Notably, this representational geometry is not uniformly distributed but is organized hierarchically across model depth: whereas lower layers show early, stable encoding of stimulus identity, higher layers form a hippocampal-like functional band enriched for abstract context geometry associated with inference. Furthermore, complementary intervention experiments mechanistically implicate geometry in reasoning: task-sequence language modelling induces geometric disentanglement, whereas geometric regularization of higher layers increases the emergence of generalizable inference. Together, these findings establish abstract representational geometry as a mechanistic principle supporting inference in large language models.
Yunan Zeng, Yuwang Wang
College of Future Information Technology, Fudan University, Shanghai, 200433, China · Beijing National Research Center for Information Science and Technology, Tsinghua University, Beijing, 100084, China
Transitive inference is the challenge of inferring that A < C from knowing only adjacent relations (A < B, B < C). It is solved by humans and animals not through logical chaining but via an analogue mental number line, whose signature is the symbolic distance effect: distant comparisons are easier than nearby ones. We ask whether Transformers acquire the same primitive, training small models exclusively on adjacent comparisons from a hidden total order and evaluating generalization to unseen distant pairs. We find that out-of-distribution generalization emerges alongside a striking geometric reorganization: entity embeddings collapse onto a one-dimensional manifold whose principal axis recovers the hidden rank order with near-perfect fidelity, and this structure is sensitive to optimization in ways that produce grokking-like transient dynamics. Critically, even when accuracy is at ceiling, decision confidence and geometric separation both scale monotonically with rank distance, directly mirroring the symbolic distance effect observed across decades of behavioural experiments on humans, primates, and rodents. We further show the same rank-aligned geometry in a pretrained large language model, where it tracks the topology of each ordinal relation: linear for sizes and digits, cyclic for months. These results ground a 50-year-old behavioural regularity in the geometry of learned representations, offering a mechanistic account of transitive inference that bridges cognitive science and modern neural networks.
Nishit Singh
Birla Institute of Technology and Science, Pilani India
Grokking, the sudden transition from memorization to generalization, is characterized by the emergence of low-dimensional representations, yet the mechanism underlying this organization remains elusive. We propose that intrinsic task symmetries primarily drive grokking and shape the geometry of the model's representation space. We identify a consistent three-stage training dynamic underlying grokking: (i) memorization, (ii) symmetry acquisition, and (iii) geometric organization. We show that generalization emerges during the symmetry acquisition phase, after which representations reorganize into a structured, task-aligned geometry. We validate this symmetry-driven account across diverse algorithmic domains, including algebraic, structural, and relational reasoning tasks. Building on these findings, we introduce a symmetry-based diagnostic that anticipates the onset of generalization and propose strategies to accelerate it. Together, our results establish intrinsic symmetry as the key factor enabling neural networks to move beyond memorization and achieve robust algorithmic reasoning.