Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 22 min read

You Don't Need an LLM to Make Every Decision in Your Application

Originally published in Portuguese. Prefer listening? The original Portuguese episode is also available on Spotify. I use LLMs (large language models) every day for all sorts of things. And at this point, you probabl

Originally published in Portuguese. Prefer listening? The original Portuguese episode is also available on Spotify.

I use LLMs (large language models) every day for all sorts of things. And at this point, you probably do too.

I run them locally, in the cloud, through APIs and CLIs, to generate text, code, summaries, translations, explanations, and so on. And you probably do too.

I run agents, with skills, without skills, freestyle, with SDD (Spec-Driven Development), without SDD, with tooling, without tooling... And I'm guessing you do too.

But I don't know if you've noticed: whenever an LLM is asked to make a decision as part of an analysis, things don't always go as smoothly as we'd like.

Results can vary from one run to the next, even with the same prompt and the same data. And when the decision is critical, that can be a problem. Actually, scratch that. It can be a HUGE problem!

I know it's tempting to use LLMs for everything. In fact, a lot of people these days seem to think AI is synonymous with LLMs. Everything is ChatGPT or Claude now.

I've been in conversations where the mindset was, "If you're not using an LLM, you're not using AI." That's about as misguided as putting your goalkeeper up front and expecting a hat trick.

Depending on the problem, a classifier trained for a specific task may be more reliable and efficient than an LLM. But you can't just pick a model and hope for the best. We need to look at the data and test whether it actually works for the problem we're trying to solve.

One quick note before we move on: LLMs are also machine learning models. This isn't "ML vs. LLM." We're comparing ways of solving a problem: generating a language-based response versus using a specialized model to evaluate a decision.

However, building and training a classifier for a specific task comes with its own complexity, which can be a barrier for some people and companies. That's why using an LLM is often a matter of convenience rather than necessity.

But the game is changing. We now have decision models that we can integrate into our applications to help with these tasks.

And that's pretty amazing.

Let's think this through.

Imagine someone opens a support ticket with the following message:

"I can't access my account. The page displays an error when I try to log in."

Before anyone can help, we need to route the request to the right team. We have four queues: finance, support, sales, and other.

If we were using an LLM to solve this problem, our prompt might look something like this:

Analyze the ticket and choose the team that should handle it:

- finance: billing, payments, and refunds
- support: account access, errors, and technical issues
- sales: plans, pricing, and subscriptions
- other: when none of the above applies.

Respond only with a JSON object in the following format:
{"team": "team_name"}

Ticket: I can't access my account. The page displays an error when I try to log in.

The model might respond like this:

{ "team": "support" }

Now the application reads the JSON, checks whether team exists and whether its value belongs to the list of allowed queues. If everything checks out (and nothing has gone sideways), it routes the ticket to support. If the JSON is invalid or contains an unknown queue, the application needs to handle the error, perhaps by sending the ticket for review.

In this example, there's a reasonably good chance of success. But what about more complex scenarios and other kinds of problems? Is this approach practical? Does it scale? Would I have to write different prompts for every decision I want to make? What if I had to choose between 10 options, or 20, or 100?

Some APIs offer structured outputs to constrain the response format. That reduces the work involved in dealing with invalid formats, but the application still needs to check whether the decision makes sense for the business.

Even if an LLM guarantees perfectly valid output through structured outputs or constrained decoding, we're still using a generative mechanism to solve a problem that can be handled directly as classification. The problem isn't JSON itself (despite the JavaScript in its name 😜). It's what the model has to do internally to arrive at the right answer.

Which brings us to the question: if I need a decision between four options, should I use a text generation model? Are we using a screw where we need a nail? A hammer instead of a screwdriver? A center-back who seems to be playing for the opposition?

For well-defined decisions, we can (and should) consider a decision model. The application supplies the context, the question, and the available options. The model returns a structured decision and a probability distribution.

Let's go back to our opening ticket and represent the input a little more simply:

state: "I can't access my account. The page displays an error when I try to log in."
question: "Which team should handle this ticket?"
options:
  finance: billing, payments, and refunds
  support: account access, errors, and technical issues
  sales: plans, pricing, and subscriptions
  other: none of the above

One possible response would be:

selected_team: support
probabilities:
  support: 0.91
  finance: 0.03
  sales: 0.04
  other: 0.02

Hold your horses! We haven't reached the code yet, but we will! These numbers are made up, but you can already see that the application has more information to decide whether to route the ticket or request a review.

See the difference? The LLM generates a response (a nicely structured JSON object, if all goes well), and the application has to interpret its value. That value could be anything from a rubber duck to a nuclear warhead.

With a decision model, we send a structured question and receive a structured decision. When an API returns that response as JSON, the application still needs to read and validate it. The difference is that the choice and probabilities are already fields defined by the interface. That lets the application check whether the decision makes business sense and apply rules based on those probabilities.

The point of this post isn't to declare LLMs a bad idea for this particular scenario. Not at all... It's much simpler than that: generating text and making a decision are different tasks. Sometimes you need both. Sometimes you're paying the cost of the former just to get the latter done. And I'm not even going to get deep into the cost $$$$ side of things here...

So, what exactly are we classifying?

Classification means assigning an input to one or more categories: pig goes in, sausage comes out. Or pig goes in, sausage AND pork cracklings come out. Sounds simple. And it is, until we have to define the categories and deal with everything in between.

Think about your email inbox. Each email generally belongs to one of two classes: spam or not spam.

That's binary classification (pretty straightforward).

We can start with a rule: if the sender is on a blocklist, mark it as spam. For some inputs, a deterministic rule is enough.

Something I've noticed is that deterministic rules solve a surprising number of problems perfectly well, but for some reason calling it "AI" and throwing an LLM at it is sexier.

What if the message says, "You've won a prize! Confirm your details"? The rule would need to recognize variations and context. A trained classifier receives labeled examples and learns patterns associated with the two classes. Its output may be a score for spam, which the application compares against a threshold.

When routing tickets to a particular department, we want to choose exactly one option from several alternatives. The other option covers inputs that fall outside our predefined categories (those pesky edge cases), although the model can still be confidently wrong. I call that "an idiot with initiative."

What if the customer says, "I can't log into my account, and I've also been charged incorrectly"? Now both support and finance can be true at the same time. That's multilabel classification.

A classification model can assign a score to each option and use a function called softmax to turn those scores into a distribution: each value is between 0 and 1, and they all add up to 1.

For our ticket classification problem, let's assume we have just two options for simplicity. The result might be support: 0.60 and finance: 0.40. Both options share the same total. If we need to choose only one queue, we can select support, which received the higher value.

In this example, 0.60 is the probability the model assigned to support among the available alternatives. But that doesn't guarantee it's right 60% of the time when it returns that value.

To find out whether we can interpret the number that way, we need to evaluate calibration: among many cases with a predicted probability close to 0.60, how many were classified correctly? Representative data is what tells us whether that signal helps us decide between routing a ticket automagically or requesting a review.

But the ticket mentions both access and billing. To identify both topics, we can ask two independent questions: "Is there an account access issue?" and "Is there a billing issue?" Each receives its own probability of a "yes" answer. Both can be high at the same time, and they don't have to add up to 1.

Choosing the first team to handle a ticket and identifying every topic it contains are different decisions, even when we use the same text.

If the question is about the urgency of the ticket, we can classify it as low, medium, high, or critical. We have an ordinal scale, meaning the levels have an order. Mistaking high for critical doesn't necessarily have the same cost as mistaking low for critical. Plain accuracy treats both as errors, but perhaps our product evaluation shouldn't.

Problem Type Question for the system designer
Spam Binary Which mistake costs more: blocking a legitimate email or letting spam through?
Responsible queue Multiclass Is one queue enough?
Ticket topics Multilabel How many topics can coexist?
Urgency Ordinal Does being off by one level cost the same as being off by three?

My idea here is to show a few scenarios where classification isn't simply a matter of being right or wrong. The model we choose, how we configure and train it, and how the application interprets its output are all critical factors.

We need to understand each scenario before choosing the model. If the objective is wrong, switching models only helps you get to the wrong answer faster. After all, if you don't know where you're going, any road will take you there.

We also need to emphasize something else: a class, a score, and a decision are three different things!

Suppose a classifier estimates spam = 0.72. With a threshold of 0.50, the application marks the email as spam. With a threshold of 0.90, it lets it through. The model input and output are exactly the same, but the decision policy has changed.

There's a small (read: enormous) gap between a list of words and a generative language model. A traditional classifier can turn text into features, such as word frequencies, and train a logistic regression model. We can also use embeddings and a classification layer.

Logistic regression is an example of a discriminative model: it learns how the input relates to the possible classes rather than having to generate the text of an answer. Such models can return probabilities and be calibrated. So probability and classification aren't exclusive novelties of decision models.

Maybe I've gotten a little too abstract here, but my point is that there are different ways to classify things, each with its own advantages and disadvantages. Before we start downloading every model on Ollama, we need to understand what we actually want to classify.

The practical difference we'll explore is in the interface: describe the state and the question in natural language, and supply the options at request time.

We ask a question, provide possible answers, and find out which one the model considers most appropriate. The application can then use the decision and probabilities to automate, review, or route the case.

Imagine our ticket classifier was trained to choose between finance, support, and sales. Now the company creates a security team, and we want to include it in the classification.

With a traditional supervised classifier that has fixed classes, this change usually means preparing examples of the new class and retraining and tuning the model. With a decision model that accepts dynamic options, we can include security and its description in the next request. We don't necessarily need to train a dedicated classifier for every set of categories. The model evaluates the alternatives it receives at that moment.

That alone is a ridiculously huge win. Can you imagine having to adjust a classification model every time someone creates a new category? What if it's temporary, like "Christmas promotion"? What if it's customer-specific, like "premium account"? What if it's country-specific, like "local regulations"? An absolute nightmare...

But you might be wondering: a generative LLM can also take new options in a prompt. So where's the difference?

In decision models like the ones we're about to explore, the options are part of the structured question and are scored by the model.

With a generative LLM, we can ask it to produce an answer from those options.

Check out this handy little table:

Feature Traditional supervised classifier Decision model with dynamic options LLM
Classes defined during training Usually Not necessarily Not necessarily
Dynamic options at request time Usually not Yes Yes
Text generation to answer No No Yes
Per-class probabilities Possible Yes Depends on the approach
Task-specific training Usually Not necessarily Not necessarily
Domain evaluation Required Required Required

This makes life easier for anyone who wants to experiment with different categories without maintaining dedicated training infrastructure. But it's not a free pass to rename options and assume the results will stay the same.

Changing the question, adding an option, or altering its description can affect the returned distribution. For instance, security might mean account protection to one team and fraud investigation to another. The description needs to make our expectations clear.

When we need to choose a single alternative, the options compete with each other. Adding or removing one can change the probabilities of the others. So test questions and option sets against real, labeled examples. If a change affects automated decisions, reevaluate calibration and the thresholds used by the application.

Classification quality also depends on how we define the problem. The model can score the options it receives, but it can't magically guess a category we forgot to include or a business rule we never explained. There's no magic here!

Meet Jev and Laya

Let's get to know two decision models: Jev and Laya.

Jev is a decision model from TypeSafe AI, offered as a service. You send a state, such as the text of a ticket or a JSON object, and ask questions with a defined response format. It returns structured decisions the application can use to classify, score, or evaluate a condition.

Laya is an independent family of open-weight decision models created by Convai Innovations. It also accepts a state and typed questions to produce structured decisions. Its implementation is different from Jev's, even when their question interfaces are compatible.

Why are we using Laya in this post? Because we can run it locally with Ollama and reproduce the examples on our own machines. We'll soon see how to download the model and send requests with curl.

And now you're asking, what's Ollama?

It's a tool that lets you run language models locally without relying on an external API. It provides an interface for interacting with models like Laya (and many others), making testing and experimentation easier.

Both models treat classification as one type of decision. In our ticket example, we used choice to choose a team. But we can also ask about urgency or check whether a condition is present. Here are the three question types we'll use:

Type Question What the code receives
choice Which queue should receive the ticket? One option and per-option probabilities
score How urgent is it? A position on an ordered scale and per-level probabilities
noul Is there evidence of fraud? Probability of "yes"

A choice can select a queue. A score can rank incidents. A noul can drive an if. No need to persuade a model to write something in a format the application already knows. How awesome is that?!

But how does Laya arrive at a decision?

Let's look under the hood without getting our hands covered in engine oil...

As I said earlier, we're focusing on Laya, but imagine the underlying idea is similar for other decision models. The differences are in the architecture, training, and implementation. OK, that's practically everything, but trust me, the idea is the same...

In the ticket example, we give Laya three things: the customer's message, the question, and the team options. The model processes them together and assigns a score to each option. It then uses softmax, which we saw earlier, to turn those scores into a probability distribution.

But how does it score each option?

I can assure you there's no witchcraft involved. Laya uses an encoder to process text and produce numerical representations that take into account the context surrounding each part of the input.

The English version uses ModernBERT-large as its encoder. The multilingual variant we'll use is based on mmBERT.

It reads the question, options, and ticket together. All at once, with a special marker for each answer option.

Another part of the model, called the decision head, then uses the representations of those markers to calculate a score for each alternative. Think of each marker as pointing to where the model should look for the information it needs to evaluate that option.

These scores are called logits. Imagine the model produced the following values for our support ticket:

Alternative Logit
Support 3.5
Finance 0.1
Sales 0.4
Other -0.3

These numbers are illustrative and aren't probabilities yet. They can even be negative. To turn them into a distribution across the options, we apply softmax:

Alternative Approximate probability
Support 90.8%
Finance 3.0%
Sales 4.1%
Other 2.0%

Before rounding, the probabilities add up to 100%. When rounded to one decimal place, the total may be slightly different.

ticket + question + options
            ↓
encoder processes everything together
            ↓
decision head scores each option
            ↓
softmax converts scores into probabilities
            ↓
support 0.91 | finance 0.03 | sales 0.04 | other 0.02

The animation was generated using ChatGPT's Terra 6.1 model after dozens of prompts...

In a generative LLM, the response is produced as a sequence of tokens. With Laya, answering a choice question means scoring the supplied options. The API then packages the decision and probabilities into a structured response.

The model classifies. The application decides.

What about performance?

In an application that classifies thousands of tickets or decides which tool an agent should use, the time each decision takes matters. These decisions may happen several times within the same workflow.

This Ollama article features a demo that helps illustrate this: a decision model choosing moves in a game of Pac-Man. The replay shows every move alongside its structured response, and it moves incredibly fast. Ridiculously awesome.

According to the article, the experiment used Nimble 9B (you can use that model instead of Laya, too!) running locally on a MacBook Pro with an M5 Max, averaging 91 ms per decision. That's a result for Nimble, not Laya, and it's not a measurement I made myself. But it gives us a useful baseline for the kind of performance we might expect from decision models. Maybe I'll vibe-code one of these demos using Laya... πŸ‘€

And here's the really interesting part: because the model scores the options instead of generating a response token by token, it can deliver decisions in just a few milliseconds. We can also ask multiple questions about the same state in a single request.

This is genuinely awesome, don't you think? If you don't, close this tab and grab a coloring book. I won't judge.

