Numbers don’t lie — but AI might
Understanding and eliminating hallucinated AI calculations.
Marín Jónsdóttir27 March 2025 · 3 min readLarge language models (LLMs) sometimes generate information that sounds convincing, but is completely made-up or incorrect. In AI terms, this is called a hallucination. An LLM might confidently state a fact or number that has no basis in reality — without any indication of the answer being made up. This can make it hard for users to realize when they’re reading (or worse, trusting) incorrect information. Businesses need to be aware of this risk when they‘re relying on factual details or calculations in their AI projects: Just because an LLM’s answer is detailed and confident, that doesn’t guarantee it’s accurate. This is especially true when it comes to numbers, calculations and spreadsheet logic — areas where LLMs are notoriously unreliable.
How common are these hallucinations?
Studies show that when LLMs like GPT-4o and Claude-3.5 are asked short, factual-based questions (pub quiz style), they can hallucinate up to 60% of their answers. On the other hand, when the models are given a task with context, for example summarizing a document, GPT-4o only hallucinated 1.5% of the output. This shows that giving an LLM relevant context to work from can greatly reduce the risk of hallucinations, though it does not eliminate hallucinations entirely.
The research mentioned focuses purely on text — but what about numbers? A study found that modern LLMs fail frequently on many basic numerical problems, reasoning through a math problem but then confidently outputting an incorrect result. The study showed that for easy cases, like adding two small numbers together, the models provided correct results with near 100% accuracy. As soon as the tasks became slightly more complex, with larger numbers and decimals for example, accuracy quickly decreased and the vast majority of answers were hallucinated results.
Text vs. numbers
The thing is: we might be asking too much of a language model. At their core, LLMs predict linguistic patterns. The fundamental operation of GPT models such as those running on ChatGPT and Claude can — as this study elegantly puts it — be distilled down to answering a single question:
Given a sequence of words, what word is likely to come next?
Why should an LLM excel in calculations, given how they’re built?
It’s clear that providing context significantly reduces the risk of hallucinations in text-based answers from LLMs. If you’re working on a AI project, you’ve probably implemented contextual grounding and made good progress on keeping hallucinations at bay. But what about numbers? Calculations play a critical role across various industries — whether you’re involved in finance, insurance, e-commerce or SaaS, numbers are integral to your daily operations. However, relying solely on an LLM means that including calculations in your AI projects is off the table. Fortunately, modern LLMs support function calls or tool integrations, enabling them to leverage external tools. At GRID, we’ve made it possible to integrate our spreadsheet engine to LLMs, unlocking the possibility for LLMs to offer reliable calculations — something that’s not possible without GRID today.

By leaving the language to the language models, and the calculations to a spreadsheet engine, you reduce the risk of hallucinations drastically.
How can the calculations be trusted?
When using GRID’s spreadsheet engine in your AI projects, there are two key things to get right to ensure your calculations are reliable:
The calculations you’re asking for exist in a spreadsheet.
In your prompt, make sure the LLM never answers without asking the spreadsheet for the calculations — meaning, the LLM doesn’t attempt to calculate itself.
If you ensure that these two things are in place, you can trust the calculated output the LLM provides. The good thing is, while you’re testing the integration, you can always verify that the calculations are correct by going back to your spreadsheet.
But wait — can’t LLMs calculate using code?
If you’re an engineer (or someone that can write and understand code) and you’re building your AI project from scratch, coding the calculations is also an option. Instead of relying on the LLM’s internal math reasoning, developers can prompt the LLM to create executable code, and then run these calculations through an external computational environment to ensure accuracy.
For those that are not in a position to write the calculations in code, using a spreadsheet instead is now an option thanks to GRID. If the calculations you want to integrate to your AI project are complex, or you already have a spreadsheet with your calculations, GRID is the answer.

