Manuscript Offprint

arXiv:2611.00387

Geometric and algebraic inference in humans and neural networks

Jacob Russin, Joonhwa Kim, Ellie Pavlick, Michael J. Frank

Abstract

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.

1 Introduction

Windmills tend to be larger than toasters. You have probably never entertained that specific comparison, yet you know without much thought that it is true. If, on the other hand, you were told that Leo is taller than Max, Owen is taller than Zoe, and Max is taller than Owen, you might have to reason step by step to deduce that Leo is taller than Zoe.

These examples seem to rely on different underlying processes, but both can be understood as instances of transitive inference (TI), the derivation of an unseen relation (A≻C)(A \succ C) from learned ones (A≻B,B≻C)(A \succ B, B \succ C) via the transitive property. Such inferences are a textbook form of logical deduction, long considered a hallmark of rational thought (Inhelder & Piaget, 1958)—yet they are exhibited in a remarkably wide range of nonhuman animals, including pigeons (von Fersen et al., 1991), corvids (Paz-y-Miño C et al., 2004), rats (Davis, 1992; Dusek & Eichenbaum, 1997), and monkeys (D'Amato & Colombo, 1990; Gazes et al., 2012; Jensen et al., 2017). These behaviors may not require the kind of explicit logical deduction typically associated with human syllogistic reasoning, and may instead be explained by simpler processes, such as

Correspondence: jake_russin@brown.edu ones that rely on incrementally building up a continuum of ordered representations (Frank et al., 2005, 2003; Jensen et al., 2015; Vasconcelos, 2008; Wynne, 1995). However, no one doubts that humans can, at least under certain circumstances, perform logical deductions over completely novel relations (Dehaene et al., 2022; Johnson-Laird, 2010; Rips, 1994). Here, rather than asking which strategy underlies TI in general, we show that humans solve TI problems in two fundamentally distinct ways—one that relies on ordered internal representations and one that relies on step-by-step logical deduction—and provide a normative account of when each strategy should be used.

These debates are not specific to TI, but reflect a contrast between two longstanding perspectives on human cognitive flexibility (Fodor & Pylyshyn, 1988; McClelland et al., 2010; Sloman, 1996; Smolensky, 1988). The geometric view emphasizes that generalization is possible when experience is distilled into representations whose geometry mirrors the structure of a domain, allowing novel relations to be read directly from that geometry. This view is exemplified in work on neural geometry (Bernardi et al., 2020; Chung & Abbott, 2021; Kay et al., 2024; Nelli et al., 2023; Sorscher et al., 2022), cognitive maps (Behrens et al., 2018; Constantinescu et al., 2016; S. A. Park et al., 2020, 2026; Tolman, 1948; Whittington et al., 2020), distributional semantics (Boleda, 2020; Grand et al., 2022; Landauer & Dumais, 1997; Mikolov et al., 2013; Rogers & McClelland, 2004), and representation learning in neural networks more generally (Bengio et al., 2013; LeCun et al., 2015; Rumelhart et al., 1986). The algebraic view emphasizes that generalization is possible when knowledge is encoded as abstract, content-independent rules, allowing novel relations to be derived by systematically applying those rules step by step. This view has been emphasized in formal approaches to language (Chomsky, 1957; Pinker & Prince, 1988), rule-based or hypothesis-driven learning (Goodman et al., 2008; Kemp & Tenenbaum, 2008; Marcus, 2001; Marcus et al., 1999; Piantadosi et al., 2012; Tenenbaum & Griffiths, 2001; Tenenbaum et al., 2011), compositionality (Fodor & Pylyshyn, 1988; Russin, McGrath, & Williams, 2025), and in symbolic models of cognition more generally (Anderson et al., 2004; Dehaene et al., 2022; Fodor, 1975; Laird et al., 1987; Newell & Simon, 1972; Rips, 1994). Although these perspectives emerged from distinct research traditions and have historically been framed as rivals (Lake et al., 2017; McClelland et al., 2010; Pinker & Prince, 1988; Smolensky, 1988), we demonstrate that humans and neural networks can flexibly generalize in both ways on TI tasks, and characterize their unique computational advantages and when each is expressed.

Computational models of TI have generally realized one of these generalization strategies or the other, either building up ordered representations (Ciranka et al., 2022; Frank et al., 2003; Jensen et al., 2015; Kay et al., 2024; Miconi & Kay, 2025; von Fersen et al., 1991; Wynne, 1995) or executing a step-by-step reasoning process (Hummel & Holyoak, 2001; Kumaran & McClelland, 2012; Sternberg & Weil, 1980). Studying how the two strategies relate and interact, however, requires a single system capable of both. Although neural networks have typically been associated with the geometric strategy (Frank et al., 2003; Lippl et al., 2024; Noroozizadeh et al., 2026; Russin et al., 2021), recent models, including large language models (LLMs), exhibit both in-weight learning (IWL), in which weights change incrementally with experience, and in-context learning (ICL), an emergent ability to make inferences about novel premises provided in context, by re-routing activation dynamics rather than weights (Brown et al., 2020; Olsson et al., 2022). These two forms of learning have been shown to generalize differently (Anand et al., 2025; S. C. Y. Chan, Dasgupta, et al., 2022; Geerts et al., 2025; Lampinen et al., 2025; Lepori et al., 2026). Furthermore, modern neural networks can increasingly reason in context as well, producing chains of thought (CoTs) akin to step-by-step algebraic reasoning (Guo et al., 2025; Kojima et al., 2022; Nye et al., 2021; OpenAI, 2024; Wei et al., 2022). The distinction between IWL and ICL has parallels in human learning (Botvinick et al., 2019; Collins & Frank, 2012; Pesnot Lerousseau & Summerfield, 2026; Russin, Pavlick, & Frank, 2025): IWL is analogous to incremental synaptic plasticity supporting statistical learning in basal ganglia and hippocampus, whereas ICL is analogous to activation dynamics supporting working memory gating and hierarchical generalization in prefrontal cortex (Collins & Frank, 2013; O'Reilly & Frank, 2006; O'Reilly et al., 2022; Rougier et al., 2005; Russin, O'Reilly, & Bengio, 2020; Soni et al., 2026; Wang et al., 2018). Thus, modern neural networks may present an opportunity to study geometric and algebraic generalization in a system other than humans.

In this work we develop a theoretical framework that formalizes the distinction between geometric and algebraic generalization, and show that it makes testable predictions about learning, inference, and their underlying mechanisms in humans and neural networks. We derive our predictions formally, validate them in networks trained from scratch, and confirm them empirically in humans and LLMs evaluated on the same problems. Our framework unifies disparate phenomena from cognitive science, neuroscience, and machine learning, including symbolic distance effects (Moyer & Landauer, 1967; Potts, 1974), content effects (Evans et al., 1983; Lampinen et al., 2024), and data-distribution effects (S. C. Y. Chan, Santoro, et al., 2022; Reddy, 2024), showing that they can be grounded in a single set of principles. We also use mechanistic interventions to demonstrate that the two strategies rely on dissociable mechanisms in our neural networks, reproducing findings from analogous neural perturbations across species (Dusek & Eichenbaum, 1997; Frank et al., 2006; Waltz et al., 1999).

References (100)

Couldn't load all references. Reload the page to try again.