Response time depends on the model, hardware, and input size. The numbers from Ollama's experiment are a reference point, not a guarantee for every machine or application.

Now grab yourself a good cup of coffee, because we're about to get Laya running!

Let's get our hands dirty

To run Laya, we need Ollama installed and running. The model's page specifies version 0.40.0 or later. Check your version and download the multilingual variant used in the original examples.

ollama pull laya:322m-multilingual-bf16

Check the available variants and their compatibility with your computer.

We can interact with some models in Ollama through chat, but Laya isn't conversational. So we'll use the local API. Nothing complicated!

The server needs to be running at localhost:11434 (you can configure the port). If it isn't running, execute ollama serve in another terminal. Laya responds at the /v1/systemone endpoint.

You can use Postman, Insomnia, or any other HTTP client to test the requests. We'll be using curl, a command-line tool for making HTTP requests.

Let's give it a go!

A note on the examples: the requests below have been translated into English. Their sample responses retain the numerical results from my original Portuguese-language runs, with the application-defined labels translated for readability. They are not measurements from rerunning the English requests; probabilities and token counts may differ when you execute them.

Classifying a ticket

Let's start with a single question. A customer reports being billed twice, and we want to know which team should receive the ticket.

We send the text in state, the question in instructions, and the available teams in criteria. The choice type tells the model we want it to choose an alternative.

curl -sS http://localhost:11434/v1/systemone \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "laya:322m-multilingual-bf16",
    "state": "I was billed twice this month.",
    "questions": {
      "queue": {
        "type": "choice",
        "instructions": "Which team should handle the ticket?",
        "criteria": {
          "finance": "Billing and payments",
          "support": "Account access and technical issues",
          "other": "None of the above"
        }
      }
    }
  }'

Sample response:

{
  "model": "laya:322m-multilingual-bf16",
  "answers": {
    "queue": {
      "type": "choice",
      "choice": "finance",
      "probabilities": {
        "finance": 0.9999483905913992,
        "support": 0.00000970165145878137,
        "other": 0.00004190775714200157
      },
      "confidence": 0.9999225858870986
    }
  },
  "usage": {
    "input_tokens": 48,
    "output_tokens": 0
  }
}

In answers.queue.choice, we find the selected team. In answers.queue.probabilities, we see the estimated distribution across the options. The confidence field indicates how concentrated that distribution is (it is not the probability of being correct). It's up to the application to decide how to use the result.

The values shown are an example response and may vary across runs, models, and versions.

Identifying multiple topics

Remember the ticket from the beginning of this post? Let's complicate things a little: the customer can't access their account and has been charged twice.

We need to choose the first team responsible for handling the ticket. At the same time, we want to identify both topics so that information isn't lost during routing.

To do that, we'll ask three questions about the same text: one choice for the initial queue, and two noul questions, one for billing and another for account access.

curl -sS http://localhost:11434/v1/systemone \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "laya:322m-multilingual-bf16",
    "state": "I cannot log into my account and I was charged twice.",
    "questions": {
      "queue": {
        "type": "choice",
        "instructions": "Which team should perform the initial triage?",
        "criteria": {
          "finance": "Billing, payments, and refunds",
          "support": "Account access, errors, and technical issues",
          "other": "None of the teams above"
        }
      },
      "billing": {"type": "noul", "instructions": "Is there a billing issue?"},
      "access": {"type": "noul", "instructions": "Is there an account access issue?"}
    }
  }'

Sample response:

{
  "model": "laya:322m-multilingual-bf16",
  "answers": {
    "queue": {
      "type": "choice",
      "choice": "finance",
      "probabilities": {
        "finance": 0.9976498820177107,
        "support": 0.0018286265926148993,
        "other": 0.0005214913896745094
      },
      "confidence": 0.996474823026566
    },
    "billing": {
      "type": "noul",
      "noul": 0.9966348607061432
    },
    "access": {
      "type": "noul",
      "noul": 0.9954319639064501
    }
  },
  "usage": {
    "input_tokens": 158,
    "output_tokens": 0
  }
}

