Skip to main content
The answer gives you probabilities. Your application still has to act: route the ticket, block the comment, run the tool call or ask a person. There are three ways to turn the probabilities into an action. You can use abstain_below and action_costs together, on any decision.

A threshold in your code

Read the probability you need and compare it with your own threshold:
This keeps every rule in your code, where you can change it without changing the request.

Abstain below a threshold

Give a decision a policy with abstain_below. When p_top is below it, the action is abstain, and you hand the case to a person. Otherwise the action is the likeliest outcome.
The answer gets a policy block:
This is the team question of Route a support ticket. Its 0.6 threshold is the one the playground uses. Measure it on your own tickets before you rely on it.

Weigh what mistakes cost

Give a decision action_costs: for each action, what it costs under each outcome. OneHot picks the action with the lowest expected cost and returns it as policy.action, with every action’s expected cost in policy.expected_costs. Here the question is whether a £1,200 refund is fraudulent. Approving a fraudulent one costs 1,200, and a review costs 15 either way:
  • Give every action a cost for every outcome of the decision.
  • A cost that is the same for every outcome, as review here, is how you price handing a case to a person.
  • With abstain_below as well, the action is abstain whenever p_top is below it, whatever the costs.
  • The costs are yours: they say what mistakes cost your application, not how confident the model is.
Check a tool call before it runs prices three actions this way.

Choose a threshold

A threshold is a trade. Set it higher and fewer cases are handled wrongly, but more go to review.
  1. Collect a few hundred real cases and label the right answer for each.
  2. Score them once, without a policy, and keep the answers.
  3. For a few thresholds, count the wrong actions and the cases sent to review.
  4. Pick the threshold whose numbers your team can live with. Recheck it when you reword the decision or change the model.
To compare models on the same cases instead, upload them as a dataset and compare models. Keep the meaning of each outcome stable, and change the policy rather than the outcomes when your needs change.

Correct a lean towards one outcome

A model can pick one outcome too often, such as sending too many tickets to billing. Before you train a model of your own, try weighting the outcomes. A weight below 1 makes an outcome less likely to come top.
  1. Count the outcomes picked when they were wrong, on the same labelled cases.
  2. Try a few weights for the outcome picked too often, and keep the one that gets most cases right.
  3. Check that weight on labelled cases you didn’t use to choose it.
To use the weights with a threshold too, multiply each probability by its weight, then divide each by their sum, so they add up to 1 again. If no weight helps enough, tune the wording or fine-tune a model.