Code and dense tables are folded away. Open any of them on demand.
Live demo · no signup
Try this use case
Edit the text if you like, then press run. Laya answers every question at once, with a probability for each option.
The questions it answers
categorychoiceWhich team should handle the message in `body`?urgencyscoreHow urgent is the request in `body`?refund_requestedyes / noDoes the customer ask for money back?churn_riskyes / noDoes `body` suggest the customer may cancel or leave?
The answers appear here as bars: the longer the bar, the more likely Laya thinks that option is.
Show the full API requestHide technical details· JSON
What is multilingual text classification?
Multilingual text classification means sorting messages written in many languages into the same set of categories without translating them first. Laya detects each message's script and language, routes non-English text to its multilingual checkpoint covering 100+ languages, and answers your English-language questions with calibrated probabilities.
An intake pipeline for a global product receives the same kinds of requests (billing, bugs, access, cancellations) in many languages. The usual options all have costs:
- Translate first, then classify. Adds a second service, its latency and its failure modes, and translation errors propagate into classification.
- One model per language. Multiplies training and maintenance; low-volume languages never get a good model.
- A general LLM. Handles many languages, but at LLM latency and cost for what is a small-label classification.
- An English classifier on everything. The cheapest option and the most dangerous, because English-only models fail silently.
That last point is worth taking seriously. The Laya model card reports that its English checkpoint does not gently degrade off English, it collapses: on the 20-option MASSIVE intent task it scores 0.100 on Hindi and 0.103 on Korean, against 0.050 for random guessing, and on Khmer it scores 0.000 accuracy at 0.952 confidence. A model that is confidently wrong defeats confidence gating. The fix is not a threshold; it is sending the text to a model that can read it.
Why a routed decision model rather than an LLM or translation
Laya ships three checkpoints, and the hosted API routes between the first two automatically:
Show technical detailsHide technical details· 3 rows × 5 columns
| Checkpoint | Encoder | Params | Context | Use |
|---|---|---|---|---|
english | ModernBERT-large | 421M | 512 | English text |
multilingual | mmBERT-base | 322M | 1,024 | 100+ languages |
typed-decisions | ModernBERT-large | 421M | 1,024 | four fine-tuned workflows (opt-in) |
On the model card's shared benchmark (17,416 questions, one T4), routing gives each language family the better checkpoint:
Show technical detailsHide technical details· 5 rows × 4 columns
| Task | English ckpt | Multilingual ckpt | Routed |
|---|---|---|---|
| MASSIVE intent, English | 0.783 | 0.657 | 0.783 |
| MASSIVE intent, 13 other languages | 0.306 | 0.451 | 0.451 |
| XNLI, English | 0.860 | 0.843 | 0.860 |
| XNLI, 14 other languages | 0.521 | 0.731 | 0.731 |
| Languages usable (>3x random) | 23 / 51 | 45 / 51 | 45 / 51 |
The multilingual checkpoint is also the faster one: 32.8 ms for one question and 72.3 ms for ten on a T4, versus 39.5 ms and 158.6 ms on the English checkpoint. Network time to the hosted API is extra.
Compared with translate-then-classify, there is one call instead of two, no translated text to store, and a calibrated probability on the answer. Compared with an LLM, answers are typed labels with probabilities rather than generated text, and cost is per input token, 30% below Jev's list price (see pricing). Read more in multilingual classification and language routing.
How language routing works, and designing questions for it
Routing happens before the forward pass and costs under a millisecond. It follows a fixed precedence, documented in the package source:
- An explicit
modelin the request (english,multilingualortyped-decisions). - An opt-in typed-decisions workflow match.
- An explicit language code, or a caller-supplied language guess (
lang_guessin the self-hostedRouter). - Script detection: any non-Latin script (Devanagari, Hangul, Arabic, Cyrillic, Han and others) goes to the multilingual checkpoint.
- For Latin script, a stopword and diacritic heuristic decides whether the text is English.
- If nothing identifies the language (very short or content-word-only text), the default checkpoint.
Release 0.3.7 improved step 5 for text whose accents were stripped by mail clients and ticket systems: on MASSIVE with accents removed, Italian utterances of six or more words routed correctly went from 39% to 80%, checked against 20,000 English texts with no English prose moved. The response's routing.reason tells you what happened, for example "non-Latin script (devanagari, 100% of letters); the English checkpoint cannot read it".
Question design is language-independent. Write instructions and criteria once, in English, as in the example. The state can be in any language. The model card's own Hindi example uses English questions over a Hindi message and returns billing.
Practical rules:
- Send only the customer's text in the state, not your English templates or signatures, or the detector may see a mostly-English state and route to the English checkpoint.
- If you already know the language (from the user's locale or a language-ID model), pass
"model": "multilingual"for non-English traffic. Short messages such as "Quero cancelar" carry little evidence and fall to the default. - Clean quoted email history. The package's email helpers strip English, Portuguese and Spanish reply headers and footers, because a quoted older request weighs on the answer as much as the new one.
Thresholds and escalation across languages
Gate on confidence, per language family.
Calibration differs by checkpoint, so fit temperatures separately. The model card reports mean ECE of 0.314 on the multilingual checkpoint as shipped and 0.106 after refitting one temperature per (question type, option count); the English checkpoint moves from 0.466 to 0.081. If you use one threshold across all traffic without refitting, you will under-escalate on whichever checkpoint is more over-confident.
action.act_probability is not a usable escalation signal yet. The model card and issue #185 report it reads close to 1.0 for almost every input, with raw logits running against correctness (AUROC 0.30 on 396 labelled decisions; confidence reached 0.77). Record it, and do not route on it.
A starting policy to tune:
Show technical detailsHide technical details· python sample
Keep a language column on every escalated item. If one language escalates far more than others, it is either a language the multilingual checkpoint handles poorly (the model card counts 45 of 51 tested languages as usable at over three times random, so six were not) or a routing miss you can fix with an explicit model. Route human review by language so reviewers can read the text. See escalation and human-in-the-loop.
Integration: one endpoint for every language
Show technical detailsHide technical details· bash sample
Show technical detailsHide technical details· python sample
Show technical detailsHide technical details· typescript sample
Log routing.model and routing.reason with every decision; they are the first thing to check when a language behaves badly. Create an account or read the docs.
Data stays in Switzerland for international intake
Intake queues carry names, addresses and account details from every market you serve. Laya Studio's primary inference pool runs on dedicated GPUs located in Switzerland, and every API response says where it was processed in the x-laya-region header. The text and questions you send are processed in memory and discarded when the answer is returned: they are never written to a database or log, and never used to train anything.
Turn on Swiss-only mode for a workspace (or send the x-laya-residency: ch header on a request) and requests are only ever answered in Switzerland. If the Swiss pool is unavailable you get an error, never a silent detour abroad. For billing and debugging, only request metadata (time, status, number of questions, latency) is kept, for 30 days. Account data lives in a Postgres database in the AWS Zurich region (eu-central-2). You remain responsible for your legal basis to process personal data. Details: Swiss data residency.
Limitations of multilingual classification with Laya
- Multilingual is not uniform. Non-English MASSIVE intent accuracy is 0.451 on the multilingual checkpoint, against 0.783 for English on the English checkpoint. Expect lower accuracy and more escalations outside English, and measure per language.
- Six of 51 tested languages were below the "usable" bar (more than three times random) even when routed.
- Latin-script detection is a heuristic. Script detection is exact; deciding whether Latin text is English is best-effort. Short or accent-free messages can be misrouted. Pass an explicit model when you know the language.
- Mixed-language text (code-switching, English templates around a local-language reply) can route either way. Strip boilerplate first.
- Zero-shot limits apply. The base checkpoints are near chance on the typed-decisions benchmark zero-shot (0.352 for multilingual against a 0.461 majority baseline). Evaluate your own schema.
- Context. The multilingual checkpoint reads 1,024 tokens per question, about 768 for state, which is more than the English checkpoint's 512 but still not a whole email thread.
Frequently asked questions
Where is multilingual text processed, and is it stored?
Do I need to translate text before sending it to Laya?
How many languages does Laya support?
Why not use the English checkpoint for everything?
Can I force a specific checkpoint?
Does the multilingual checkpoint cost more?
Sources
- Laya model card (Convai Innovations)
- Laya multilingual checkpoint
- Laya source code (router and language detection)
- FitzGerald et al., MASSIVE: A 1M-Example Multilingual NLU Dataset (2022)
- Conneau et al., XNLI: Evaluating Cross-lingual Sentence Representations (2018)
- mmBERT: A Modern Multilingual Encoder (2025)
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.