Numeric Magnitude Comparison Effects in Large Language Models (2023)

Abstract: Large Language Models (LLMs) do not differentially represent numbers, which are pervasive in text. In contrast, neuroscience research has identified distinct neural representations for numbers and words. In this work, we investigate how well popular LLMs capture the magnitudes of numbers (e.g., that 4<5) from a behavioral lens. Prior research on the representational capabilities of LLMs evaluates whether they show human-level performance, for instance, high overall accuracy on standard benchmarks. Here, we ask a different question, one inspired by cognitive science: How closely do the number representations of LLMscorrespond to those of human language users, who typically demonstrate the distance, size, and ratio effects? We depend on a linking hypothesis to map the similarities among the model embeddings of number words and digits to human response times. The results reveal surprisingly human-like representations across language models of different architectures, despite the absence of the neural circuitry that directly supports these representations in the human brain. This research shows the utility of understanding LLMs using behavioral benchmarks and points the way to future work on the number of representations of LLMs and their cognitive plausibility.

## introduction humans use symbols -number words such as "three" and digits such as "3" -to quantify the world. how humans understand these symbols has been the subject of cognitive science research for half a century. the dominant theory is that people understand number symbols by mapping them to mental representations, specifically magnitude representations @xcite . this is true for both number words (e.g., "three") and digits (e.g., "3"). these magnitude representations are organized as a "mental number line" (mnl), with numbers mapped to points on the line as shown in figure 1d . cognitive science research has revealed that this representation is present in the minds of young children @xcite and even nonhuman primates @xcite . most of this research has been conducted with numbers in the range 1-9, in part, because corpus studies have shown that 0 belongs to a different distribution @xcite and, in part, because larger numbers require parsing place-value notation @xcite , a cognitive process beyond the scope of the current study. evidence for this proposal comes from magnitude comparison tasks in which people are asked to compare two numbers (e.g., 3 vs. 7) and judge which one is greater (or lesser). humans have consistently exhibited three effects that suggest recruitment of magnitude representations to understand numbers: the distance effect, the size effect, and the ratio effect @xcite . we review the experimental evidence for these effects, shown in figure 1 , in llms. our behavioral benchmarking approach shifts the focus from what abilities llms have in an absolute sense to whether they successfully mimic human performance characteristics. this approach can help differentiate between human tendencies captured by models and the model behaviors due to training strategies. thus, the current study bridges between natural language processing (nlp), computational linguistics, and cognitive science. ## related work research on the numerical abilities of llms focuses on several aspects of mathematical reasoning @xcite , such as magnitude com-parison, numeration @xcite , arithmetic word problems @xcite , exact facts (lin et al., 2020), and measurement estimation @xcite . the goal is to improve performance on application-driven tasks that require numerical skills. research in this area typically attempts to (1) understand the numerical capabilities of pretrained models and (2) propose new architectures that improve numerical cognition abilities @xcite . our work also focuses on the first research direction: probing the numerical capabilities of pretrained models. prior research by @xcite judges the numerical reasoning of various contextual and non-contextual models using different tests (e.g., finding the maximum number in a list, finding the sum of two numbers from their word embeddings, decoding the original number from its embedding). these tasks have been presented as evaluation criteria for understanding the numerical capabilities of models. @xcite change model architectures to treat numbers as distinct from words. using perplexity score as a proxy for numerical abilities, they argue that this ability reduces model perplexity in neural machine translation tasks. other work focuses on finding numerical capabilities through building qa benchmarks for performing discrete reasoning @xcite . most research in this direction casts different tasks as proxies of numerical abilities of nlp systems @xcite @xcite @xcite . an alternative approach by @xcite tests multiple non-contextual task-agnostic embedding generation techniques to identify the failures in models' abilities to capture the magnitude and numeration effects of numbers. using a systematic foundation in cognitive science research, we build upon their work in two ways: we (1) use contextual embeddings spanning a wide variety of pre-training strategies, and (2) evaluate models by comparing their behavior to humans. our work looks at numbers in an abstract sense, and is relevant for the grounding problem studied in artificial intelligence and cognitive science @xcite . ## experimental design the literature lacks adequate experimental studies demonstrating magnitude representations of num-model category size base large bert @xcite encoder 110m 340m roberta @xcite encoder 125m 355m xlnet @xcite auto-regressive encoder 110m 340m gpt-2 @xcite auto-regressive decoder 117m 345m t5 @xcite encoder 110m 335m bart @xcite encoder-decoder 140m 406m ## conclusion this paper investigates the performance characteristics in various llms across numerous configurations, looking for three number-magnitude comparison effects: distance, size, and ratio. our results show that llms show human-like distance and ratio effects across number formats. the size effect is also observed among models for the digit number format, but not for the other number formats, showing that llms do not completely capture numeration. using mds to scale down the pairwise (dis)similarities between number representations produces varying correspondences between llms and the logarithmically compressed mnl of humans, with gpt-2 showing the highest correlation (using digits as inputs). our residual analysis exhibits high deviation from expected outputs for the numbers 2, 5, 9 which we explain through patterns observed in previous linguistics studies. the behavioral benchmarking of the numeric magnitude representations of llms presented here helps us understand the cognitive plausibility of the representations the models learn. our results show that llm pre-training allows models to approximately learn human-like behaviors for two out of the three magnitude effects without the need to posit explicit neural circuitry. future work on building pre-trained architectures to improve numerical cognition abilities should also be evaluated using these three effects.