Ask a large language model what 847 times 93 is and you will get a number back, instantly, with complete confidence. Sometimes it is right. Ask it to multiply two twelve-digit numbers and you will also get a number back, instantly, with exactly the same confidence — and it will almost certainly be wrong. The confidence never changes, because nothing in the model knows the difference between the two requests.
That gap is worth understanding properly, because it determines where you can let a model calculate and where you have to stop it.
The short answer
An LLM does not perform arithmetic operations. There is no step in a forward pass where the model loads two values into registers and adds them. It generates the characters of an answer the same way it generates the words of a sentence — one token at a time, each one chosen because it is the most likely continuation of everything before it.
So when a model outputs 4 after 2 + 2 =, it is not computing. It is producing the token that overwhelmingly follows that sequence in the patterns it learned.
But the useful version of this answer has a second half, and most explanations skip it: the model is not doing lookup either.
It is not computation, and it is not memorisation
The easy story is that models memorise times tables. That story breaks immediately — models answer arithmetic questions correctly on number pairs that cannot plausibly have appeared in training, and they fail on pairs that certainly did.
Interpretability work on small transformers trained on arithmetic has found something more interesting. These models develop genuine internal structure for the task: representations that behave like positions on a circle, combined using relationships that amount to a trigonometric identity, producing the correct sum through something that really is an algorithm. Not the algorithm a person would write, and not one anybody designed — one the model found because it compresses the training data better than memorising would.
So a model has learned approximate arithmetic circuits. The word doing the work is approximate. These circuits were fitted to the distribution of numbers the model saw, they have no correctness guarantee, and they degrade in ways no real algorithm would.
Why arithmetic falls apart
Four separate things go wrong, and they compound.
| Cause | What it does | Shows up as |
|---|---|---|
| Tokenization | Numbers are split into chunks that do not align with digit positions | Errors that grow with digit count; wrong answers on numbers the model “should” handle |
| Fixed compute per token | Every token gets the same amount of processing, regardless of difficulty | Hard problems fail silently at the same speed easy ones succeed |
| No working memory | Nowhere to hold an intermediate result between steps | Multi-step problems collapse into a single guess |
| Carry chains | Each carry depends on the one before it — inherently serial | Accuracy drops sharply as operands get longer |
Tokenization: the model may not see the digits you see
A model never sees characters. It sees tokens — chunks of text mapped to numbers. For ordinary prose this is invisible. For numerals it is destructive.
Depending on the tokenizer, a number like 14072 might arrive as three pieces split in places that have nothing to do with place value: 140, 7, 2. The next number in the same sum might split completely differently. The model is then asked to add two quantities whose digits are not even positionally aligned in its input.
Human arithmetic works right to left, because that is the direction carries travel. Tokenizers chunk left to right, because that is how text is read. These two facts are in direct conflict, and it is a large part of why models are worse at arithmetic than their general capability would suggest. Some newer tokenizers split every digit separately or group them deliberately to help — an acknowledgement that the default behaviour was actively harmful.
The same mechanism explains the famous failures at counting letters in a word. The model is not being stupid. It is being asked about characters it cannot see, because the word reached it as two or three opaque chunks.
Fixed compute: the model cannot think harder
This one is structural and more fundamental than tokenization.
A transformer runs a fixed number of layers for every single token it produces. Adding two one-digit numbers and multiplying two twenty-digit numbers both get precisely the same amount of computation. There is no loop. There is no “this is hard, keep going.”
Long multiplication is inherently serial — you cannot compute the final digit without having computed the carries before it, in order. A fixed-depth network has a hard ceiling on how many sequential steps it can perform inside one forward pass. Past that ceiling, the model does not stop or flag uncertainty. It produces the best-shaped guess available and moves on.
That is the behaviour that makes LLM arithmetic dangerous rather than merely unreliable: the failure looks exactly like the success.
Chain of thought: borrowing compute from the context window
This explains why “show your working” helps so much, and it is not because the model becomes more careful.
When a model writes out intermediate steps, each step it writes becomes input to the next forward pass. The computation that could not fit inside one pass is now spread across dozens of them, and the partial results are stored somewhere real — the context window. The context becomes a scratchpad.
This converts a fixed-depth problem into a variable-length one. It genuinely raises the ceiling on what the model can compute, which is why chain-of-thought prompting produces large gains on arithmetic and multi-step problems and why models trained to reason at length do better still.
It does not make the arithmetic exact. Every individual step is still a prediction that can be wrong, and an error in step three propagates silently through steps four to twelve. Longer reasoning makes more problems reachable; it does not make any of them guaranteed.
| Approach | Where computation happens | Exact? | Typical failure |
|---|---|---|---|
| Direct answer | One forward pass | No | Confident wrong number, instantly |
| Chain of thought | Across many forward passes, via the context | No | One bad step silently corrupts the rest |
| Extended reasoning | Same, with far more steps | No | Same, but rarer and more expensive |
| Tool call | A real runtime outside the model | Yes | Model sets the problem up wrong |
Symbolic work is a different skill from numeric work
Models are frequently better at algebra than at arithmetic, which surprises people who assume symbolic manipulation is the harder task.
It makes sense once you see what each one requires. Differentiating an expression or rearranging an equation is pattern transformation — exactly what these models are built for, and the rules are short, local and heavily represented in training text. Multiplying six-digit numbers requires an exact serial procedure with no tolerance for a single wrong digit.
| Task | Model reliability | Why |
|---|---|---|
| Rearranging an equation | Reasonable | Local rule application, visible if wrong |
| Symbolic differentiation | Reasonable | Small, well-represented rule set |
| Setting up a word problem | Good | Language-to-structure translation — the native task |
| Small-number arithmetic | Usually fine | Within learned circuits |
| Long multiplication or division | Poor | Serial, exact, beyond fixed depth |
| Statistics over a dataset | Poor | Requires actually reading every value |
| Floating-point precision work | Unusable | No numeric representation at all |
What actually fixes it: stop asking the model to calculate
Every production system that needs correct numbers solves this the same way. The model does not compute the answer — it writes the code that computes the answer, and a real runtime executes it.
The division of labour is clean. The model handles the part it is genuinely good at: reading an ambiguous request and turning it into a precise, executable specification. The interpreter handles the part it is built for: running that specification exactly. A calculator function, a Python sandbox, a computer algebra system, a database query — the shape is identical.
This reframes the engineering problem. You are no longer trying to make a model better at arithmetic, which is roughly hopeless. You are making sure it reaches for the tool at the right moment and sets the problem up correctly. Those are tractable problems with ordinary solutions — clear tool descriptions, schemas that constrain the inputs, and validation on what comes back. If you are building that layer, the mechanics are covered in building tools for LLM agents.
The residual failure mode moves too, and it is worth naming: the model will now occasionally compute the wrong thing correctly. A sandbox cannot tell you that the formula it was handed does not answer the question that was asked.
Where models genuinely contribute to mathematics
None of this means models are useless at mathematical work. It means their contribution is upstream of the calculation.
- Translating problems into formal statements. Turning a vague description into a well-posed equation is a language task, and it is the step people most often get wrong themselves.
- Suggesting an approach. Recognising that a problem is a known type, and which method applies, draws on breadth rather than precision.
- Explaining a method. Walking through why a technique works, at the right level for the reader.
- Writing the code. The highest-value mathematical output of a model is usually a correct program, not a number.
- Proof search under a verifier. Paired with a formal proof assistant that mechanically checks each step, a model can propose candidate steps while the verifier discards the wrong ones. Systems built this way have reached genuinely hard competition problems — and the verifier is why.
That last pattern generalises. Checking an answer is usually far cheaper than producing one. Wherever you can build a cheap check, you can let a model generate freely and throw away what fails. Wherever you cannot, treat its numbers as a draft.
A practical rule
Ask what happens if the number is wrong.
If a wrong figure would be caught immediately by someone reading it, letting the model answer directly is fine. If a wrong figure would flow into a report, a bill, a configuration file or a decision without anyone checking it, route it to a tool. There is no middle ground where “the model is usually right” is a sufficient standard, because the cases where it is wrong look identical to the cases where it is right.
Key Takeaways
- An LLM generates the characters of a number; it does not execute an arithmetic operation.
- It is not memorising either — models learn real but approximate internal circuits for arithmetic, with no correctness guarantee.
- Tokenization splits numbers in places that break digit alignment, which is a major and underrated cause of errors.
- A transformer applies fixed compute per token, so it cannot run the variable-length serial steps that long arithmetic needs.
- Chain of thought helps by moving computation into the context window as a scratchpad — it raises the ceiling without making results exact.
- Models are often better at symbolic manipulation than at long arithmetic, because symbolic work is pattern transformation.
- The production answer is tool calling: the model writes the computation, a real runtime executes it.
- LLM arithmetic errors arrive with full confidence and no signal, which is what makes them dangerous rather than merely inconvenient.
Frequently Asked Questions (FAQ)
Q: Can an LLM do math?
It can produce mathematical answers, but it does not calculate them. It predicts the tokens that should follow, drawing on learned patterns that approximate arithmetic. For small numbers this usually lands on the right answer. For anything requiring exact multi-step computation, it is unreliable, and it gives no indication of when it has crossed that line.
Q: Why does an LLM get simple arithmetic wrong?
Usually tokenization. The model does not see individual digits — it sees chunks of text that may split a number in places unrelated to place value, leaving the digits of two operands misaligned before any addition is attempted. Beyond that, every token gets the same fixed amount of computation, so a hard sum receives no more processing than an easy one.
Q: Does chain of thought actually make a model better at math?
Yes, measurably. Writing out intermediate steps spreads the work across many forward passes instead of one and stores partial results in the context window, where the model can read them back. That lifts the ceiling on how much sequential computation it can perform. Each step is still a prediction, though, so an early error quietly corrupts everything downstream.
Q: Why can’t an LLM count the letters in a word?
Same cause as the arithmetic problem. The word reaches the model as one or two tokens, not as a sequence of characters, so it is being asked about something it cannot directly observe. It answers from patterns about the word rather than by inspecting it. Spacing the letters out, or having it write code to count them, both fix it.
Q: Do reasoning models solve this problem?
They improve it substantially without solving it. Generating many more intermediate tokens before answering buys more sequential computation, which is exactly what arithmetic needs. But the underlying mechanism is unchanged — it is still prediction, just more of it. Reasoning models reach harder problems and still produce confident wrong answers at the edge of their range.
Q: Why is an LLM better at algebra than at arithmetic?
Algebraic manipulation is rule-based pattern transformation over symbols, which is close to what the architecture does naturally, and the rules are short and heavily represented in text. Long arithmetic demands an exact serial procedure where one wrong digit invalidates the result. The second is a much worse fit for a fixed-depth predictive model than it looks.
Q: Should I let an LLM do calculations in production?
Not directly. Give it a calculator function, a code sandbox or a database query and let it decide what to compute rather than computing it. The model is good at turning a messy request into a precise specification; a runtime is good at executing one exactly. Keep those two jobs separate.
Q: What is the difference between an LLM and a calculator?
A calculator implements arithmetic and is correct by construction. An LLM has learned statistical patterns that often resemble arithmetic and is correct by coincidence of distribution. The practical difference is error behaviour: a calculator either works or visibly fails, while a model produces a plausible wrong answer in the same format and tone as a right one.
Q: If the model writes code to calculate, can I trust the result?
The execution, yes — the runtime is exact. What still needs checking is whether the code answers the question. A model can produce a flawlessly executed calculation of the wrong quantity, and nothing in the pipeline will flag it. Validate the setup, not just the output.
Related Reading: