Decision Models in Hugging Face
Large language models (LLMs) are highly effective at generating text. They answer questions, write code, explain problems, and perform many other tasks. However, some applicatio...
By Software Development Team
Large language models (LLMs) are highly effective at generating text. They answer questions, write code, explain problems, and perform many other tasks. However, some applications do not need generated text at all.
Consider a customer-support message:
I was charged twice for my subscription. I need a refund today.
A support system may need to identify the responsible team, estimate urgency, and determine whether the customer is requesting a refund.
An LLM could be prompted to return those values as JSON:
llama cli -hf ggml-org/gemma-4-e4b-it-GGUF:Q4_0
> We have the following customer support ticket, "I was charged twice for my subscription. I need a refund today.", which team should handle the request, how urgent it is, and whether the customer is requesting a refund. Give the answers in JSON.
[Start thinking]
...
[end thinking]
json
{
"team_to_handle": "Billing",
"urgency": "High",
"request_refund": true
}
A decision model takes a different approach. It evaluates predefined alternatives and returns probabilities for them without generating a textual response:
from transformers import pipeline
decide = pipeline("decision", model="autotrust/GEV-26B-Decide")
decision = decide(
{
"state": "I was charged twice for my order and want a refund.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments and refunds",
"technical": "Bugs and technical issues",
"sales": "Pricing and subscriptions"
}
}
}
}
)
## {
## 'department': {
## 'type': 'choice',
## 'choice': 'billing',
## 'confidence': 0.9974000453948975,
## 'probabilities': {
## 'billing': 0.9982666969299316,
## 'technical': 0.0010246571619063616,
## 'sales': 0.0007087149424478412
## }
## }
## }
This is the central idea behind decision models.
What are decision models?
A decision model receives a context, called the state, evaluates one or more questions with predefined possible answers, called primitives, and returns typed decisions with probabilities.
Instead of generating an answer token by token, the model assigns probabilities to answers that the application already understands.
The basic interface is:
State + Questions + Allowed Answers → Decisions + Probabilities
TypeSafe AI introduced Jev and described it as a System One model, drawing on the distinction between fast, intuitive thinking and slower, deliberative thinking. The community has adopted the term decision model because it describes the model's computational role without depending on a particular theory of cognition.
Why not use LLMs for everything?
Many applications already prompt LLMs to produce JSON for classification, routing, and other structured tasks. This approach has several limitations:
- Schema compliance is not guaranteed. A model may produce invalid JSON, add unexpected keys, or return an answer outside the allowed choices.
- Constrained decoding adds overhead. Tools such as Outlines and XGrammar can enforce grammars or JSON schemas by limiting the tokens available at each step. This improves structural reliability but requires additional processing.
- Generating a complete response may be unnecessary. When an application only needs to select among predefined answers, autoregressive text generation performs work that is not required for the task.
Decision models address this by treating the available decisions and their probabilities as direct outputs.
How are decision models different from classification models?
Two related approaches help explain the role of decision models: traditional classification and zero-shot classification.
Traditional classification
Suppose a classifier routes customer-support requests to three departments:
- Billing
- Technical support
- Sales
A conventional classifier learns a mapping from inputs to a fixed set of labels. Its classification head generally produces one logit per class, and softmax converts those logits into probabilities.
The output classes are built into the classification head. If a Legal department is added, the existing classifier does not automatically gain a corresponding output. The head may need to be changed, new training data collected, and the model retrained or adapted.
Zero-shot classification
Zero-shot classification allows candidate labels to be supplied at inference time:
from transformers import pipeline
classifier = pipeline(
"zero-shot-classification",
model="facebook/bart-large-mnli",
)
classifier(
"My payment was deducted twice.",
candidate_labels=["billing", "technical support", "sales"],
)
## {'sequence': 'My payment was deducted twice.',
## 'labels': ['billing', 'sales', 'technical support'],
## 'scores': [0.8466812372207642, 0.0962134450674057, 0.05710534751415253]}
The categories can change between requests. Adding Legal produces another distribution:
classifier(
"My payment was deducted twice.",
candidate_labels=["billing", "technical support", "sales", "legal"],
)
## {'sequence': 'My payment was deducted twice.',
## 'labels': ['billing', 'sales', 'technical support', 'legal'],
## 'scores': [0.8185835480690002, 0.09302053600549698, 0.05521026626229286, 0.03318570926785469]}
A common implementation uses a model trained for natural language inference. Each candidate label becomes a hypothesis, and the model estimates how strongly the input entails that hypothesis.
Where decision models differ
Decision models extend this pattern beyond assigning an input to one category. They can evaluate several named questions about the same state, with different answer types:
- Choice: select one option from several alternatives.
- Score: evaluate an ordered scale.
- Noul: estimate the probability that a yes-or-no statement is true.
Their interface is organized around probability distributions over possible decisions.
| Property | Classification | Zero-shot classification | Decision model |
|---|---|---|---|
| Probability over choices | Yes | Yes | Yes |
| Labels defined at inference | No | Yes | Yes |
| Multiple typed questions | No | No | Yes |
| Ordered scoring and yes/no decisions | Task-specific | Possible with adaptation | Native primitives |
Decision models do not introduce runtime-defined labels or probabilistic classification by themselves. Their distinction is that these capabilities are combined in a consistent interface, potentially supported by architectures and training methods designed for decision tasks.
The decision model interface
A request contains two components:
statequestions
State
The state is the information being evaluated. It can be a string, a structured JSON object, or other modalities supported by an omni-modal model.
{
"customer_message": "I was charged twice. Please refund me today.",
"subscription": "pro",
"previous_tickets": 2
}
Questions and primitives
Questions specify what the model should determine about the state. The interface defines three fundamental primitives:
- Choice: select one of several possible answers.
- Score: evaluate a value on an ordered scale.
- Noul: answer a binary question probabilistically.
Choice: a probability distribution over options
Choice is the primitive most similar to traditional classification. Suppose the application asks:
Which department should handle this customer request?
The options are Billing, Technical support, and Sales.
from transformers import pipeline
decide = pipeline("decision", model="autotrust/GEV-26B-Decide")
decision = decide(
{
"state": "I was charged twice for my order and want a refund.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments and refunds",
"technical": "Bugs and technical issues",
"sales": "Pricing and subscriptions"
}
}
}
}
)
The model assigns a logit to every option. For logits z₁, ..., zₖ, softmax converts them into probabilities:
pᵢ = exp(zᵢ / T) / Σⱼ₌₁ᵏ exp(zⱼ / T)
Here, K is the number of choices. For example:
| Choice | Probability |
|---|---|
| Billing | 0.998 |
| Technical support | 0.001 |
| Sales | 0.001 |
The probabilities sum to one. The selected answer is the option with the largest probability:
ŷ = argmaxᵢ pᵢ
In this example, the result is Billing. The other probabilities remain useful because they show how the model distributes its belief among the alternatives.
Score: the expectation of an ordered distribution
Choice is appropriate for distinct alternatives. A score is more suitable when the answers form an ordered scale.
For example:
How urgent is this customer request?
The levels can be defined as:
0: Low urgency1: Medium urgency2: High urgency
from transformers import pipeline
decide = pipeline("decision", model="autotrust/GEV-26B-Decide")
decision = decide(
{
"state": "I was charged twice for my order and want a refund.",
"questions": {
"urgency": {
"type": "score",
"instructions": "How urgent is the request?",
"criteria": ["low", "medium", "high"]
}
}
}
)
The model may produce this distribution:
| Level | Probability |
|---|---|
| 0, Low | 0.10 |
| 1, Medium | 0.26 |
| 2, High | 0.72 |
Rather than returning only the most likely level, the Score primitive calculates the expected value of the level index. For a random variable X:
E[X] = Σᵢ₌₀ᵏ⁻¹ i pᵢ
Using the illustrative probabilities:
E[X] = 0(0.10) + 1(0.26) + 2(0.72) = 1.7
The reported score is therefore 1.7. This does not represent a new level between medium and high. It is the expectation of the complete probability distribution.
Noul: a Bernoulli decision
Noul represents a binary question, such as:
Is the customer requesting a refund?
from transformers import pipeline
decide = pipeline("decision", model="autotrust/GEV-26B-Decide")
decision = decide(
{
"state": "I was charged twice for my order and want a refund.",
"questions": {
"refund": {
"type": "noul",
"instructions": "Is the customer requesting a refund?"
}
}
}
)
## {
## 'refund': {
## 'type': 'noul',
## 'noul': 0.9947046637535095
## }
## }
Instead of providing a list of choices, the application receives the probability that the statement is true. This can be understood through the Bernoulli distribution:
Y ~ Bernoulli(p)
P(Y = 1) = p
P(Y = 0) = 1 - p
If the model returns:
{"type": "noul", "noul": 0.92}
it assigns a probability of 0.92 to Yes and 0.08 to No. The model returns the probability parameter rather than randomly sampling a binary result, leaving the application to determine how to act on it.
Confidence: how certain is the model?
Choice and Score results can also include a confidence field. The probability distribution may contain several possible answers, so confidence summarizes how concentrated it is.
For a Choice with K options, confidence is:
(pₘₐₓ - 1/K) / (1 - 1/K)
where pₘₐₓ is the largest predicted probability.
The interpretation is:
- A uniform distribution has confidence
0, because every option is equally likely. - A distribution concentrated entirely on one option has confidence
1. - A larger winning probability relative to a uniform distribution produces higher confidence.
For three choices and a winning probability of 0.99:
C = (3(0.99) - 1) / 2 = 0.98
The winning probability is 0.99, while the normalized confidence is 0.98. The ordered Score example had confidence 0.558 because its probability distribution was less concentrated.
Decision models in the Hugging Face ecosystem
Decision models are a developing area, and they can use different internal designs. Some use heads that score an entire schema jointly, others add separate readouts to LLM backbones, and others target edge-sized or multimodal deployments.
Hugging Face's goal is to establish a common interface without requiring a common implementation. A model can use any internal approach if it accepts the same state and questions and returns the same typed decisions.
A shared contract allows the broader ecosystem to provide common support for:
- Inference engines such as llama.cpp
- Consistent packaging and presentation on the Hub
- Training tools that target shared primitives rather than individual architectures
Serving with Transformers
Transformers supports the DecisionPipeline, AutoModelForDecision, and DecisionConfig classes. They follow the general structure of the pipeline and model classes in transformers, with support designed for decision models.
from transformers import pipeline
decide = pipeline("decision", model="autotrust/GEV-26B-Decide")
print(decide)
## DecisionPipeline: {'model': 'JevForDecision', 'dtype': 'bfloat16', 'device': 'cuda', 'input_modalities': 'text'}
The configuration and model can also be loaded directly:
from transformers import AutoModelForDecision, DecisionConfig
model_id = "autotrust/GEV-26B-Decide"
config = DecisionConfig.from_pretrained(model_id)
model = AutoModelForDecision.from_pretrained(model_id)
Transformers also supports the /v1/systemone endpoint. A local server can be started with the serving dependencies:
pip install "transformers[serving]"
transformers serve
A compatible Transformers version can then receive a decision request:
curl http://localhost:8000/v1/systemone \
-H "Content-Type: application/json" \
-d '{
"model": "autotrust/GEV-26B-Decide",
"state": "I was charged twice. Please refund me today.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments and refunds",
"technical": "Bugs and technical issues",
"sales": "Pricing and subscriptions"
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is the request?",
"criteria": ["low", "medium", "high"]
},
"refund": {
"type": "noul",
"instructions": "Is the customer requesting a refund?"
}
}
}'
The response contains three named answers, each with its typed result and associated probabilities:
{
"model":"autotrust/GEV-26B-Decide",
"answers":{
"department":{
"type":"choice",
"choice":"billing",
"confidence":0.9974000453948975,
"probabilities":{
"billing":0.9982666969299316,
"technical":0.0010246571619063616,
"sales":0.0007087149424478412
}
},
"urgency":{
"type":"score",
"score":1.7525686174631119,
"legend":{"0":"low","1":"medium","2":"high"},
"confidence":0.6288529792800546,
"probabilities":{
"0":0.014000383205711842,
"1":0.2194305807352066,
"2":0.7665690183639526
}
},
"refund":{
"type":"noul",
"noul":0.9953224062919617
}
},
"usage":{"input_tokens":148,"output_tokens":0}
}
The same APIs can work with compatible autoregressive language models. Transformers constructs the decision prompts, evaluates the answer-label logits in a batched forward pass, and applies softmax without generating response text. This makes it possible to experiment with the decision interface without necessarily training a new model.
Serving with llama.cpp
llama.cpp supports decision models through the same /v1/systemone API. A GGUF decision model from the Hub can be launched with:
llama serve -hf ggml-org/Kev-4B-GGUF
The default server uses port 9931. Requests can then be sent to http://localhost:9931/v1/systemone with the same state and questions. When the server has selected the model, the model field can be omitted.
The important feature is compatibility between the interfaces:
curl http://localhost:9931/v1/systemone \
-H "Content-Type: application/json" \
-d '{
"model": "ggml-org/Kev-4B-GGUF",
"state": "I was charged twice. Please refund me today.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments and refunds",
"technical": "Bugs and technical issues",
"sales": "Pricing and subscriptions"
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is the request?",
"criteria": ["low", "medium", "high"]
},
"refund": {
"type": "noul",
"instructions": "Is the customer requesting a refund?"
}
}
}'
Discovering models on the Hugging Face Hub
Hugging Face provides a dedicated decision-model tag for finding compatible models. This is useful because decision models do not need to share one backbone or architecture.
The ecosystem includes models based on encoder architectures such as ModernBERT, as well as models derived from larger generative language-model backbones.
Training decision models with Hugging Face tooling
Decision models integrated into transformers can be fine-tuned with the Trainer API. A small example can adapt JEV-9B to route support requests.
The important elements are:
- Each example contains a decision request, including a
stateandquestions, paired with a correct answer. model.decision_config.prepare_inputsconverts the request into model inputs in the same way as inference.- The model returns one logit per option, so a
choicequestion can use ordinary cross-entropy over the available options.
import os; os.environ["CUDA_VISIBLE_DEVICES"]="2"
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModelForDecision, Trainer, TrainingArguments
checkpoint = "autotrust/JEV-9B"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForDecision.from_pretrained(checkpoint)
examples = [
("I was charged twice. Please refund me.", "refund"),
("My package has not arrived.", "shipping"),
("The application crashes when I open it.", "technical"),
("I want my money back.", "refund"),
("Where is my delivery?", "shipping"),
("I cannot log into my account.", "technical"),
]
options = {
"refund": "Billing issues and refunds",
"shipping": "Orders and deliveries",
"technical": "Software and account issues",
}
def preprocess(text, label):
request = {
"state": text,
"questions": {
"category": {
"type": "choice",
"instructions": "Classify the support request.",
"criteria": options,
}
},
}
(inputs, questions), = model.decision_config.prepare_inputs(
request, tokenizer
)
inputs["marks"] = inputs["marks"].unsqueeze(0)
inputs["num_options"] = torch.tensor([[len(questions[0].options)]])
inputs["question_type_ids"] = torch.tensor([[1]])
inputs["labels"] = torch.tensor(
[questions[0].options.index(label)]
)
return inputs
dataset = [preprocess(text, label) for text, label in examples]
class DecisionTrainer(Trainer):
def compute_loss(self, model, inputs, return_outputs=False, **kwargs):
inputs = inputs.copy()
labels = inputs.pop("labels")
logits = model(**inputs)
logits = logits.unsqueeze(0)
loss = F.cross_entropy(logits.float(), labels)
return (loss, logits) if return_outputs else loss
trainer = DecisionTrainer(
model=model,
args=TrainingArguments(
output_dir="./decision-toy",
max_steps=30,
per_device_train_batch_size=1,
learning_rate=1e-3,
logging_steps=5,
save_strategy="no",
report_to="none",
remove_unused_columns=False,
),
train_dataset=dataset,
data_collator=lambda batch: batch[0],
)
trainer.train()
First-class support for training decision models is also being added to TRL through huggingface/trl#8040. At the time described in the source material, that pull request remained open.
Unsloth provides a recipe for converting a generative LLM into a decision model by fine-tuning models such as Qwen with LoRA and a decision-scoring head.
Final thoughts
Decision models are notable not because classification is new, but because they make decisions and probabilities first-class software outputs.
Traditional classifiers already produce probabilities, and zero-shot classifiers already support categories defined at runtime. Decision models combine these ideas in a typed interface with multiple question primitives, non-generative scoring, and support for specialized training aimed at reliable, calibrated decisions.