Neural Nets and Math: Why LLMs Get Calculations Wrong
An LLM will confidently get the middle of a six-digit multiplication wrong: the edge digits are correct, the middle is invented. This is not a bug. A transformer predicts tokens from the statistics of its training data; it does not run an algorithm. Short arithmetic is "remembered" from the data, which contains millions of examples. Long numbers are improvised. The industry's answer is not to teach the model to calculate, but to give it tools: Python, a code interpreter, a calculator.
AI-processed from Habr AI; edited by Hamidun News
A neural network can get even simple math wrong, confidently returning an incorrect result when multiplying six-digit numbers: the digits at the edges are right, the error sits in the middle. This is not a bug or a flaw in one particular model. A transformer predicts tokens from statistics; it does not execute the long-multiplication algorithm.
Token vs. algorithm: what's the difference
Long multiplication is a procedure with place values, carries, intermediate sums and a strict order of operations. A processor executes it. A schoolchild executes it. A transformer, in a single pass, does not: it generates text that resembles a correct answer, drawing on the statistics of its training data.
Short arithmetic works as memory, not computation:
- The multiplication table appears in the training data millions of times
- The model does not calculate "7 × 8 = 56"; it remembers it
- With two- or three-digit numbers, there are still enough familiar patterns
- With six-digit numbers, there are almost no familiar examples, and the model starts to "plausibly continue"
- Confidence in the answer is unrelated to the accuracy of the result
Why does the error land in the middle of the number?
The outer digits of the result can be derived from the first and last digits of the factors, a pattern the model learns. The middle digits require a genuine chain of carries, which a transformer does not build in a single autoregressive pass.
The typical signature: the right edge (units, tens) and the left edge (highest places) are often correct, while the middle digits are made up. The model has no internal "I'm not sure" signal; the token predictor simply continues the sequence as plausibly as it can.
How the industry solves it
The solution came not from inside the architecture but from outside: tools. Code Interpreter in ChatGPT, Python blocks in Claude, calculator calls via function calling. The model delegates computation to something that knows how to compute.
"It does, and quite successfully, just not where it seems" — progress
lies not in teaching LLMs to calculate on their own, but in teaching them to call the right tool.
Chain-of-thought (explicitly writing out intermediate steps) helps partially: accuracy on multi-digit numbers rises. But every token in the chain is itself a prediction, so this technique does not deliver 100% reliability.
In parallel, research continues on specialized fine-tuning for math. Models trained mainly on scientific texts understand problems better. But they do not replace a calculator either: the value of such models lies in framing the problem correctly for the tool, not in counting on their own.
What this means
Expecting calculator-like behavior from an LLM is an architectural misunderstanding. The right pattern: the model understands the task, builds the logic, delegates the numbers to a tool and interprets the output. Trusting unit economics to a chat without tools means testing not the model but your luck.
Frequently asked questions
Why doesn't the model warn that it can't calculate?
A language model has no internal uncertainty signal when generating a number. It emits the next token with the highest probability, and it is equally confident whether the result is right or wrong. This is a fundamental property of autoregressive generation, not a coding error.
Does chain-of-thought help with complex arithmetic?
Yes, but only to a limited extent. Writing out the carries step by step improves accuracy because the model "sees" intermediate results as context for the next prediction. However, each step is still a prediction and errors accumulate, so critical calculations need an external tool.
Why does a neural network make mistakes in math?
A transformer predicts tokens from the statistics of its training data; it does not execute a mathematical algorithm the way a processor or a human does.
- Nov 1, 2026OpenAI Rewrites GPT Behavior Rules: Five Values and a Chain of Command
- Nov 1, 2026Google admits AI Mode cuts search revenue, shares fall 15%
- Oct 31, 2026Author puts his script before an AI jury: the verdict cost 850 thousand tokens
- Oct 31, 2026Anthropic: Fold Subagents Back Into a Single Loop — One Customer's Tasks Ran Twice as Fast
Key Questions Answered
Why does the error land in the middle of the number?
The outer digits of the result can be derived from the first and last digits of the factors, a pattern the model learns. The middle digits require a genuine chain of carries, which a transformer does not build in a single autoregressive pass. The typical signature: the right edge (units, tens) and the left edge (highest places) are often correct, while the middle digits are made up. The model has no internal "I'm not sure" signal; the token predictor simply continues the sequence as plausibly as it can.
Why doesn't the model warn that it can't calculate?
A language model has no internal uncertainty signal when generating a number. It emits the next token with the highest probability, and it is equally confident whether the result is right or wrong. This is a fundamental property of autoregressive generation, not a coding error.
Does chain-of-thought help with complex arithmetic?
Yes, but only to a limited extent. Writing out the carries step by step improves accuracy because the model "sees" intermediate results as context for the next prediction. However, each step is still a prediction and errors accumulate, so critical calculations need an external tool.
Why does a neural network make mistakes in math?
A transformer predicts tokens from the statistics of its training data; it does not execute a mathematical algorithm the way a processor or a human does.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.