Code and dense tables are folded away. Open any of them on demand.
What is act-or-escalate routing?
Act-or-escalate routing lets an automated system act on a decision only when its confidence is above a threshold, and hands everything else to a human, a larger model or a safe default. The threshold comes from the relative cost of a wrong action and an unnecessary escalation, and it only works if confidence scores are calibrated.
When a model makes an automated decision, it can fail in two ways. It can act and be wrong: route a legal threat to the sales queue, auto-approve a fraudulent invoice. Or it can escalate when it did not need to: send an obvious password-reset request to a human, burning time and money. Every automated decision system trades these off, whether its designers chose the trade-off or not.
The formal name for this is selective prediction (or classification with a reject option), studied since Chow (1970). The model is allowed to abstain. Two numbers describe how well it does that:
- Coverage: the fraction of inputs the model acts on.
- Selective risk: the error rate on the inputs it acts on.
Lowering the threshold raises coverage and usually raises risk. Plotting one against the other gives a risk-coverage curve, and a good confidence signal is one whose curve stays low as coverage grows (Geifman and El-Yaniv, 2017).
Setting the threshold from costs
If probabilities are calibrated, the threshold can be derived rather than guessed. Say acting wrongly costs C_err, escalating costs C_esc, and acting correctly costs nothing. With probability p that the model is right, acting has expected cost (1 − p) · C_err. Act when that is below the cost of escalating:
Show technical detailsHide technical details· text sample
Examples:
Show technical detailsHide technical details· 3 rows × 4 columns
| Decision | C_err | C_esc | Act when p exceeds |
|---|---|---|---|
| Tag a ticket's topic for analytics | 1 | 2 | always act (threshold below 0) |
| Route a ticket to a queue (misroute costs a re-route) | 5 | 1 | 0.80 |
| Auto-close a security alert as false positive | 100 | 1 | 0.99 |
The last row shows why calibration is not optional. A threshold of 0.99 is only meaningful if "0.99" is actually right 99% of the time. An over-confident model reports 0.99 far more often than it is right at that rate, and the gate lets errors through. See calibrated probabilities and temperature scaling.
In practice the costs are rough, so treat the formula as a starting point and tune the threshold on a labelled validation set against the coverage you can afford to escalate.
What makes a good gating signal
Not every number a model outputs is a good gate. The useful property is discrimination: are correct answers ranked above incorrect ones? This is measured with AUROC, where 0.5 is no better than chance and 1.0 is perfect separation. Hendrycks and Gimpel (2016) showed the plain maximum softmax probability is already a reasonable baseline for detecting misclassified examples.
Two warnings:
- Discrimination and calibration are different. A signal can rank errors well (good AUROC) and still be over-confident in absolute terms (bad ECE). You need ranking to choose which cases to escalate and calibration to choose how many.
- Confidence cannot detect inputs the model cannot read. The Laya model card reports the English checkpoint at 0.000 accuracy with 0.952 confidence on Khmer. No threshold on that confidence would catch it. Out-of-distribution protection has to come from upstream, which for Laya is language routing.
Laya's act head, and why not to use it yet
Laya's decision model includes an act head, designed exactly for this job. It reads the pooled [CLS] representation plus four features of the answer distribution: the top probability, the margin between the top two options, the normalised entropy, and the option count. Its output is returned in every answer as action.act_probability.
The model card is direct: "action.act_probability carries no usable signal yet. It reads 1.0 for almost every input, and its raw logits run against correctness (AUROC 0.30 on 396 labelled decisions). Gate on confidence instead, which reaches an AUROC of 0.77 on the same items."
An AUROC of 0.30 is worse than random: in that evaluation the act head was more likely to favour acting on wrong answers than on right ones. Until a checkpoint fixes this (tracked as issue #185), treat act_probability as a reserved field.
Gating on Laya's confidence
Laya returns two usable signals per answer:
| Field | Definition | Range |
|---|---|---|
confidence (choice, score) | 1 − H(p) / log k, normalised entropy | 0 (uniform) to 1 (one-hot) |
confidence (noul) | max(p, 1 − p) | 0.5 to 1 |
probabilities | temperature-scaled distribution over options | sums to 1 |
A workable procedure:
- Route first. Make sure the input reaches a checkpoint that can read it. Laya Studio does this automatically.
- Collect a labelled sample of a few hundred items per question, drawn from real traffic.
- Calibrate. Fit a temperature per question type and option-count bucket if probabilities are over-confident.
- Plot accuracy against coverage as you vary the
confidencethreshold. - Pick the threshold that meets your error budget, and check the coverage is affordable.
- Monitor. Log the confidence distribution in production; a shift usually signals new kinds of input.
Remember that entropy-based confidence is stricter than the top probability. A four-way answer at 0.91 top probability has a confidence of about 0.71, so a threshold that looks conservative on one field is aggressive on the other. Choose thresholds on the field you gate.
Escalation targets
Escalation does not have to mean a human. Common targets:
- A second, slower model. A large LLM reasons over the uncertain minority. This is the System 1 / System 2 pattern: fast intuition for the bulk, slow deliberation for the hard cases.
- A clarifying question. In a chat agent, ask the user rather than guess.
- A human queue, prioritised by a
scorequestion such as urgency. - A safe default. For guardrails, blocking or sandboxing when uncertain may be the right escalation.
A gated call to Laya Studio
Show technical detailsHide technical details· bash sample
Then gate in your code. The thresholds below are placeholders to be replaced with values tuned on your own labelled data:
Show technical detailsHide technical details· python sample
Two questions read the state twice, billed per input token. See the docs for response fields and /signup for a free-tier key.
Frequently asked questions
Should I use act_probability or confidence to decide when to escalate?
How do I choose a confidence threshold?
Can confidence gating catch every mistake?
Should each question have its own threshold?
What should I escalate to?
What is selective prediction?
When should AI escalate to a human?
Sources
- Chow (1970), On Optimum Recognition Error and Reject Tradeoff
- Geifman & El-Yaniv (2017), Selective Classification for Deep Neural Networks
- Hendrycks & Gimpel (2016), A Baseline for Detecting Misclassified and Out-of-Distribution Examples
- Laya model card: Honest Limits
- Laya issue #185: act_probability carries no usable signal
Last updated . Laya Studio is an independent hosted service for the open-source Laya model (Apache-2.0, © Convai Innovations) and is not affiliated with Convai Innovations or TypeSafe.
Next articleMultilingual classification: one decision, many languagesHow to classify text in many languages: translation, per-language models, multilingual encoders or LLMs. Why English-only models fail confidently.