Emergent Analogical Reasoning in Large Language Models — part 1/5
Cleaned-text code points [0, 15552). Bibliography omitted here; source.md includes it.
# Emergent Analogical Reasoning in Large Language Models 0 0 footnotetext: Published at Nature Human Behaviour (2023) https://doi.org/10.1038/s41562-023-01659-w
###### Abstract
The recent advent of large language models has reinvigorated debate over whether human cognitive capacities might emerge in such generic models given sufficient training data. Of particular interest is the ability of these models to reason about novel problems zero-shot , without any direct training. In human cognition, this capacity is closely tied to an ability to reason by analogy. Here, we performed a direct comparison between human reasoners and a large language model (the text-davinci-003 variant of GPT-3) on a range of analogical tasks, including a non-visual matrix reasoning task based on the rule structure of Raven’s Standard Progressive Matrices. We found that GPT-3 displayed a surprisingly strong capacity for abstract pattern induction, matching or even surpassing human capabilities in most settings; preliminary tests of GPT-4 indicated even better performance. Our results indicate that large language models such as GPT-3 have acquired an emergent ability to find zero-shot solutions to a broad range of analogy problems.
## 1 Introduction
Analogical reasoning is at the heart of human intelligence and creativity. When confronted with an unfamiliar problem, human reasoners can often identify a reasonable solution through a process of structured comparison to a more familiar situation [ 1 ] . This process is an essential part of human reasoning in domains ranging from everyday problem-solving [ 2 ] to creative thought and scientific innovation [ 3 ] . Indeed, tests of analogical reasoning ability are uniquely effective as measures of fluid intelligence: the capacity to reason about novel problems [ 4 , 5 ] .
Recently, there has been considerable debate about whether and how a capacity for analogical thought might be captured in deep learning systems [ 6 ] . Much of this recent work has focused on training neural networks on very large datasets (sometimes containing millions of problems) [ 7 , 8 ] . Though this is a challenging task that has spurred the development of some interesting approaches [ 9 , 10 , 11 , 12 ] , it does not address the issue of whether analogical reasoning can emerge zero-shot (i.e., without direct training), the capacity most central to human thought.
An alternative approach, also based on deep learning, involves large language models (LLMs) [ 13 ] . LLMs have recently sparked great interest (and controversy) for their potential to perform few-shot, and even zero-shot, reasoning. These models employ relatively generic neural network architectures with up to billions of parameters, and are trained using a simple predictive objective (predicting the next token in a sequence of text) with massive web-based text corpora consisting of billions of tokens. Though there is significant debate about the capabilities of these models [ 14 ] , a potential advantage is their ability to solve problems with little direct training, sometimes requiring only a few examples, or even a simple task instruction (typically without any updating of model parameters). This feature raises the question of whether LLMs might be capable of human-like, zero-shot analogical reasoning.
To answer this question, we evaluated the language model GPT-3 [ 13 ] on a range of zero-shot analogy tasks, and performed direct comparisons with human behavior. These tasks included a novel text-based matrix reasoning task based on the rule structure of Raven’s Standard Progressive Matrices (SPM) [ 15 ] , a visual analogy problem set commonly viewed as one of the best measures of fluid intelligence [ 5 ] . Unlike the original visual SPM problems, our Digit Matrices task was purely text-based so that it could be used to evaluate GPT-3’s ability to induce abstract rules (though not the ability to do so directly from visual inputs). Strikingly, we found that GPT-3 performed as well or better than college students in most conditions, despite receiving no direct training on this task. GPT-3 also displayed strong zero-shot performance on letter string analogies [ 16 ] , four-term verbal analogies [ 19 , 20 , 17 , 21 ] , and identification of analogies between stories [ 22 , 23 , 18 ] . These results add to the growing body of work characterizing the emergent capabilities of LLMs [ 24 , 25 , 26 , 27 , 28 ] , and suggest that the most sophisticated LLMs may already possess an emergent capacity to reason by analogy.
## 2 Results
We evaluated the language model GPT-3 on a set of analogy tasks, and compared its performance to human behavior. GPT-3 is a large-scale (175B parameters), transformer-based [ 29 ] language model developed by OpenAI [ 13 ] . The original base model was trained on a web-based corpus of natural language consisting of over 400 billion tokens, using a training objective based on next-token prediction (given a string of text, the model is trained to predict the token most likely appear next). A number of variants on this base model have since been developed by fine-tuning it in various ways. These include training the model to generate code [ 30 ] , and training it to respond appropriately to human prompts, using either supervised learning or reinforcement learning from human feedback (RLHF) [ 31 ] . Our evaluation focused on the most recent model variant, text-davinci-003 (here referred to simply as ‘GPT-3’), which was the first to incorporate RLHF (along with the concurrently released, but distinct, ChatGPT model). We found that text-davinci-003 displayed particularly strong performance on our analogy tasks, but earlier model variants also performed well in some task settings, suggesting that multiple factors contributed to text-davinci-003’s analogical capabilities (Supplementary Figures 1 - 3 ). See Section S2 for further discussion.
Our evaluation featured four separate task domains, each designed to probe different aspects of analogical reasoning: 1) text-based matrix reasoning problems, 2) letter-string analogies, 3) four-term verbal analogies, and 4) story analogies. For each task domain, we performed a direct comparison with human behavior, assessing both overall performance and error patterns across a range of conditions relevant to human analogical reasoning. Figure 1 shows a summary of these results. We also performed a qualitative analysis of GPT-3’s ability to use analogical reasoning to solve problems.
a
b
c
d
e
f
g
a
b
c
d
e
### 2.1 Matrix reasoning problems
We designed a text-based matrix reasoning task, the Digit Matrices, to emulate the structure of Raven’s Standard Progressive Matrices (SPM) [ 15 ] . The task is illustrated in Figure 2 . The dataset was structured similarly to the work of Matzen et al. [ 32 ] , who created, and behaviorally validated, a visual matrix reasoning dataset with the same rule structure as the original SPM. The Digit Matrices dataset thus has a similar rule structure to SPM, but is guaranteed to be novel for both humans and LLMs.
Digit Matrix problems consisted of either digit transformations (Figures 2(b) - 2(e) ) or logic problems (Figures 2(f) - 2(g) ). Transformation problems were defined based on a set of three rule types – constant (Figure 2(c) ), distribution-of-3 (Figure 2(d) ), and progression (Figure 2(e) ) – and consisted of one or more rules per problem. When multiple rules were present (Figure 2(b) ), each rule was bound to a different spatial location within each cell (e.g., one rule was bound to the left digit in each cell, and another rule was bound to the right digit). Logic problems were defined based on set relations – OR , AND , and XOR – and involved only a single rule per problem. In some logic problems, the corresponding elements were spatially aligned (Figure 2(f) ), whereas in others they were permuted (Figure 2(g) ). We hypothesized that spatial alignment would be beneficial when solving the problems via analogical mapping, as it should highlight the isomorphism [ 33 ] . Digit Matrices problems were presented to GPT-3 without any prompt or in-context task examples.
Figure 3 shows zero-shot performance on the Digit Matrices problems for GPT-3 and human participants (N=40, UCLA undergraduates). GPT-3 surpassed the average level of human performance on all problem types, both when generating answers directly (Figure 3(a) ; logistic regression, main effect of GPT-3 vs. human participants: odds ratio (OR) = 1.88 =1.88 , p = 0.005 p=0.005 , 95% confidence intervals (CI) = [ 1.21 , 2.91 ] =[1.21,2.91] ), and when selecting from a set of answer choices (Figure 3(b) ; main effect of GPT-3 vs. human participants: OR = 6.27 =6.27 , p = 2.3 × 10 − 8 p=2.3\times 10^{-8} , CI = [ 3.28 , 11.99 ] =[3.28,11.99] ). It is worth emphasizing, however, that participants displayed a range of performance levels on this task, with some participants outperforming GPT-3 (indeed, the best participant answered every problem correctly).
In addition to showing strong overall performance, GPT-3’s pattern of performance across problem subtypes was similar to that observed in human participants (correlation analysis: r ( 30 ) = 0.39 r(30)=0.39 , p = 0.027 p=0.027 ). This correlation was driven both by the pattern of performance across major problem types (one-, two-, three-rule, and logic problems; main effect of problem type on generative accuracy: OR = 0.5 =0.5 , p = 2 × 10 − 16 p=2\times 10^{-16} , CI = [ 0.44 , 0.56 ] =[0.44,0.56] ,; main effect of problem type on multiple-choice accuracy: OR = 0.56 =0.56 , p = 2 × 10 − 16 p=2\times 10^{-16} , CI = [ 0.5 , 0.64 ] =[0.5,0.64] ), and by differences within each problem type. Problems with progression rules were more difficult than those without them (Figure 3(c) ; main effect of progression vs. no progression, human participants: OR = 0.41 =0.41 , p = 0.0001 p=0.0001 , CI = [ 0.24 , 0.69 ] =[0.24,0.69] ; GPT-3: OR = 0.07 =0.07 , p = 1.9 × 10 − 5 p=1.9\times 10^{-5} , CI = [ 0.02 , 0.24 ] =[0.02,0.24] ); for multi-rule problems, performance was negatively correlated with the number of unique rules in each problem, even when holding constant the number of total rules (Figure 3(d) ; main effect of number of unique rules, human participants: OR = 0.61 =0.61 , p = 0.0047 p=0.0047 , CI = [ 0.44 , 0.86 ] =[0.44,0.86] ; GPT-3: OR = 0.25 =0.25 , p = 3 × 10 − 10 p=3\times 10^{-10} , CI = [ 0.17 , 0.39 ] =[0.17,0.39] ); and logic problems were more difficult when the corresponding elements were spatially permuted vs. aligned (Figure 3(e) ; main effect of spatial alignment, human participants: OR = 0.52 =0.52 , p = 0.0017 p=0.0017 , CI = [ 0.35 , 0.79 ] =[0.35,0.79] ; GPT-3: OR = 0.06 =0.06 , p = 2 × 10 − 11 p=2\times 10^{-11} , CI = [ 0.03 , 0.14 ] =[0.03,0.14] ). These effects replicate well-known characteristics of human analogical reasoning: problems defined by relations (e.g., progression) are typically more difficult than problems defined by the features of individual entities (e.g., constant or distribution-of-3) [ 34 , 32 ] ; problem difficulty is typically driven by the degree of relational complexity, as defined by the number of unique relations [ 35 ] ; and analogical mapping is easier when a greater number of constraints supports the correct mapping (as is the case in the spatially aligned logic problems) [ 33 ] . GPT-3’s pattern of performance thus displayed many of the characteristics of a human-like analogical mapping process. We also found that GPT-3 was sensitive to contextual information in ways that both improved and impaired its performance, similar to human reasoners (Supplementary Figure 4 ).
a
b
c
d
e
It is important to highlight the differences between the Digit Matrices and traditional visual matrix reasoning problems. In order to solve visual matrix reasoning problems, pixel-level inputs must be parsed into objects, and visual attributes (shape, size, etc.) must be disentangled. In the Digit Matrices, the text-based inputs are already parsed and disentangled, essentially providing GPT-3 (which is not capable of visual processing) with pseudo-symbolic inputs. Interestingly, despite these significant differences, we found that overall error rates for human participants were very similar for the Digit Matrices vs. the original image-based SPM problem set, and showed a similar pattern across problem types (Figure 4 ). These results suggest that, while the Digit Matrices do not engage the visual processes involved in traditional SPM problems (i.e., deriving disentangled representations from pixel-level inputs), they likely engage a similar set of core reasoning processes (i.e., inducing abstract rules from those representations). More generally, performance on verbal, visuospatial, and mathematical analogy problems are known to be highly correlated for people [ 5 ] . Accordingly, GPT-3’s success on the Digit Matrices can be taken as evidence that it has acquired core capabilities underlying analogy, though it will be important in future work to investigate how these reasoning processes might be integrated with visual processing.
### 2.2 Letter string analogies
A central feature of human analogical reasoning is its flexibility. Human reasoners are capable of identifying abstract similarities between situations even when these situations are superficially quite different. Often this involves a process of re-representation , in which an initial problem representation is revised so as to facilitate the discovery of an analogy [ 36 , 37 , 38 ] .
a
b
c
d
Hofstadter and Mitchell [ 16 , 39 ] introduced the letter string analogy domain to evaluate computational models of analogical reasoning, with a particular emphasis on the process of re-representation. The basic problem structure is illustrated in Figure 5(a) . In this example, the source string ‘a b c d’ has been transformed by converting the final letter to its successor, resulting in the string ‘a b c e’. This transformation must be identified, and then applied to the target string ‘i j k l’, yielding the answer ‘i j k m’.
Though this example is simple, letter string problems can be made quite complex by introducing various generalizations between the source and target strings. For instance, the target may involve groups of letters rather than individual letters (e.g., ‘i i j j k k l l’), or may involve a sequence with a reversed order relative to the source (e.g., ‘l k j i’). In these cases, the transformation identified in the source (e.g., a successor transformation applied to the final letter in the sequence) must be generalized to an analogous transformation (e.g., a successor transformation applied to the final group of letters , or a predecessor transformation applied to the first letter). This feature makes letter string analogy problems well-suited to test the capacity for re-representation.
To evaluate GPT-3, we created a novel letter string problem set (Figure 5 ), and carried out a systematic comparison with human participants (N=57, UCLA undergraduates). The problem set involved a range of different transformation (Figure 5(d) ) and generalization types (Figure 5(e) ). Each transformation type could be combined with any generalization type, and multiple generalization types could be combined together to yield more challenging problems (Figure 5(b) ). Problems were presented to GPT-3 along with a prompt (‘Let’s try to complete the pattern:’), using a format similar to the Digit Matrices.