Architecture · 10 minute read

How Laya works

A bidirectional encoder reads the full state and option text. A decision head scores dedicated markers for every answer, then returns typed probability distributions without decoding a sentence token by token.

The request has two parts

State is the material being judged: a ticket, email, conversation, prompt, log or JSON document. Questions define the decisions your software accepts, including instructions and criteria. Laya renders both into one model input.

INPUT

State

The evidence to inspect. It can include structured fields and natural-language content.

SCHEMA

Typed questions

Each question declares one output type and the criteria used to interpret it.

MODEL

Encoder + decision head

The state and all question markers are evaluated in one forward pass.

OUTPUT

Probabilities and confidence

The response conforms to the declared type, ready for code to consume.

Why non-autoregressive matters

A chat model normally produces output one token after another. For a bounded classification job, that means paying for generation, validating JSON and handling answers that do not match the schema. Laya does not generate a string. It assigns scores to predefined answer markers and normalizes them into probabilities.

This is why multiple narrow questions can be evaluated together and why the output cannot contain an unknown label. The trade-off is equally important: Laya cannot explain its reasoning, write a reply or invent a new action. Your code still owns control flow and side effects.

Choice: select one supplied option

A choice question supplies a set of labels plus descriptions. Laya returns a probability for each label and selects the highest one. This works well for routing and categorization when labels are concrete and mutually intelligible.

Good question shape

Which team should handle this request?

billing: invoices and refunds · technical: bugs and outages · sales: pricing and contracts

Choice is not infinitely scalable. The criteria share a fixed option-token budget. With dozens of verbose labels, descriptions are truncated until they become hard to distinguish. Laya’s own Banking77 result shows this limit clearly.

Score: distribute probability across ordered levels

A score question defines an ordered rubric such as low, medium and high urgency. The model returns probability across the levels and a probability-weighted expected score, which can fall between discrete levels.

Use a behavioral rubric

Write observable criteria—“service is unavailable and work is blocked”—instead of vague adjectives such as “very urgent.” Ordered scoring is currently Laya’s weakest primitive, so domain validation is especially important.

Noul: estimate P(true)

A noul question asks for a yes/no probability. It is best treated as a detector for a specific, observable fact: whether the user explicitly asked for a refund, whether a prompt contains an instruction to reveal secrets, or whether a message includes a cancellation threat.

Broad judgments such as “is this appropriate?” combine many unstated norms and often produce unstable results. Decompose them into narrower factual questions before combining them in code.

The three checkpoints

CheckpointBackboneContextBest fit
laya421M ModernBERT-large512 tokensEnglish tasks and supplied presets
laya-multilingual322M mmBERT-base1,024 by default; encoder supports moreNon-English and mixed-language state
laya-typed-decisions421M ModernBERT-large1,024 tokensThe four workflow families used in typed-decisions training

The project includes a router that chooses between English and multilingual checkpoints based primarily on script and language signals. This matters because the English checkpoint can remain highly confident while failing on scripts it does not handle well.

What “calibrated” should mean

If a model is calibrated, predictions issued at roughly 80% confidence should be correct roughly 80% of the time over comparable cases. That property allows software to automate above a threshold and escalate below it.

Laya’s RLCD training rewards probability quality with proper scoring rules, but calibration can shift across domains and label counts. The repository recommends fitting temperatures on held-out data. Always plot accuracy by confidence bucket and check for confident errors before automating consequential decisions.

What Laya cannot do

Source: Laya README and code, Hugging Face model card, and the project benchmark report. Explanations here are independent paraphrases.