The model chose finance for the initial triage, but the noul answers indicated both billing and access issues. That's exactly the difference between selecting a queue and identifying every topic in a ticket.

Prioritizing an incident

Payments have become unavailable to all customers. Before routing the incident, we want to estimate its urgency.

Here we use score and describe an ordered scale: low, medium, and high. The order matters! So do the descriptions: that's where we explain what each level means.

curl -sS http://localhost:11434/v1/systemone \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "laya:322m-multilingual-bf16",
    "state": "The payment service has just become unavailable to all customers.",
    "questions": {
      "urgency": {
        "type": "score",
        "instructions": "What is the operational urgency of the incident?",
        "criteria": [
          "Low: inquiry with no service disruption",
          "Medium: limited impact with a workaround available",
          "High: essential service unavailable to many customers"
        ]
      }
    }
  }'

Sample response:

{
  "model": "laya:322m-multilingual-bf16",
  "answers": {
    "urgency": {
      "type": "score",
      "score": 1.6176503433487301,
      "legend": {
        "0": "Low: inquiry with no service disruption",
        "1": "Medium: limited impact with a workaround available",
        "2": "High: essential service unavailable to many customers"
      },
      "probabilities": {
        "0": 0.02774080437257001,
        "1": 0.3268680479061298,
        "2": 0.6453911477213002
      },
      "confidence": 0.4264755150230952
    }
  },
  "usage": {
    "input_tokens": 70,
    "output_tokens": 0
  }
}

The score of approximately 1.62 falls between medium and high. It's a weighted average of the indices 0, 1, and 2, not a probability. In this result, the high level received most of the probability mass.

Triaging an incident with incomplete information

Let's combine classification, urgency, and binary questions in a scenario that's a little closer to real life.

Customers can't complete their orders. The payment service is operational, there is a temporary workaround, and the root cause hasn't been found yet. We want to identify the initial team, estimate the urgency, and verify two important pieces of information from the report.

curl -sS http://localhost:11434/v1/systemone \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "laya:322m-multilingual-bf16",
    "state": "Since 2 PM, customers in two regions have been getting HTTP 500 errors when completing orders. The team confirmed that the payment service is operational, but checkout is failing. There is a temporary workaround: place orders by phone. The root cause is still unknown.",
    "questions": {
      "team": {
        "type": "choice",
        "instructions": "Which team should lead the initial investigation?",
        "criteria": {
          "application": "Checkout or order application failure",
          "payments": "Confirmed payment service failure",
          "infrastructure": "Confirmed network or infrastructure failure",
          "other": "None of the above"
        }
      },
      "urgency": {
        "type": "score",
        "instructions": "What is the operational urgency of the incident?",
        "criteria": [
          "Low: no service disruption",
          "Medium: impaired service with a temporary workaround",
          "High: essential service unavailable without a workaround"
        ]
      },
      "workaround": {
        "type": "noul",
        "instructions": "Is there a temporary workaround for placing orders?"
      },
      "root_cause_known": {
        "type": "noul",
        "instructions": "Has the root cause of the incident been identified?"
      }
    }
  }'

Sample response:

{
  "model": "laya:322m-multilingual-bf16",
  "answers": {
    "team": {
      "type": "choice",
      "choice": "application",
      "probabilities": {
        "application": 0.5525777395537472,
        "payments": 0.3521374695585525,
        "infrastructure": 0.0390675470175845,
        "other": 0.05621724387011568
      },
      "confidence": 0.40343698607166295
    },
    "urgency": {
      "type": "score",
      "score": 1.32364408324189,
      "legend": {
        "0": "Low: no service disruption",
        "1": "Medium: impaired service with a temporary workaround",
        "2": "High: essential service unavailable without a workaround"
      },
      "probabilities": {
        "0": 0.016830185011012164,
        "1": 0.6426955467360858,
        "2": 0.34047426825290217
      },
      "confidence": 0.4640433201041284
    },
    "workaround": {
      "type": "noul",
      "noul": 0.9862702181505042
    },
    "root_cause_known": {
      "type": "noul",
      "noul": 0.03900410632520264
    }
  },
  "usage": {
    "input_tokens": 425,
    "output_tokens": 0
  }
}

