Code and dense tables are folded away. Open any of them on demand.
What is a typed decision?
A typed decision is a question to an AI model where you declare the answer type and the allowed options before it reads the input: one label from a list, a level on a scale, or the probability that a statement is true. The model returns only a value from that space, with probabilities, so code can act on it.
Most software that "uses AI to decide" is really asking a question with a small, known answer space. Which team should own this ticket? How urgent is it? Is this message a phishing attempt? The answer is not an essay. It is a value from a set you already know: a label, a level on an ordinal scale, or a yes/no probability.
A typed decision makes that explicit. Before the model reads the input, you declare three things:
- The state: the thing being judged, such as an email, a ticket, a JSON record or a conversation.
- The question: a short natural-language instruction, for example "Which department should handle this request?"
- The answer type and its options: the set of labels, the ordered levels, or the true/false pair that a valid answer must come from.
The model's job is then narrow and checkable. It does not write an answer. It distributes probability over answers you already enumerated. Every output is valid by construction, because the only things it can return are the things you listed.
This is the same idea as a type signature in a programming language. A function typed (Ticket) -> Department cannot return a haiku. A typed decision model cannot either.
Why typed decisions beat free-text answers in production
The usual alternative is to prompt a generative model ("Reply with one of: billing, technical, sales, other") and parse what comes back. That works in a demo and becomes a maintenance problem at volume.
| Concern | Free-text LLM answer | Typed decision |
|---|---|---|
| Output validity | Must be parsed and validated; can drift ("Billing.", "billing team", "I think billing") | Always one of the declared options |
| Probabilities | Not returned by default; verbalised confidence is unreliable | A full distribution over the options |
| Thresholding | Hard: there is no number to threshold | Natural: gate on confidence or a class probability |
| Out-of-set answers | Possible (an invented category) | Impossible by construction |
| Cost driver | Input plus generated output tokens | One forward pass per call |
| Auditing | Log a string and hope it parses the same way next month | Log a distribution and the options it was over |
The deeper benefit is that a typed answer composes with ordinary code. A choice feeds a switch statement. A score feeds a sort order or an SLA timer. A noul probability feeds an if p > 0.8 gate. None of these need a second model to interpret the first one's prose.
Typed decisions do not remove the need to evaluate. A typed model can still pick the wrong option with high probability. What typing removes is a whole class of format failures, so the failures you are left with are judgement failures, which you can measure with accuracy and calibration metrics. See calibrated probabilities for why the distribution matters as much as the argmax.
The anatomy of a typed decision request
A typed decision request has a fixed shape. Laya uses the same shape as TypeSafe's Jev decision API, which introduced the /v1/systemone protocol:
Show technical detailsHide technical details· json sample
statecan be a string, an object or a list (for example a conversation). Objects are serialised to JSON before the model reads them, so field names such assubjectandbodyare visible to the model and can be referenced in instructions.questionsis a map from your own ids to question definitions. The ids come back unchanged in the response, so you never match answers by position.typeis one of three primitives:choice,scoreornoul. They are covered in depth in choice, score and noul.criteriadefines the answer space. Forchoiceit is a map of label to description (or a plain list of labels). Forscoreit is an ordered list of level descriptions, index 0 first. Fornoulit is optional and can describe whattrueandfalsemean.
How Laya implements typed decisions
Laya is an encoder model, not a text generator. For each question it builds one token sequence:
Show technical detailsHide technical details· text sample
Every option gets its own [MASK] marker. The encoder (ModernBERT-large for the English checkpoint, mmBERT-base for the multilingual one) reads the whole sequence bidirectionally, a small two-layer decision head refines it, and a scorer reads one logit off each marker. A softmax over those logits is the answer distribution. A learned type embedding tells the model whether it is answering a choice, score or noul. The mechanics are described in option-marker scoring.
Three consequences follow directly from that design:
- The answer space is defined at request time. There is no fixed label head, so a new schema needs no retraining. You can change the options on the next call.
- All questions in a call run in one batched forward pass. The model card reports 39.5 ms for one question and 158.6 ms for ten on the English checkpoint on a T4 GPU, and 32.8 ms and 72.3 ms on the multilingual checkpoint.
- Nothing is generated. The response contains no free text from the model, so there is nothing to parse. See hallucination-free decisions for what that does and does not guarantee.
The output for each question is typed as well:
| Question type | Main field | Also returned |
|---|---|---|
choice | choice: the argmax label | probabilities per label, confidence |
score | score: expected level, sum of i × p(i) | probabilities per level, legend, confidence |
noul | noul: probability the statement is true | confidence = max(p, 1 − p) |
The typed-decisions benchmark and checkpoint
"Typed decisions" is also the name of a specific benchmark: 400 cases and 2,000 decisions across four synthetic workflows (customer service, invoice processing, security incidents and agent-trace observability). The Laya family includes a checkpoint fine-tuned on that benchmark's training split, laya-typed-decisions.
The model card reports, on that benchmark:
Show technical detailsHide technical details· 6 rows × 4 columns
| Model | Accuracy | Brier | ECE |
|---|---|---|---|
laya-typed-decisions | 0.766 | 0.062 | 0.213 |
laya (English base) | 0.362 | 0.316 | 0.175 |
laya-multilingual | 0.342 | 0.439 | 0.285 |
| Jev 1.13.0 (third-party published) | 0.727 | 0.148 | 0.144 |
| Teacher self-agreement ceiling | 0.735 | ||
| Per-question majority class | 0.461 |
Two honest readings. First, the fine-tuned checkpoint is strong on the workflows it was trained on. Second, the base checkpoints are below the majority-class baseline on this benchmark zero-shot. The card says it plainly: Laya is "a fast base to specialise, not a zero-shot decision engine" for this kind of multi-field workflow. If your schema resembles one of the four workflows, the specialised checkpoint is worth trying. If it does not, plan to evaluate the base checkpoints on your own data, and consider fine-tuning. The trade-off is discussed in zero-shot vs fine-tuned.
Designing typed questions that work
A few rules drawn from the model card's limitations and from how the sequence is built:
- Keep option sets small. Options share a fixed option budget (
head_max_len, 192 tokens on the English checkpoint, 256 on multilingual). At 77 options each label gets roughly 3 to 4 tokens, and on Banking77 Laya scores 0.425 against Jev's published 0.870. For large label spaces, split into a coarse question and a fine question. - Describe options, do not just name them.
"billing": "invoices, payments, refunds"gives the scorer something to match against. Descriptions are truncated at 48 tokens per option. - Include an escape option. An
otherchoice lets the model put mass somewhere honest when nothing fits. - Check
noulon your data. The card documents thatnoulcan follow itsfalse:/true:labels rather than the state. If answers look stuck, ask the same thing as a two-optionchoicewith neutral keys. - Treat
scoreas the weakest primitive. The card reports SST-5 at 0.372. Use few, clearly separated levels. - Calibrate before you threshold. The checkpoints ship over-confident. See temperature scaling.
Try it: a typed decision request to Laya Studio
Laya Studio hosts the open Laya checkpoints behind the /v1/systemone protocol. Get a key at /signup and send:
Show technical detailsHide technical details· bash sample
The response has this shape (the numbers are illustrative, not a benchmark; routing.detection is trimmed):
Show technical detailsHide technical details· json sample
This call is billed its input tokens (1 credit = 1 input token); each of the three questions reads the state once. See /pricing for the 5 free runs and plans, and /docs for the full reference.
Frequently asked questions
Is a typed decision the same as classification?
Can I change the options without retraining?
Why is output_tokens always 0?
When should I use the typed-decisions checkpoint?
How many credits does a typed decision cost on Laya Studio?
What are the three types of typed questions?
Do typed decisions stop AI hallucinations?
Sources
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 articleChoice, score and noul: three primitives for typed decisionsChoice picks a label, score places text on a scale, noul gives the probability a statement is true. How each works in Laya, when to use it and where it is weak.