Code and dense tables are folded away. Open any of them on demand.
At a glance: Laya vs Zero-shot NLI classifiers
Showing 11 of 11 rows.
| Feature | Laya (via Laya Studio) | Zero-shot NLI classifiers |
|---|---|---|
| Core idea | Score every option at its own [MASK] marker in one sequence | Treat each label as a hypothesis ("This text is about {label}.") and score entailment |
| Forward passes per question | One sequence per question; all questions batched into one pass | One pass per candidate label |
| Option interaction | Options are encoded together, so the model sees the alternatives | Each label is judged in isolation, then normalised |
| Question types | choice, score (ordinal rubric) and noul (yes/no) | Single-label or multi-label classification via a hypothesis template |
| Training objective | RLCD against strictly proper scoring rules, on decision data | Cross-entropy on NLI pairs (entailment / neutral / contradiction) |
| Probabilities | Softmax over your options with per-type temperatures; needs refit for calibration | Entailment scores re-normalised over labels; not trained as class probabilities |
| Latency, 1 question | 39.5 ms (English) / 32.8 ms (multilingual) on a T4, in-process | Grows linearly with the number of labels |
| Many labels | Options share a token budget; keep under ~20 (Banking77 0.425) | No shared budget, but cost scales with label count |
| Multilingual | Automatic routing to mmBERT-base checkpoint; XNLI non-English 0.731 | Needs a multilingual NLI model (e.g. XLM-R trained on XNLI) |
| Hypothesis template | Not needed: instructions + option descriptions | Accuracy is sensitive to the template wording |
| Hosting | Laya Studio API or self-hosted Apache-2.0 weights | Self-host from the Hugging Face Hub or a hosted inference endpoint |
The verdict
NLI zero-shot remains a fine, free baseline for a handful of labels; Laya is the better fit when you need several typed questions per input, ordinal scores, one-pass latency and automatic language routing.
What is zero-shot NLI classification, and how is Laya different?
Zero-shot NLI classification uses a natural language inference model to test each candidate label as a hypothesis, such as "This text is about billing", and ranks labels by how strongly the text supports each one. It needs no training data but runs one pass per label. Laya scores all options together in one pass.
Natural language inference (NLI) models are trained on premise–hypothesis pairs and predict entailment, neutral or contradiction. Yin, Hay and Roth (2019) observed that this gives a classifier for free. Take the input text as the premise, turn each candidate label into a hypothesis such as "This text is about billing.", and rank labels by entailment probability. The facebook/bart-large-mnli checkpoint on the Hugging Face Hub, served through the zero-shot-classification pipeline, made the method a default for teams who needed classification without training data.
The method has three properties you will notice in production:
- One forward pass per label. Ten labels means ten premise–hypothesis pairs. Batching keeps it on the GPU, but compute grows linearly with the label count.
- Labels are judged independently. The model never sees "billing" and "refund" side by side. It scores each against the text and the scores are normalised afterwards.
- Template sensitivity. "This example is {label}." and "The customer wants {label}." can give noticeably different results, and there is no training signal telling you which to use.
Laya Studio is an independent API powered by the open-source Laya model. It is not affiliated with Laya's authors, Convai Innovations. For the concepts, see zero-shot vs fine-tuned and typed decisions.
How does Laya score options instead?
Laya is also an encoder (ModernBERT-large for English, mmBERT-base for 100+ languages), but it was trained for the decision task directly rather than on NLI pairs. For each question it builds a single sequence containing the instructions, every option and the state:
Show technical detailsHide technical details· text sample
A decision head reads one logit at each [MASK], and the softmax over them is the answer. This differs from NLI in two ways:
- The options see each other. Self-attention runs across all the option texts, so the model can tell "refund" apart from "billing_question" because both are in view. That matters for fine-grained, overlapping labels.
- One sequence per question, and every question in the same pass. A request with a 5-way choice, a 4-level score and three yes/no flags is scored in one forward pass. NLI would need 5 + 4 + 3 = 12 premise–hypothesis evaluations for the same request, plus glue code to interpret the score as ordinal.
The response is typed. choice returns the winning key, the per-option probabilities and a confidence. score returns the probability-weighted level and a legend. noul returns P(true). See choice, score and noul and option-marker scoring.
What does the difference look like? A side-by-side example
The usual NLI pipeline in Python:
Show technical detailsHide technical details· python sample
The same decisions as one Laya Studio request:
Show technical detailsHide technical details· bash sample
The response carries answers keyed by your question ids, a usage block with input_tokens and output_tokens: 0, and a routing object that says which checkpoint answered and why. Laya picks the English or the multilingual checkpoint from the script and language of the state. The same call from TypeScript:
Show technical detailsHide technical details· typescript sample
Which is faster and cheaper?
The NLI approach costs one encoder pass per candidate label, per question. For a single question with a few labels on a GPU that is fast. The cost grows with every label and every extra question, and on CPU it becomes the bottleneck quickly.
Laya's figures from its model card (Tesla T4, in-process, excluding network):
| Questions per call | laya (English, 421M) | laya-multilingual (322M) |
|---|---|---|
| 1 | 39.5 ms | 32.8 ms |
| 5 | 84.5 ms | 40.1 ms |
| 10 | 158.6 ms | 72.3 ms |
| 50 | 771 ms | 337 ms |
We do not quote NLI latency numbers here because they depend heavily on model size, label count, hardware and batching. Measure both on your own label set. The structural point holds either way: NLI work scales with questions × labels, while Laya's scales with questions, and those share a batch.
On cost, self-hosted NLI is free apart from hardware, and so is self-hosted Laya, since its weights are Apache-2.0. Laya Studio charges per input token (1 credit = 1 input token), 30% below Jev's list price, with 5 free runs; see pricing.
Which is more accurate, and which handles more languages?
Laya's own model card reports results on XNLI, the cross-lingual NLI benchmark that zero-shot NLI models are usually trained or evaluated on:
Show technical detailsHide technical details· 2 rows × 4 columns
| XNLI | laya (English) | laya-multilingual | Routed |
|---|---|---|---|
| English | 0.860 | 0.843 | 0.860 |
| 14 other languages | 0.521 | 0.731 | 0.731 |
On topic-style classification the card reports AG News (4 labels) at 0.950 routed, and DAIR Emotion (6 labels) at 0.595. On MASSIVE intent with 20 options, the routed system scores 0.783 on English and 0.451 across 13 other languages. The multilingual checkpoint clears three times random on 45 of the 51 MASSIVE languages.
For non-English work with NLI you need a multilingual NLI model, typically an XLM-R model trained on XNLI. You also have to choose it yourself. Laya Studio routes by script before inference. That matters because the English checkpoint does not degrade gracefully outside English: on Khmer it scored 0.000 accuracy at 0.952 confidence. See language routing and multilingual classification.
Where NLI can hold up better: large label sets. Each NLI hypothesis gets the model's full attention, while Laya's options share one head_max_len budget (192 tokens on English, 256 on multilingual). At 77 labels, Laya's Banking77 accuracy is 0.425. For big taxonomies, split them into a coarse-to-fine hierarchy with Laya, or keep a per-label scorer.
Where both are weak: novel multi-field business rubrics with no fine-tuning. Laya's base checkpoints score 0.362 on the typed-decisions benchmark, below the majority-class baseline. A fine-tuned Laya reached 0.766.
Are zero-shot probabilities calibrated?
NLI zero-shot scores are entailment probabilities re-normalised across your labels. They were never trained to be calibrated class probabilities for your task, and in multi-label mode each label gets an independent entailment score whose scale depends on the template. Teams usually end up picking thresholds by trial and error.
Laya is trained with RLCD, reinforcement learning whose reward is a strictly proper scoring rule: log score plus spherical score, and a ranked probability score for ordinal questions. The intent is that honest probabilities maximise reward (see proper scoring rules). The model card is candid that the checkpoints still ship over-confident. Refitting one temperature per (question type, option count) on held-out data moves mean ECE from 0.466 to 0.081 on the English checkpoint and from 0.314 to 0.106 on the multilingual one.
In practice:
- Fit temperatures on your own labelled data before setting act/escalate thresholds. See temperature scaling and calibrated probabilities.
- Threshold on
confidence(the normalised entropy1 - H(p)/log(k)), not onaction.act_probability. The model card reports that the act head reads about 1.0 for almost every input and carries no usable signal yet. - For ordinal rubrics, remember that
scoreis Laya's weakest primitive (SST-5 0.372). Validate before automating on it.
When should you choose each?
Stay with an NLI zero-shot classifier when:
- You have one question with a handful of labels and low volume.
- You already self-host it and the accuracy is acceptable.
- Your labels are numerous but each is easy to phrase as a clean hypothesis, and you can afford one pass per label.
Move to Laya when:
- You ask several questions about each input (a category, an urgency level, a few yes/no flags) and want them in one pass with typed outputs.
- You need ordinal scores, not just labels.
- Latency matters, or label count and question count are growing.
- Inputs arrive in many languages and you do not want to manage a separate multilingual model.
- You want a path to fine-tune the same model for a specific workflow.
Keep in mind the limits covered above: under ~20 options per choice question, calibration before thresholds, and weak zero-shot performance on novel multi-field rubrics. To compare on your own data, create a free account, send the labels you use with NLI today, and read the docs for the full question schema. Related comparisons: Laya vs fine-tuned BERT and Laya vs embeddings + kNN.
Frequently asked questions
What is the main difference between Laya and zero-shot NLI?
Is Laya more accurate than BART-large-MNLI?
Does Laya need a hypothesis template?
Can Laya handle non-English text like multilingual NLI models?
How many labels can a Laya choice question have?
Are zero-shot probabilities calibrated?
What is zero-shot text classification?
Is BART-large-MNLI still good for zero-shot classification?
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.