Starts Nov 23Live Cohort 3 of Vibe Coding & AI Agents (Nov 23, 18:30 MSK): 3 weeks, 9 live hands-on sessionsCohort 3 (Nov 23) →
ReleaseInsight · On RadarHabr AI→ original

Financial AI Assistant Doesn't Lie About Numbers: Validator Rejected 13 of 170 LLM Responses

A small business owner's assistant writes phrases like "expenses rose 18%," and a mistake in them costs money. So ordinary code calculates the numbers, the LLM only rephrases a template, and a validator checks every response. Out of 170 test requests, it rejected 13 (about 8%), and the user got a dry but accurate template. For a product where errors are costly, every model-generated phrase needs this kind of safety margin.

AI-processed from Habr AI; edited by Hamidun News
Financial AI Assistant Doesn't Lie About Numbers: Validator Rejected 13 of 170 LLM Responses
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Numbers never go into the promptany digit in the model's answer triggers a rejection
Key metric #2At temperature 0, one phrase was accepted 0 out of 8 times on one day and 16 out of 16 times on another
Key metric #3For 15 phrases that the model consistently breaks, only the template is kept

Picture a financial assistant for the owner of a small shop. It looks at accounting data and writes one short sentence: "Expenses rose 18% over the month" or "Money will last about three months." The person makes a decision based on that sentence: restock or not.

If the LLM changes the amount, confuses growth with decline, or tacks on a generic "urgent action is required," nobody notices the error, and the money is already spent. A solo developer building such an assistant described on Habr the protection he uses against this. Ordinary code calculates the numbers, the model only chooses the words, and every one of its responses goes through a mechanical validator: a set of standard checks with no second neural network.

In a test run of 170 requests, the validator rejected 13 responses (about 8%). In those cases the user saw a ready-made template: drier, but correct.

Code calculates, the model phrases

The response is assembled in four steps. First, ordinary code with ordinary tests looks at the data and finds facts: for example, expenses rose more than 15% over the previous month, or there is a receivable overdue by more than 60 days. Each finding has a template phrase: instead of numbers and names, it contains placeholders (empty slots for substitution), along with requirements for what must appear and what must not.

Next, the model receives the scaffold without numbers or names and only rewrites it in natural language. A number in the final text can appear only through substitution by the code. The last step is the validator. If a response fails, the user gets the template. Forecasts skip the model entirely, and the caveat "this is a forecast" is added by the code as a separate final sentence so the model cannot drop it.

The validator does not assess meaning. It looks for signs of defects drawn from a closed list of rejection reasons, so rejections can be counted by type. It catches digits and numerals written as words, Latin script, extra or lost placeholders, words of opposite meaning (in a sentence about growth, "decreased" is not allowed), and loss of a required anchor such as "previously" in a comparison. It also finds duplicated units ("4 months months") and advice-like wording such as "required" and "we recommend." This last check was added after the test runs: advice from the model looks like advice from the product itself.

What the 170-request test showed

The author ran 34 templates with 5 requests each against the live API, using the same validator as in production, without cache and at zero temperature. 157 responses were accepted and 13 rejected, with no call errors; 30 templates passed five out of five. The failures are telling. On "payment due date with amount," the model added advice like "a payment must be made" in all 5 runs. In "zero balance," "urgent replenishment is required" appeared twice. The model most often replaced "there are no payments overdue by more than a month" with "is not observed." The errors lie in tone and meaning, not in arithmetic.

The most unpleasant finding concerns drift. Temperature 0 does not make responses stable: one phrase on the same request was accepted 0 out of 8 times on one day and 16 out of 16 times on another. When the test was rerun the following day, the totals barely changed (157 and 156), but four templates changed their verdict, and for 14 of the 34 the set of accepted texts was different. The median response time rose from 0.9 to 1.6 seconds, and two requests reached 5.3 seconds against a production deadline of 5 seconds. The author did not determine the cause: this is a single data point.

"Accepted" does not mean "correct"

The accepted-response counter shows that a text passed the checks, not that it reads well. For the phrase about expense growth in an incomplete month, the author added a mandatory anchor such as "whole" or "full": the current month is compared with the entire previous month. Acceptance rose to 19 out of 20. But reading the texts revealed that the model wrote "over the full line item" instead of "over the whole previous month." The validator lets such text through: the anchor is present, and there are no numbers or advice. A similar case with partial data: "the payment total comes to…" reads as if it were the full amount.

The practical takeaway: at every re-measurement, read all unique accepted texts, not just the counter.

Economics and limitations

Validator rejections are safe for the user, but they cost money on calls and add latency. Therefore, for 15 phrases with poor test results, the model is disabled. "Receivable more than 30 days overdue" passed 6 out of 16 times, "profit is falling" only 3 out of 20 (17 rejections due to duplicated units), and "expenses have not changed significantly" 0 out of 20. For these, only the template remains.

The author honestly names the limits of the approach:

  • the validator catches signs, not meaning, and forms like "falling" or "declining" may slip through;
  • the model's texts cannot be pinned down by tests; what is tested is the validator (via mutation testing) and the templates;
  • there is no cumulative rejection counter in production yet, so drift is visible only through manual re-measurements;
  • the figures are valid for one model and one instruction; after changing either, the measurement must be repeated;
  • five requests per template is an observation, not statistics.

The main lesson for products where a text error costs money: code must produce the numbers, every model-generated phrase must have a template fallback, and the protection must work on every response, not just once at launch.

Story

Key Questions Answered

What are the key details on Code calculates, the model phrases?

The response is assembled in four steps. First, ordinary code with ordinary tests looks at the data and finds facts: for example, expenses rose more than 15% over the previous month, or there is a receivable overdue by more than 60 days. Each finding has a template phrase: instead of numbers and names, it contains placeholders (empty slots for substitution), along with requirements for what must appear and what must not.

What the 170-request test showed?

The author ran 34 templates with 5 requests each against the live API, using the same validator as in production, without cache and at zero temperature. 157 responses were accepted and 13 rejected, with no call errors; 30 templates passed five out of five. The failures are telling. On "payment due date with amount," the model added advice like "a payment must be made" in all 5 runs. In "zero balance," "urgent replenishment is required" appeared twice.

What are the key details on "Accepted" does not mean "correct"?

The accepted-response counter shows that a text passed the checks, not that it reads well. For the phrase about expense growth in an incomplete month, the author added a mandatory anchor such as "whole" or "full": the current month is compared with the entire previous month. Acceptance rose to 19 out of 20.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

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.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…