With GRID, you can turn your spreadsheets to RESTful APIs and integrate them to your AI projects. There’s no need to leave out calculations in your AI projects because LLMs can’t calculate — you just have to use the right tools to make sure your calculations are reliable and verifiable.
Is your team building AI products? We’d love to hear from you at [email protected] 👋🏻
News
Updates and announcements
27.11.2026
The Python was right. The spreadsheet was wrong.
On 400 spreadsheet tasks, the agent without an engine scored 78% and the agent with GRID scored 90.75%. When we required formulas where the reference workbook had formulas, the same workbooks scored 54.25% without an engine and 87% with GRID.
19.11.2026
How AI builds a spreadsheet: openpyxl, then 430 MB of LibreOffice
In September, Simon Willison went poking around his disk and found 1.7 GB of runtime inside OpenAI's Codex desktop app, since renamed ChatGPT. Next to Python, Node and git sat a complete headless LibreOffice: 430 MB of office suite, shipped so the agent can work with documents. This did not surprise us. We have watched this pipeline since the first AI spreadsheet experiments, and it is still how most of the industry builds spreadsheets with AI. It made sense as a stopgap. It doesn't anymore: next to an engine built for the job, it is less accurate, far slower and more than a hundred times bigger. The recipe Ask an AI agent for an Excel model and it will almost always write the file with openpyxl, the Python library all over its training data. openpyxl writes formulas but cannot calculate them, so the formula cells hold no values. Anything that reads the stored values sees blanks: the Python data library pandas, file previews, and the agent itself, checking its own work. And the model writes formulas the way a person types them, not the way Excel stores them. Leave out the _xlfn. prefix Excel expects on XLOOKUP inside the file and the cell opens in Excel as #NAME?. Write a LET without its _xlpm. prefixes, or a spill reference like A1#, and Excel greets the whole file with "We found a problem with some content". So the pipeline needs something to calculate the file, and the answer is nearly always LibreOffice. Anthropic's public xlsx skill runs LibreOffice to recalculate the workbook. Alibaba's QwenPaw agent ships an adapted copy of the same script. Moonshot's Kimi checks its files against LibreOffice's recalculation, according to an extracted copy of its skills. OpenAI bundles the whole suite into its desktop app. LibreOffice is free, it is already there, and it opens xlsx. None of that means it calculates like Excel. So how close does it get? Missing one case in eight Last week we published the GRID Spreadsheet Benchmark: over 100,000 test cases from eight open source test suites, 13 engines, every case checked against Excel itself. LibreOffice matches Excel on 87.4% of them. That sounds respectable, and LibreOffice Calc is a good spreadsheet app. The test is deliberately hard: it is built from edge cases, not the SUMs that fill most of a real model. But edge cases are where a model goes quietly wrong, matching Excel on them is a high bar, and the last few percent are where the hard work is. 87.4% is 126 misses in every 1,000 cases. The GRID engine gets 1.2 wrong. LibreOffice isn't sloppy. It is a different spreadsheet app with its own opinions. On its own project's test suite it agrees with Excel only about 84% of the time, because many of those tests expect LibreOffice's answer: it converts units Excel has never heard of, and it finds interest rates where Excel gives up with #NUM!. Of the nearly 500 Excel functions in the benchmark, only 16 pass every test in LibreOffice. In GRID, 439 do. Then the tool starts dictating the spreadsheet. Anthropic's skill tells the model to never use XLOOKUP, XMATCH, SORT, FILTER, UNIQUE or SEQUENCE, saying the LibreOffice it runs can't evaluate them. LibreOffice has handled them since 2024, but the rule stands: the agent builds an older, worse spreadsheet to suit its calculator. "We found a problem with some content" In most of these pipelines, when LibreOffice recalculates a file, it also saves it, and it saves it the way LibreOffice understands it. Usually the file still opens in Excel. Sometimes it doesn't. Take the sensitivity table, a fixture of every financial model: a what-if data table showing, say, the implied share price under different WACC and terminal growth assumptions. Put a workbook with one through a pipeline that saves through LibreOffice, like QwenPaw's, open it in Excel, and you get "We found a problem with some content". LibreOffice has written the table back as a formula Excel doesn't have. Click Yes, and Excel repairs the file by turning every cell of the table into a fixed number. The numbers are right for today's inputs. Change the WACC and nothing moves. The model still looks finished. It just stopped being a model. Anthropic's skill was recently changed to recalculate on a copy and write only the values back into the file. That is a sensible patch, and an admission that LibreOffice can't be trusted to save the file. It is still trusted to calculate it, and to tell the agent the file is fine. That trust is misplaced too, because LibreOffice waves through problems it didn't cause. Ask an agent for a table with years as column headings, 2025 and 2026, as in nearly every financial model. openpyxl writes the headings as numbers, and Excel requires table headings to be text. Name a table Q1 and it is the same story, since Excel reads that as a cell address. LibreOffice opens these files, recalculates them without complaint and saves them. The agent's check passes. Excel opens the file with "We found a problem with some content". 430 MB and a second and a half Even when it gets the answer right, LibreOffice is the wrong shape for the job. Every check boots a desktop office suite in headless mode, loads the file, calculates, and writes the file back. On nearly 1,800 benchmark workbooks, run on the same machine, that took a median of 1.6 seconds per workbook. The GRID engine took 18 milliseconds, and it doesn't need to save: it holds the workbook in memory and writes the file once, when the agent is done. These are small workbooks, so most of that time is LibreOffice starting up, and today's agent skills pay it on every check. Anthropic's starts it twice. The obvious fix is to keep it running. In a separate test it still took about 80 milliseconds per workbook, and now the client keeps an office suite running in the background whenever a spreadsheet might come up in any thread. Then there is the weight. ChatGPT's headless LibreOffice is 430 MB. The GRID engine is a 3.5 MB package that runs in process, in Node or in the browser. The embedded LibreOffice may actually be doing other jobs too, like rendering documents and converting them to PDF. But those jobs have lighter tools as well. SuperDoc builds, edits and renders Word documents in the browser: an engine for DOCX, the way GRID's is for XLSX. A couple of small JavaScript libraries turn DOCX into PDF without a desktop suite. However you slice it, 430 MB of LibreOffice in a client is a kludge. Calculate it right AI is about to write more spreadsheets than people ever did. Those files will be opened in Excel, sent to clients and used for decisions, and Excel is where the numbers are checked. If an agent's model shows one figure and the same file shows another in Excel, the user doesn't conclude that LibreOffice and Excel differ on a corner case. They conclude the AI got it wrong. They start rechecking every number, and they stop trusting the next model before they open it. One wrong cell is enough to spend the trust that was supposed to save them the work. The GRID engine calculates the way Excel does, in milliseconds, without an office suite attached. The benchmark and its harness are open, so check the numbers. If you build agents that write spreadsheets, talk to us.