Leonardo Borges Ramos

One model talks, another decides

The ERP's AI chat did two jobs: deciding what to do and writing the answer. I measured what happens when you split them: a small model decides in 150 ms, and the LLM only writes.

Experience · · 4 min read

In 3 lines
  1. TypeSafe's Jev does not write text: it takes the context and a closed question and returns a choice with a confidence level.
  2. I measured it on 747 real questions from the ERP chat, for US$ 0.32. In Portuguese it did as well as in English.
  3. At 0.90 confidence or higher, it agrees with Claude 92% to 95% of the time. Below that, agreement drops to 30% to 60%, and the LLM decides.
The introduction page of Jev, by TypeSafe AI
docs.typesafe.ai

Develop IA is the chat that lives inside the ERP. The customer asks "how much did I bill this month?" and it answers with the number from the database. Behind the scenes, every question asked the LLM for two very different things. First, deciding: which tool to use, whether the question is simple or complex, whether it depends on the previous conversation. Then, writing the answer. The first part was done with regex and with the LLM itself returning JSON. It worked, but it was slow, expensive and hard to measure.

A model that only decides

TypeSafe AI's Jev is a different kind of model. It does not generate text. You send the state (the context) and a typed question, and it returns an answer the code uses directly, always with a confidence level. There are three formats:

01Choice

Pick one of up to 255 options. Example: which tool answers the question.

02Score

Grade on up to 10 levels. Example: how complex the question is.

03Noul

Yes or no, with confidence. Example: should this become an alert?

Jev's introduction in TypeSafe's documentation: state and questions go in, structured answers and confidence come out.
Jev's introduction in TypeSafe's documentation: state and questions go in, structured answers and confidence come out.

TypeSafe charges US$ 0.042 per million input tokens, and output is free. For comparison, deciding with an LLM costs the whole question going in and the answer coming back.

The measurement

Before turning anything on, I measured. The chat already logs every question and the tool Claude chose, and that became a free answer key. I ran 747 real questions in three versions: in Portuguese, translated into English and with the tool list shuffled. Reading was in memory only: no customer question was written to a file.

747real questions, in three versions
US$ 0.32the cost of the whole measurement
150msmedian response (300 ms at the worst 1%)

Portuguese did as well as English, and shuffling the list barely changed anything. What separated useful from useless was confidence.

Agreement with Claude's choice, by Jev confidence band
Confidence ≥ 0.90 (half the questions)94
Confidence < 0.9045

At 0.90 confidence or higher, which covers about half the questions, Jev agrees with Claude 92% to 95% of the time. Below that, it sits between 30% and 60%. The bars above use the middle of each band. When it is wrong at the top, the most common error is answering "no tool" to a request for action, the safe side: when in doubt, it does nothing.

How the two work together

The design that comes out of the measurement, for the chat:

  1. Decide

    Jev reads the question and the context and returns: which tool, how complex, whether it depends on the conversation. In about 150 ms.

  2. Check

    If confidence is above 0.90, the decision stands: the LLM gets the tool already chosen and only writes the answer.

  3. Fall back

    Below 0.90, the decision is dropped and the LLM chooses on its own, as before. The old path never moved.

  4. Log

    Every decision goes in the log next to the final choice, and that becomes the answer key for the next measurement.

// sketch of the path: Jev decides, the LLM writes
const d = await jev.choose({ state, question: 'Which tool answers?', options: tools });
const locked = d.confidence >= 0.90 && d.choice !== 'none';
return llm.answer({ question, tools: locked ? [d.choice] : tools });

The first live use: suggest only

The first place Jev really went live was not the chat, it was bank reconciliation. When the pending screen opens, statement entries that automatic matching could not resolve go through Jev, which looks at the name, CPF and CNPJ in the description and points to the most likely bill. The bill moves to the top with an "AI" badge, but the row stays locked: no entry is reconciled on its own. The person confirms.

The rule I took from it applies to any AI inside a business system: start by suggesting, measure how often the suggestion is right and only then let the machine act. And, ideally, with a small model to decide and a large one to talk.

What I take from it

Deciding and talking are different jobs. Giving each one to a model of the right size makes the system faster, cheaper and easier to measure.

Where to see itJev's documentation

More from the journal · NewsCoexistence: the counter's WhatsApp and the official API on the same number

All issues →

Quer conversar sobre isso?