Decision Models With Confidence Scores: Probability Calibration, Threshold Tuning and When to Defer
A confidence score supports a decision only after it is calibrated on held-out data and paired with a threshold set from the cost of mistakes. Low-confidence cases then go to a person for review.
A decision model with confidence scores is useful only when each score is a calibrated predicted probability of a named event, such as "this ticket belongs to billing." Probability calibration on held-out data makes a score of 0.8 mean that about 80 percent of such predictions are correct. Decision threshold tuning then sets the cut-off from the cost of each kind of mistake, because the default 0.5 rarely fits. Anything below the cut-off should be deferred to a person, and the model's pick stays a recommendation that the application must still authorize.
Confidence and predicted probability are different numbers that answer different questions
Three kinds of number are often all called "confidence," and they estimate different things.
- A raw score is the model's internal output, such as a logit or a
decision_functionvalue. It ranks inputs, but a raw score of 2.3 has no fixed meaning as a likelihood. - A predicted outcome probability estimates how likely a specified event is, such as "this ticket belongs to the billing team." It is useful only when the event is written down precisely.
- A confidence that the selected option is correct is the probability attached to the option that the model picked. In a four-team router, it is the largest of the four team probabilities.
The scikit-learn user guide, in its 1.9.1 version, defines the goal plainly. A well-calibrated classifier's predict_proba output "can be directly interpreted as a confidence level." Of the samples that receive a value close to 0.8, about 80 percent should belong to the positive class.
Each of these numbers covers only the classification or ranking step. A probability that a ticket belongs to billing does not estimate whether the billing team will resolve it. It also does not settle the arguments of an action, such as which order to refund or how much to refund. It says nothing about whether the system is allowed to take the action at all. Those are separate events, and each needs its own estimate or its own rule.
Probability calibration makes a score of 0.8 mean that about 80 percent of such picks are right
Many models produce scores that are well ordered but poorly scaled. The scikit-learn guide says that LogisticRegression is "more likely to return well calibrated predictions by itself," while naive Bayes tends to push probabilities toward 0 or 1. Random forests show a sigmoid-shaped error. For neural networks, Guo and colleagues reported at ICML 2017 that modern networks are "poorly calibrated."
Calibration fits a second, small model that maps the classifier's output to a probability between 0 and 1. The guide sets a strict rule for the data. The calibrator should be fit on data that is independent of the classifier's training data, because reusing training predictions "would thus result in a biased calibrator." For a model that is already trained, the guide recommends wrapping it as CalibratedClassifierCV(estimator=FrozenEstimator(model)) and keeping the two datasets disjoint.
The guide offers three methods, and the choice depends mostly on how much calibration data you have.
- The sigmoid method, also called Platt scaling, fits two parameters. The guide says that it works best for small samples or under-confident models, but it assumes that a sigmoid shape can fix the error.
- The isotonic method fits any increasing curve. The guide says that it performs as well as or better than sigmoid with more than about 1,000 samples, and that it overfits more easily on small datasets.
- The temperature method divides the logits by one learned value. It does not change which class scores highest, so it does not alter accuracy, and it uses one parameter for a multiclass problem.
A reliability diagram is the standard check. scikit-learn bins the predictions, then plots the average predicted probability in each bin against the fraction that turned out positive. A calibrated model's points lie close to the diagonal. The display also shows how many samples fall in each bin, which matters because a bin with 15 tickets cannot confirm much.
Summary scores such as the Brier score can hide calibration problems. The guide says that Brier score and log loss mix calibration with discrimination and with the randomness of the data. A lower Brier loss "does not necessarily mean a better calibrated model." Look at the diagram and its sample counts, not one number.
Decision threshold tuning sets the cut-off from the costs of each mistake
Calibration estimates how likely an outcome is. It does not decide what to do about that outcome. By default, scikit-learn predicts the positive class when the probability is above 0.5. Its threshold guide calls such hard-coded cut-offs "most certainly not ideal for most use cases."
The right cut-off comes from costs. Suppose that a misrouted ticket costs $12 in rework and delay and that a human review costs $3. Routing a ticket automatically has an expected cost of the error probability times $12. Review costs $3 for certain. Automatic routing is cheaper when the confidence exceeds 1 − 3/12, which is 0.75. These dollar figures are assumptions for illustration, and you should replace them with your own.
scikit-learn's TunedThresholdClassifierCV, added in version 1.5, searches for the threshold that maximizes a metric that you choose. Its API page says that it works "by optimizing a binary metric," so it fits yes-or-no decisions such as "route automatically or not." The threshold guide's warning applies to any method: "You should never use the same data for training the classifier and tuning the decision threshold." The example below uses a separate threshold split for that reason.
Threshold tuning and calibration are different steps that are easy to confuse. Calibration changes what the scores mean. Threshold tuning changes which action follows a given score. A model can be well calibrated and still use a poor threshold, and a tuned threshold on badly calibrated scores can work on one dataset and fail when the score scale shifts.
Confidence-based deferral sends uncertain tickets to a person instead of guessing
Deferral adds a third outcome to "route to team A" and "route to team B." The third outcome is "send to review." Geifman and El-Yaniv describe this as selective classification, or a reject option, in which the model gives up some coverage to lower its error on the inputs that it keeps.
The useful report for deferral is error against coverage. Sort the test tickets from most to least confident. Then report the error rate among the top 25, 50, 75 and 100 percent. A router that reaches low error only at 10 percent coverage saves little review work. A router that holds low error at 70 percent coverage can remove most of the review work.
Rules, a calibrated classifier and an option scorer each fit a different routing problem
The right model depends on how stable the list of options is and how much labeled history you have.
| Approach | Sufficient when | What the score means | Evaluate further when |
|---|---|---|---|
| Rules | A form field or account flag already decides the team | No probability; the rule is either met or not met | Exceptions and manual overrides grow |
| Probabilistic classifier with calibration | The team list is fixed and thousands of labeled tickets exist | Calibrated probability per team | The team list changes often or labels are scarce |
| TOD, a supplied-option scorer | The allowed options differ by request, or inputs include images | One probability per supplied option, summing to 1 | Frozen held-out accuracy at your target coverage falls short |
Rules are sufficient when a field in the ticket already decides the destination. If a ticket form already asks "Is this about a payment?", a rule routes it with no model and no calibration. Rules give no probability, so log every manual override to see when the rule stops working.
A calibrated classifier fits the common case of a fixed set of teams and a long history of resolved tickets. Its scores can be calibrated with the tools above, and the isotonic method becomes practical once the calibration split holds more than about 1,000 tickets.
An option scorer fits when the set of allowed choices is part of the input. That happens when different customer plans may reach different teams, or when the list of teams changes faster than a classifier can be retrained.
Domain tuning deserves evaluation only after the frozen model has been measured on your own held-out tickets. Tuning is not guaranteed to improve results. On Parsec's own public JevBench evaluation, the trained TOD release scored 84.4 percent accuracy against 86.2 percent for its untrained base model.
Parsec's TOD scores a supplied list of options, and its published figures are Parsec's own
Parsec, a small language model lab, publishes TOD as what it calls a "universal decision model." According to its TOD page, TOD takes text, images and task state as input and ranks the next action from a list of allowed actions. It generates no free text and invents no actions. A confidence gate lets TOD serve a turn when its confidence is high and passes the turn unchanged to the parent LLM otherwise. The page prices TOD at $0.30 per 1,000 decisions, separate from parent-model costs.
The release that anyone can download is LoRA adapters on google/gemma-4-12B-it plus a ModernBERT-base retriever, according to its Hugging Face model card. The base weights are not included, and users must accept the Gemma 4 licence. The TOD page also describes a compact encoder that scores actions, and it does not reconcile that description with the Gemma-based release. Treat the Gemma-based picker as the artifact to test. Pin it with snapshot_download("parsecai/tod", revision=...) and a full-length commit hash, as the Hugging Face download guide requires, and record the page's "TOD decision v1 release evaluation, 29 September 2026" label beside it.
Some of what Parsec publishes is description and some is measurement. The repository describes the probabilities from predict() as calibrated, which is Parsec's own description. The JevBench accuracy figures are Parsec's own evaluation, not an independent one. The repository also says that TOD is not state of the art on JevBench. It warns against sdpa attention and bitsandbytes int8 quantization, which it says flips some picks.
A reproducible ticket-routing example keeps training, calibration, threshold and test data apart
The routing problem in this example has a defined state, a defined option set and a defined event. The state is the ticket text. The allowed options are four teams: billing, shipping, technical and account. The score for each team estimates the probability that the team is the correct destination. The confidence for a ticket is the largest of those probabilities.
The data is split four ways, and each split has one job.
- The training split, 50 percent of tickets, fits the classifier.
- The calibration split, 15 percent, fits the calibrator on a frozen classifier.
- The threshold split, 15 percent, chooses the deferral cut-off by expected cost.
- The test split, 20 percent, is used once to report accuracy, coverage, error and the reliability diagram.
With 10,000 labeled tickets, those splits hold 5,000, 1,500, 1,500 and 2,000 tickets. The script prints the actual counts for your file. The code below runs with scikit-learn 1.9.1 on a CSV that has text and team columns.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.calibration import CalibratedClassifierCV, CalibrationDisplay
from sklearn.frozen import FrozenEstimator
TEAMS = ["billing", "shipping", "technical", "account"] # the allowed options
MISROUTE_COST, REVIEW_COST = 12.00, 3.00 # illustrative assumptions, in dollars
df = pd.read_csv("tickets.csv") # one row per ticket: text, team
# Four disjoint splits: 50% train, 15% calibration, 15% threshold, 20% test.
train, rest = train_test_split(df, train_size=0.50, stratify=df.team, random_state=0)
calib, rest = train_test_split(rest, train_size=0.30, stratify=rest.team, random_state=0)
thresh, test = train_test_split(rest, train_size=3 / 7, stratify=rest.team, random_state=0)
for name, part in [("train", train), ("calibration", calib),
("threshold", thresh), ("test", test)]:
print(f"{name}: {len(part)} tickets")
# Step 1: fit the classifier on the training split only.
clf = make_pipeline(TfidfVectorizer(min_df=2), LogisticRegression(max_iter=1000))
clf.fit(train.text, train.team)
# Step 2: calibrate the frozen classifier on the calibration split only.
cal = CalibratedClassifierCV(FrozenEstimator(clf), method="temperature")
cal.fit(calib.text, calib.team.to_numpy())
def classifier_scores(texts, labels):
proba = cal.predict_proba(texts)
pick = cal.classes_[proba.argmax(axis=1)]
return proba.max(axis=1), pick == labels.to_numpy()
# Step 3: choose the deferral threshold by expected cost on the threshold split.
def expected_cost(conf, correct, t):
routed_cost = np.where(correct, 0.0, MISROUTE_COST)
return np.where(conf >= t, routed_cost, REVIEW_COST).mean()
def pick_threshold(conf, correct):
grid = np.linspace(0, 1, 101)
return grid[int(np.argmin([expected_cost(conf, correct, t) for t in grid]))]
def report(name, conf, correct, t):
auto = conf >= t
print(f"{name}: n={len(conf)} threshold={t:.2f} coverage={auto.mean():.3f} "
f"error_when_routed={1 - correct[auto].mean():.3f} "
f"cost_per_ticket=${expected_cost(conf, correct, t):.2f}")
order = np.argsort(-conf)
err = np.cumsum(~correct[order]) / np.arange(1, len(order) + 1)
for c in (0.25, 0.5, 0.75, 1.0):
print(f" error at {c:.0%} coverage: {err[int(c * len(order)) - 1]:.3f}")
CalibrationDisplay.from_predictions(correct, conf, n_bins=10,
strategy="quantile", name=name)
plt.savefig(f"reliability_{name}.png")
t_clf = pick_threshold(*classifier_scores(thresh.text, thresh.team))
# Step 4: report once on the untouched test split.
report("classifier", *classifier_scores(test.text, test.team), t_clf)
# Optional: a frozen option scorer that returns one probability per allowed option.
# `picker` is the pinned TOD release, loaded as its repository README describes.
def option_scores(picker, texts, labels):
probs = np.array([picker.predict(f"Ticket: {t}", TEAMS,
"Which team should handle this ticket?")
for t in texts])
pick = np.array(TEAMS)[probs.argmax(axis=1)]
return probs.max(axis=1), pick == labels.to_numpy()
# t_tod = pick_threshold(*option_scores(picker, thresh.text, thresh.team))
# report("tod_frozen", *option_scores(picker, test.text, test.team), t_tod)
The script treats each prediction as a yes-or-no event: was the top pick correct? That event is what calibration_curve and CalibrationDisplay expect, because both assume binary input. The diagram therefore checks the confidence of the selected option, which is the number that the deferral rule uses. It saves one reliability diagram for each model.
The same splits and the same threshold code serve TOD. Pass the four teams as the supplied options and compare the frozen release with the calibrated classifier on identical test tickets. If TOD's frozen probabilities fall off the diagonal, refit a calibrator for its top-pick confidence on the calibration split, exactly as for the classifier.
No held-out decision accuracy, calibration or error-versus-coverage results for a calibrated classifier and a frozen TOD baseline on a real ticket set have been published. The numbers that this script prints for your data are the evidence that the choice needs.
A worked routing-cost example shows where the threshold and the savings come from
The figures below are illustrative assumptions, not measurements. They show how the pieces combine.
Assume 40,000 tickets a month, a $3 review, a $12 misroute and an 80 percent overall accuracy for the router. The table compares three policies under those assumptions.
| Policy | Misroute cost | Review cost | Monthly total |
|---|---|---|---|
| Review every ticket | $0 | $120,000 | $120,000 |
| Route every ticket automatically | $96,000 | $0 | $96,000 |
| Route above 0.75, review the rest | $23,040 | $48,000 | $71,040 |
The gated row assumes that 60 percent of tickets clear the 0.75 break-even point and that 8 percent of those are misrouted. That gives 24,000 × 0.08 × $12 in misroutes and 16,000 × $3 in reviews.
At TOD's list price, 40,000 decisions cost $12 a month. That fee is small beside review and misroute costs, so the choice between models rests on held-out accuracy and coverage rather than on the scoring fee.
The model's pick stops at a recommendation. A ticket routed to billing may ask for a refund. The router selected the team. It did not set the refund amount or check whether the customer may receive one. The application must enforce those permissions in code, outside the model, before any action runs.
Calibration fitted on last month's tickets can drift when traffic or the team list changes
A calibrator fits the relation between scores and outcomes for the traffic that it saw. Ovadia and colleagues found that traditional post-hoc calibration "does indeed fall short" under dataset shift. A new product launch, a holiday surge or a new support channel can all change that relation.
The candidate set matters as much as the traffic. An option scorer's probabilities sum to 1 over the options that you supply, and a classifier's probabilities sum to 1 over its fixed classes. Adding a fifth team or hiding one team for some customers changes every probability. A calibration fit on four options should not be trusted on five without a new check.
A practical schedule keeps the guarantees current with a few steps.
- Hold back a fresh labeled sample each month and redraw the reliability diagram with its sample counts.
- Refit the calibrator and re-select the threshold whenever the diagram drifts from the diagonal or the error at your chosen coverage rises.
- Recalibrate and re-test before launch whenever the list of allowed teams changes.
- Re-pin and re-test any model update, including a new release of an option scorer, before it reaches production traffic.
Sources
- scikit-learn 1.9.1, Probability calibration: https://scikit-learn.org/stable/modules/calibration.html
- scikit-learn 1.9.1, Tuning the decision threshold for class prediction: https://scikit-learn.org/stable/modules/classification_threshold.html
- scikit-learn, TunedThresholdClassifierCV: https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TunedThresholdClassifierCV.html
- scikit-learn, calibration_curve: https://scikit-learn.org/stable/modules/generated/sklearn.calibration.calibration_curve.html
- scikit-learn, CalibrationDisplay: https://scikit-learn.org/stable/modules/generated/sklearn.calibration.CalibrationDisplay.html
- scikit-learn, FrozenEstimator: https://scikit-learn.org/stable/modules/generated/sklearn.frozen.FrozenEstimator.html
- Guo et al., On Calibration of Modern Neural Networks: https://arxiv.org/abs/1706.04599
- Ovadia et al., Can You Trust Your Model's Uncertainty?: https://arxiv.org/abs/1906.02530
- Geifman and El-Yaniv, Selective Classification for Deep Neural Networks: https://arxiv.org/abs/1705.08500
- Hugging Face, Download files from the Hub: https://huggingface.co/docs/huggingface_hub/guides/download
- Parsec, TOD: https://parseclab.ai/tod/
- Parsec, TOD model card: https://huggingface.co/parsecai/tod
- Parsec, TOD repository: https://github.com/daseinlabs/tod