Beyond Text Generation: Turning LLMs into Decision Models
Let the LLM reason about the problem. Let a decision model choose what happens next. Let deterministic code decide what is allowed to happen. Large language models are remarkably good at understanding context, interpret
Let the LLM reason about the problem. Let a decision model choose what happens next. Let deterministic code decide what is allowed to happen.
Large language models are remarkably good at understanding context, interpreting ambiguous requests, and writing useful explanations.
But in agentic systems we also ask them to do something else: make every operational decision. Should the agent call this MCP tool or that one? Should the workflow retry, escalate, or stop?
The usual pattern is to let the model generate text, parse that text, and turn it into an action. It works. But it raises a question:
If all we need is a choice among known options, why are we asking the model to write an answer?
TL;DR
- Many agent decisions are selection problems, not generation problems.
- A causal LLM can be used as a decision model: score a fixed set of candidates with token log-probabilities instead of generating free-form text.
- Recent research (LLM-as-Jev) suggests this works out of the box on a 4B-parameter model, and that fine-tuning helps only in specific cases.
- Scores are preferences, not guarantees. Evaluate them, and keep permissions and business rules in deterministic code.
1. Not Every Problem Needs Text Generation
Consider an MCP tool-routing scenario. The agent receives this request:
Get the available balance of my debit card.
The system has hundreds of registered tools. A conventional flow looks like this:
- Send the request and tool definitions to the LLM.
- Ask it to pick a tool and generate a tool call.
- Parse the generated output.
- Validate it.
- Execute the tool.
This is flexible, but the selection step is a problem about choosing between known alternatives. The system already knows what the options are. It does not need a new answer; it needs the best candidate.
Compare two questions:
- What should the model generate?
- Given these options, which one should the model choose?
The second is a decision problem, and it can be treated as one.
One clarification up front: choosing a tool and filling in its arguments are different jobs. Selection (which endpoint?) fits candidate scoring well. Argument extraction (which card ID, which date range?) is still a generation task. In a good design the LLM extracts the arguments, the decision model picks the action, and the application validates both.
2. Separate Reasoning from Decision-Making
An LLM is useful for understanding unstructured input, resolving ambiguity, and extracting intent. A decision model has a narrower job: evaluate a limited set of options and pick one.
A practical architecture separates these responsibilities:
| Layer | Responsibility |
|---|---|
| LLM | Understands the request, extracts context and arguments |
| Candidate retrieval | Finds the tools or actions worth considering |
| Decision model | Scores and ranks the candidates |
| Policy layer | Enforces permissions and business rules |
| Execution layer | Invokes the selected tool or continues the workflow |
Take a failed payment. The LLM reads the error and produces structured context:
{
"operation": "payment_authorization",
"error_type": "temporary_network_failure",
"retry_count": 1,
"payment_state": "not_confirmed"
}
The decision model evaluates a small action set (RETRY, ESCALATE, STOP). The policy layer then checks whether the chosen action is allowed: maximum retry count, idempotency requirements, transaction-state validation.
The LLM never has to write the operational decision as free-form text. It prepares the context, the decision model chooses, and the application validates.
What is a "decision model" here? It can be (a) the same LLM used in scoring mode, (b) a small fine-tuned model, or (c) a classic classifier. This article focuses on (a), because it needs no new architecture.
3. Where This Idea Comes From
The idea of "System 1" decision models was popularized by Jev, a proprietary model that returns a probability distribution over predefined options instead of generating text. It supports choice among K options, binary verification, and ordinal scoring.
Because Jev's internals are not public, a natural question followed: can an ordinary open LLM already do this?
The paper LLM-as-Jev (Li & Wagle) investigates exactly that. It proposes a training-free recipe that reads decisions directly from token probabilities, and an optional fine-tuning recipe. It evaluates both on Qwen3.5-4B and Qwen3-0.6B.
The key idea: a model trained to generate language can also compare alternatives and make structured choices.
4. How Candidate Scoring Works
4.1 Logprobs: the model's preferences
Every time an LLM produces a token, it computes a probability for each possible next token. Normally we only see the sampled output. Log probabilities (logprobs) expose part of that distribution.
Suppose the model must choose among three actions, and its relative preferences look like this (illustrative numbers):
| Decision | Preference |
|---|---|
| RETRY | 15% |
| ESCALATE | 80% |
| STOP | 5% |
Instead of generating an explanation and extracting the decision from it, we read the preference directly.
4.2 Multi-token candidates
Real candidates are rarely single tokens. RETRY may be one token, but GET_CARD_TRANSACTION_HISTORY will be several. The probability of a full candidate is the product of its token probabilities, each conditioned on the context and the previous tokens:
P(candidate | context) = P(cā | context) Ć P(cā | context, cā) à ⦠à P(cā | context, cāā¦cāāā)
Multiplying many small numbers underflows quickly, so we add logarithms instead:
score = log P(cā) + log P(cā) + ⦠+ log P(cā)
Applying a softmax across all candidate scores gives a relative distribution over the options.
Two things to keep in mind:
- Longer candidates accumulate more negative log-probability, so raw scores favor short strings. Candidate wording matters.
- The softmax output is a relative preference among the candidates. It is not automatically the probability that the decision is correct.
4.3 A practical trick: numbered options with a closing bracket
LLM-as-Jev avoids the long-string problem with a simple interface. The prompt lists options with numeric identifiers, and the assistant turn is prefilled with a fixed prefix:
State: A payment authorization failed because of a temporary network
error. The transaction is not confirmed. One attempt was made.
Options:
[1] RETRY the operation
[2] ESCALATE to a human operator
[3] STOP the workflow
Select one option. Answer only with its bracketed numeric identifier.
Best answer: [
Choosing option k then means generating the completion k]. Because every candidate ends with ], no candidate is a prefix of another (1] is not a prefix of 12]). That makes the method work for an arbitrary number of options, not just the 16 or 26 that single-letter schemes allow.
Two more details matter in practice:
- One prefill, parallel scoring. The prompt is processed once and its KV cache is reused. The few candidate suffixes are then scored together via teacher forcing, so even 150+ options need only a short series of forward steps and no autoregressive decoding.
- Joint, not isolated, scoring. All candidates appear in the same prompt, so the model can compare them. The paper reports that scoring each option separately trails joint scoring by about 5 points on identical backbones.
A deliberately naive reference sketch (one forward pass per candidate, for clarity only; production code should share the prompt prefill):
import torch
import torch.nn.functional as F
def score_candidates(model, tok, prompt, suffixes):
prompt_ids = tok(prompt, return_tensors="pt").input_ids
n = prompt_ids.shape[1]
scores = []
for s in suffixes: # e.g. ["1]", "2]", "3]"]
ids = tok(prompt + s, return_tensors="pt").input_ids
assert torch.equal(ids[0, :n], prompt_ids[0]), "prompt must be a token prefix"
with torch.no_grad():
logits = model(ids).logits
logp = F.log_softmax(logits[0, :-1], dim=-1)
tok_lp = logp.gather(1, ids[0, 1:, None]).squeeze(1)
scores.append(tok_lp[n - 1:].sum().item())
return torch.softmax(torch.tensor(scores), dim=0)
4.4 Serving-stack caveats (vLLM and APIs)
If your options are single tokens (A, B, C), next-token logprobs are enough. For multi-token candidates, a regular chat-completion endpoint is usually not enough: many APIs return only the top-k alternatives per generated token, so a candidate outside the top-k cannot be scored exactly.
You need an inference path that scores a given continuation, such as teacher-forced scoring or prompt-logprob support on a completions-style endpoint. What is available depends on your serving stack and version, so treat logprob support as an architectural capability to verify, not a checkbox.
4.5 Logprobs are not confidence, and not an explanation
A high score does not prove a candidate is correct. Scores are affected by candidate wording, tokenization, option order, prompt construction, and the training distribution. Logprobs also do not reveal chain of thought; they describe next-token prediction, not internal reasoning.
That said, the paper found the raw probabilities of the 4B model reasonably well calibrated without post-hoc scaling (ECE ā 0.057 on its benchmark). Treat that as a reason to measure calibration on your own data, not as something to assume.
5. What the Research Found
The paper's main results, on Qwen3.5-4B and public JevBench items (231 questions):
| Setup | JevBench accuracy | ECE | Banking77 (77 options) |
|---|---|---|---|
| Plain text generation | 81.4% | ā | 68.5% |
| Training-free candidate scoring | 81.4% | 0.057 | 69.0% |
| LoRA + KL anchors (Ī» = 1) | 84.0% | 0.050 | 75.4% |
| Training-free + "thinking" (4,096-token budget) | 94.8% | ā | ā |
What stands out:
- Accuracy matched generation; the gain is structural. Scoring gave the same accuracy as generation on the same model. The benefit is a structured output, no parsing, and about two sequential forward passes per decision.
- Fine-tuning helps selectively. The 0.6B model went from 22.2% to about 60% on Banking77 after fine-tuning, while the 4B model gained only a few points. Small models and specialized routing benefit most.
- Fine-tuning needs guardrails. Without KL-divergence anchors, the unanchored 4B model kept writing text after the answer on 69 of 231 queries; with anchors (Ī» = 1) it did so on none. Benchmark scores alone did not reveal this.
- Training data composition matters. Training only on intent classification pushed the model toward "yes" answers on binary questions and made it avoid "none of these" options (probability on catch-all options fell from 0.056 to 0.010).
- Thinking can be added on demand. Letting the model reason under a strict token budget before scoring raised accuracy on hard questions, at a much higher cost.
The paper's own cost estimates (FLOP-based, not measured prices) put the plain readout at about $30 per million decisions, versus about $450 for the 4,096-token thinking variant.
Caveats. These results belong to the models, benchmarks, and (single-seed) runs in the paper. The authors describe some of their analyses as exploratory. Do not assume the numbers transfer to your model, your tools, or your production traffic.
6. Candidate Retrieval Is Just as Important as Selection
A decision model can only choose among the candidates it receives. If an MCP server has 500 endpoints, sending every definition is expensive and noisy.
User Request
|
v
Intent and Context Extraction
|
v
Candidate Retrieval (keywords, metadata, embeddings, permissions)
|
v
Decision Model
|
v
Policy Validation
|
v
Tool Execution
These are two different problems:
- Retrieval: Which candidates are worth considering?
- Selection: Which of them is best?
The paper's numbers support this split. Zero-shot accuracy on a 77-option task was about 69%, well below what the same model achieved on short option lists. A retrieval step that narrows hundreds of tools to a handful keeps the selection problem small. (The paper also observed an odd prefix effect where option 1 and option 10 share a first token with digit-level tokenizers; keeping retrieved lists short is one way to sidestep it, though I would test this rather than assume it.)
If the right endpoint is not retrieved, no decision model can select it. Measure retrieval and selection separately.
7. Not Every Decision Should Belong to a Model
Some decisions are not language problems at all:
- A user without permission must not call a restricted endpoint.
- A payment must not be retried after a confirmed success.
- A workflow must stop after a maximum number of attempts.
- A sensitive operation requires approval first.
These belong in deterministic code. A useful split:
| Responsibility | Approach |
|---|---|
| Understand ambiguous intent | LLM |
| Extract context and arguments | LLM |
| Find possible tools | Retrieval |
| Rank candidate actions | Decision model |
| Enforce permissions and business rules | Deterministic rules |
| Execute | Application logic |
| Explain the outcome | LLM, when needed |
This also makes debugging tractable. A wrong tool call can be traced to context extraction, retrieval, scoring, or policy validation, instead of everything collapsing into "the LLM made a mistake."
8. How to Evaluate a Decision Model
A fluent explanation is not evidence of a correct decision. Build a labeled dataset of requests, context, candidate lists, and expected selections, then measure:
- Top-1 and top-3 accuracy: is the right candidate first, or among the first three?
- Calibration (ECE, Brier score): when the model is 90% "sure," is it right about 90% of the time?
- False positives and false negatives: wrong actions taken, valid actions rejected.
- Abstention rate: how often nothing fits well enough.
- Latency and cost: compared with conventional generation, on your own serving stack.
- Retrieval recall: how often the right candidate was in the list at all.
Add three specific test types:
-
NONE_OF_THE_ABOVEcases. A decision model should not be forced to pick from an irrelevant list. Sometimes the right outcome is to retrieve more, ask a question, or escalate. The paper's finding that models can learn to avoid catch-all options makes this worth testing explicitly. - Order-shuffle tests. If the same candidates produce different decisions when reordered, the system relies too much on prompt position.
- Yes/no bias checks. For binary decisions (retry or not, approve or not), check that the model is not drifting toward "yes."
Include realistic failures too: ambiguous requests, missing context, near-identical endpoint descriptions, permission restrictions, and unexpected errors.
9. A Practical Roadmap
You do not need to train anything to start.
- Baseline. Use structured generation (JSON with the selected endpoint and arguments). Measure accuracy, latency, token usage, and invalid outputs.
- Candidate scoring. Verify your serving stack can return the needed logprobs. Start with single-token or numbered options, then move to longer candidates if needed.
- Compare. Run the same dataset through (a) structured generation, (b) candidate scoring, and (c) a hybrid of retrieval, scoring, and deterministic validation. Compare accuracy, calibration, latency, and complexity.
-
Abstention and policy. Add
NONE_OF_THE_ABOVE, thresholds derived from evaluation, and deterministic checks. A high score must never bypass permissions. - Fine-tune only to fix a measured problem. If you do, use balanced data (avoid a single task type), shuffle option order, and consider LoRA with KL anchors to preserve general behavior. Small models and specialized routing are where gains are most likely.
- Escalate selectively. For the hardest decisions, consider budgeted reasoning before scoring, accepting its higher cost, and keep the fast readout as the default.
The goal is not a more complicated model. It is a more predictable decision process.
10. When Not to Use This
Candidate scoring is a poor fit when:
- The option set is open-ended or the answer must be composed (summaries, plans, free-form arguments).
- The right choice depends on long multi-step reasoning that you cannot afford or constrain.
- You cannot enumerate candidates, or cannot retrieve a reliable shortlist.
- Your serving stack cannot expose the logprobs you need.
In these cases, structured generation is still the right tool.
11. The Bigger Picture
Better reasoning does not automatically produce reliable execution. An agent can understand a request perfectly and still select the wrong tool, produce valid JSON for an invalid business action, or confidently choose an endpoint that was never appropriate.
Sometimes the answer is not a larger model but a better architecture: separate reasoning, retrieval, selection, policy, and execution, and give each a clear responsibility and a measurable quality.
Let the LLM reason about the problem. Let the decision model choose what happens next. And let deterministic code decide what is allowed to happen.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes ā full credit and traffic to the original publisher.