Back to articles

Myths and limits

Why does AI get simple arithmetic wrong?

How text is split before the model reads it, and why that changes the sum.

A model that writes a coherent legal memo can still get the sum of two large numbers wrong. Part of the explanation happens before the model "reads" anything.

Phenomenon

You ask for the sum of two numbers with many digits and the answer comes back fluent, confident, and wrong in one or two digits. The error is often in the middle of the number, not in the shape of the answer.

Mechanism

The text you type does not enter the model as characters. Anthropic's glossary explains that text is encoded as a sequence of tokens, which can correspond to words, subwords, characters, or even bytes. The model processes tokens, not loose letters or digits. That matters for numbers because the way a number is split into tokens varies. Singh and Strouse (2024) published the first study of how number-tokenization choices affect arithmetic. According to the paper, models such as LLaMa and PaLM use one token per digit, while GPT-3.5 and GPT-4 have separate tokens for 1-digit, 2-digit, and 3-digit numbers. The authors showed that forcing a right-to-left split, by separating numbers with commas in the input (for example, 1,234,567), substantially improved GPT-3.5 and GPT-4 on addition. They attribute the gain to alignment between the tokens of the addends and the token of the answer.

What this does not prove

It does not prove that tokenization is the only cause of arithmetic error. The study measured addition, on specific models of that time (the March 2023 models, according to the caption of the main figure), and it does not guarantee that current models behave the same way. It also does not prove that the comma fixes the problem in general: it helped in the conditions they tested. And it says nothing about operations other than the ones they studied.

A check you can run

Reproduce the idea at a small scale, with the model you use. 1. Choose 20 sums of two numbers with 6 to 8 digits. Compute the right result with a calculator or a line of code, never with the AI itself. 2. Ask for the 20 sums with the numbers written without a separator, one request per conversation. 3. Ask for the same 20 with the numbers grouped in threes and separated by commas, as in 1,234,567. 4. Count the correct answers in each group. If the difference is small or absent, that is also a result: your model may tokenize or reason differently. With 20 cases, treat the result as a clue, not as proof. Sources: Singh and Strouse, Tokenization counts: the impact of tokenization on arithmetic in frontier LLMs, 2024: https://arxiv.org/abs/2402.14903 (opens in a new tab) Anthropic, Glossary (Tokens): https://platform.claude.com/docs/en/about-claude/glossary (opens in a new tab)

Comments

Loading comments…