From a billing mismatch to a smaller, faster AI classifier
An investigation into untracked LLM costs led us to test smaller classifiers, refine our prompts, and reduce average input token usage by about 55%.

A reconciliation problem turned into a token optimization effort. We track our LLM providers’ token usage and costs daily. But when we compared our numbers with the providers' dashboards, the difference was too large to ignore. So we started digging through the code to find where we had missed tracking LLM calls.
It would be trivial to say an LLM call went untracked in 2026, but the scenario was interesting. A substantial number of calls had gone unnoticed for days because they weren't the calls we expected to return. Some took longer to complete, while others ran in parallel as a race, where the first response was used and the rest were cancelled. As our user base grew, so did these abandoned calls. They were still billed by the provider, but never made it into our tracking.
Moving towards open-source models has been something we're actively pursuing, so we took this as an opportunity to make a start.
We identified one of our heavier LLM calls that was doing multiple jobs with a huge prompt. We could split it up and move the classification part to Jev, a small model designed to choose one option from a list.
But switching models isn't as straightforward as replacing an API call. We had previously noticed that the same prompt could perform quite differently across models. Jev was no exception. Fortunately, our prompts were already modularized, so tweaking and testing them was relatively easy.
How well did Jev perform?
We started with our golden set of labelled queries, each mapped to an expected classification.
Jev got 92.6% right, with an average latency of around 0.5 seconds. More interestingly, it needed only about 20% of our existing LLM classifier's token consumption on the same benchmark.
That looked promising, but our benchmark queries were simple one-liners. Real conversations come with history, portfolio information, and questions that don't always fit neatly into a single category.
When we integrated Jev into the pipeline, a few interesting problems surfaced.
The first was our confidence threshold. We initially fell back to the heavier model whenever Jev's confidence was below 0.6. In one run, 1 out of 4 queries took that fallback. But when we inspected them, Jev had actually chosen the right category in most cases. The categories themselves were overlapping, and we were paying for two models even when the first had answered correctly.
The second was the prompt. Our category descriptions had been written around existing LLM provider's behaviour, and Jev interpreted them differently. A few descriptions were too broad, while others missed important cases. We refined the boundaries instead of changing the model.
The most interesting issue was with portfolio context. The same tax-related question worked in testing but failed in production. After several replays, we found that Jev wasn't receiving the user's holdings before classification. With that information supplied, it chose the expected category 93% of the time. Without it, the model was effectively making a reasonable guess with incomplete information.
This was a useful reminder that not every classification failure is a model problem. Sometimes we're simply not giving the model enough information.
We also changed our fallback strategy. Instead of sending the entire request back through the expensive pipeline when Jev failed, we now retry just the classification step using another small model.
We tried other small models too
We didn't want Jev to become our choice simply because it was the first model that worked.
We tested Laya locally and Liquid AI's d1 as potential alternatives.
| Model | Accuracy | Average latency |
|---|---|---|
| Jev | 92.6% | ~0.5s |
| Laya | 66% | ~2.3s |
| Liquid d1 | 3/5 on a small test | ~0.71s |
Laya was attractive because it could run locally without a hosted dependency. But its classification accuracy was too low for our use case.
Liquid d1 was faster than Laya and cheaper per call than Jev, but it made some surprisingly confident mistakes. On one incorrect classification, its confidence was 99.6%.
Five queries aren't enough to judge a model conclusively, but they were enough for us to hold off on switching.
For now, Jev remains our primary classifier.
What changed?
We compared the new pipeline against the old one using real conversation replays. Across our runs, the new classifier agreed with the old pipeline on roughly 87–93% of queries, with further improvements after refining the prompts.
More importantly, average input token usage dropped from approximately ~65k to ~30k tokens per turn, a reduction of about 55%.
What started as an investigation into untracked LLM costs ended up changing how we approached classification. We didn't need another large model to handle every step. We needed to separate the jobs, give the smaller model the right context, and test it against real conversations rather than just clean benchmark queries.
Related Articles

From Financial Data to Financial Intelligence: What’s Changing?
Explore how AI-powered financial intelligence is transforming personal finance, helping investors understand portfolios, manage risks, and make smarter financial decisions.

Is Your Mutual Fund Portfolio Still Aligned with Your Goals? Five Signs to Look For
Your financial goals may change over time, but has your mutual fund portfolio kept up? Discover five signs that can help you assess whether your investments still align with your goals, risk appetite, and investment horizon.

5 Things to Check Before Buying a Mutual Fund
Choosing a mutual fund isn't just about picking the one with the highest returns or best rating. Before investing, it's important to understand whether the fund matches your financial goals, risk tolerance, and investment timeline. From evaluating past performance and expense ratios to checking portfolio overlap, here are five things every investor should consider before buying a mutual fund.