Insights / Ratio
The model never does the math
A short architectural rule that makes AI adoption boring in the best way: language models decide what to do, code computes the numbers, the database holds the truth. Why the split matters and what it looks like in practice.
Two different kinds of work
Reading "sold five kilos to Café Norte, paid in pesos" and understanding what it means is language work. Language models are extraordinary at it. Computing the margin on that sale after the supplier's cost in dollars, the day's exchange rate and a category floor is arithmetic with rules. Language models are unreliable at it, and worse, they are unreliable in ways that look confident.
Most disappointing AI projects mixed the two. The model was asked to read the message and produce the total, and the total was right 97% of the time. In a business, 97% right on money is a system nobody can trust, so nobody uses it.
The split
- Model
- Intent and extraction. What is being asked, which objects are involved, which tool to call. Natural language in, structured request out.
- Code
- Every number. Prices, margins, FX, balances, days of stock, dates. Written once, versioned, covered by tests, run the same way every time.
- Database
- The facts and the results. What was sold, what was paid, what the rule produced. One place, constrained, audited.
When the founder asks the agent "margin on Café Norte this month", the model recognizes the question and calls margin(customer, period). The function reads the database and returns the figure. The model formats the sentence. It never saw the arithmetic, so it cannot get it wrong.
Two examples
Sell price with a cost floor. A distributor sells from supplier lists that change weekly. The rule: sell = best current cost × category markup, never below cost plus 4%, and an expired cost cannot be quoted. That is twenty lines of code with a dozen tests. Asked in the chat, the agent calls it; shown on the board, the dashboard reads the stored result. Same number, everywhere, and when the markup changes it changes once.
Exchange difference apart from profit. A sale in pesos collected two weeks later, with a purchase in dollars. Was the business profitable, or did the currency move? The rule that separates the two is not something you want a model to improvise per message. It is a function with a test that says: at these rates, this is margin and this is FX.
What it buys you
- Trust. The team stops checking the agent's numbers, because they are not the agent's numbers.
- Consistency. The chat, the dashboard, the statement and the accountant's export all read the same function or the same stored result.
- Change without fear. A rule change is a code change with a test and a version. You can see when it happened and what it changed.
- Model independence. Swap the model next year; the numbers do not move, because the model never produced them.
It is a boring rule. Boring is what you want between an AI and your money.