Here's where it gets interesting: even though the report says the payment service is operational, the model assigned approximately 0.35 to the payments team. application came first, with 0.55. I wouldn't automate this routing decision without evaluating how the model behaves in similar cases.

The model also identified the temporary workaround and gave a low score to the question of whether the root cause was already known. Good triage helps us find the initial team, but it isn't a root cause diagnosis.

Analyzing an account change request

Now a customer asks to change the email address registered on their account. The message comes from a different address, with no identity verification, and mentions urgency. We want to identify the request and extract each of these signals separately.

curl -sS http://localhost:11434/v1/systemone \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "laya:322m-multilingual-bf16",
    "state": "Account change request: the customer says their email address has changed and asks to update the registered address. The request came from an email address different from the registered one, with no identity verification. The customer says they urgently need access to their receipts.",
    "questions": {
      "request": {
        "type": "choice",
        "instructions": "What is the main request?",
        "criteria": {
          "change_email": "Update the account email address",
          "get_receipt": "Request a copy of a receipt without changing the account",
          "other": "Another type of request"
        }
      },
      "identity_verified": {
        "type": "noul",
        "instructions": "Does the text state that the customer’s identity has been verified?"
      },
      "different_channel": {
        "type": "noul",
        "instructions": "Did the request come from an email address different from the registered one?"
      },
      "urgency": {
        "type": "score",
        "instructions": "How urgent does the customer say the request is?",
        "criteria": [
          "Low: no indication of urgency",
          "Medium: needs assistance soon",
          "High: explicitly expresses urgency"
        ]
      }
    }
  }'

Sample response:

{
  "model": "laya:322m-multilingual-bf16",
  "answers": {
    "request": {
      "type": "choice",
      "choice": "change_email",
      "probabilities": {
        "change_email": 0.7441692812970723,
        "get_receipt": 0.010436259372597649,
        "other": 0.24539445933033008
      },
      "confidence": 0.6162539219456084
    },
    "identity_verified": {
      "type": "noul",
      "noul": 0.8100077427863873
    },
    "different_channel": {
      "type": "noul",
      "noul": 0.9930361794239647
    },
    "urgency": {
      "type": "score",
      "score": 1.968913160198232,
      "legend": {
        "0": "Low: no indication of urgency",
        "1": "Medium: needs assistance soon",
        "2": "High: explicitly expresses urgency"
      },
      "probabilities": {
        "0": 0.0009723069175156784,
        "1": 0.029142225966736757,
        "2": 0.9698854671157476
      },
      "confidence": 0.9533697402973478
    }
  },
  "usage": {
    "input_tokens": 426,
    "output_tokens": 0
  }
}

The model identified the email change request and the fact that the message came from a different address.

But here's the thing: for identity_verified, it returned approximately 0.810 for "yes", even though the text explicitly says there was no verification. The model was wrong, and confidently so. This came from the original run, not a response I made up for the example.

A model can help interpret a message, but it shouldn't decide whether someone has been authenticated. Identity verification needs to come from a verifiable mechanism and deterministic application rules. Urgency isn't permission to skip that verification, either.

So, what do you think? Enjoyed it?

Decision models are one more tool we can use in our applications. I'm not retiring my LLMs because of Laya, obviously. But I don't want to fire up a model with billions of parameters just to solve something an if statement could handle, either.

What a time to be alive, huh? Personally, I keep finding myself amazed by everything that's happening. What about you? Let's chat in the comments!

See you next time, go Corinthians, and stay hydrated!

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.