Use case

Multilingual intake without a translation step

International teams handle requests in the customer's own language, without a translation step that slows things down or garbles the meaning. Laya detects the script and language of each message and routes non-English text to a multilingual checkpoint, so the same English questions work on Hindi, Portuguese or Korean text.

7 min readLast updated

Swiss-hosted inference. Nothing you send is ever stored.Swiss data residency

In 30 seconds

  • Send text in its original language; there is no translation step.
  • Laya detects the language and picks the right model automatically.
  • Your questions and labels stay in English: one set for every market.
  • Requests can be answered only in Switzerland, and message content is never stored.
  • Some languages work better than others, so test on your own markets.

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.

205/600

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 request· JSON
POST https://api.laya.studio/v1/systemonejson
{
  "state": {
    "channel": "email",
    "subject": "Cobrança duplicada na fatura de setembro",
    "body": "Olá, fomos cobrados duas vezes pela assinatura deste mês. Preciso do estorno até sexta-feira, senão vamos cancelar o plano."
  },
  "questions": {
    "category": {
      "type": "choice",
      "instructions": "Which team should handle the message in `body`?",
      "criteria": {
        "billing": "invoices, payments, refunds",
        "technical": "bugs, outages, integrations",
        "sales": "pricing, demos, new purchases",
        "account": "login, access, user management",
        "other": "none of the above"
      }
    },
    "urgency": {
      "type": "score",
      "instructions": "How urgent is the request in `body`?",
      "criteria": [
        "no time pressure",
        "needs attention soon",
        "blocking issue or hard deadline"
      ]
    },
    "refund_requested": {
      "type": "noul",
      "instructions": "Does the customer ask for money back?"
    },
    "churn_risk": {
      "type": "noul",
      "instructions": "Does `body` suggest the customer may cancel or leave?"
    }
  }
}

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 details· 3 rows × 5 columns
CheckpointEncoderParamsContextUse
englishModernBERT-large421M512English text
multilingualmmBERT-base322M1,024100+ languages
typed-decisionsModernBERT-large421M1,024four 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 details· 5 rows × 4 columns
TaskEnglish ckptMultilingual ckptRouted
MASSIVE intent, English0.7830.6570.783
MASSIVE intent, 13 other languages0.3060.4510.451
XNLI, English0.8600.8430.860
XNLI, 14 other languages0.5210.7310.731
Languages usable (>3x random)23 / 5145 / 5145 / 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:

  1. An explicit model in the request (english, multilingual or typed-decisions).
  2. An opt-in typed-decisions workflow match.
  3. An explicit language code, or a caller-supplied language guess (lang_guess in the self-hosted Router).
  4. Script detection: any non-Latin script (Devanagari, Hangul, Arabic, Cyrillic, Han and others) goes to the multilingual checkpoint.
  5. For Latin script, a stopword and diacritic heuristic decides whether the text is English.
  6. 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 details· python sample
python
THRESHOLDS = {"english": 0.55, "multilingual": 0.65}  # tune per checkpoint on labelled data

def decide(result):
    ckpt = result["routing"]["model"]
    cat = result["answers"]["category"]
    if cat["confidence"] < THRESHOLDS.get(ckpt, 0.65):
        return "human_queue:" + ckpt
    return "team:" + cat["choice"]

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 details· bash sample
bash
curl -s https://api.laya.studio/v1/systemone \
  -H "Authorization: Bearer lsk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"state": {"body": "मुझसे दो बार शुल्क लिया गया, कृपया पैसे वापस करें।"},
       "questions": {"category": {"type": "choice", "instructions": "Which team should handle body?",
         "criteria": {"billing": "invoices, payments, refunds", "technical": "bugs, outages",
                      "other": "none of the above"}}}}'
Show technical details· python sample
python
import os, requests

def classify(body: str, questions: dict, locale: str | None = None) -> dict:
    payload = {"state": {"body": body}, "questions": questions}
    if locale and not locale.lower().startswith("en"):
        payload["model"] = "multilingual"  # we already know it is not English
    r = requests.post("https://api.laya.studio/v1/systemone",
                      headers={"Authorization": "Bearer " + os.environ["LAYA_API_KEY"]},
                      json=payload, timeout=5)
    r.raise_for_status()
    return r.json()  # includes routing.model and routing.reason
Show technical details· typescript sample
typescript
export async function classify(body: string, questions: object, locale?: string) {
  const payload: Record<string, unknown> = { state: { body }, questions };
  if (locale && !locale.toLowerCase().startsWith("en")) payload.model = "multilingual";
  const res = await fetch("https://api.laya.studio/v1/systemone", {
    method: "POST",
    headers: { Authorization: "Bearer " + process.env.LAYA_API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify(payload),
  });
  if (!res.ok) throw new Error("laya " + res.status);
  return res.json();
}

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?
On Laya Studio, requests are answered on GPUs in Switzerland; the content is processed in memory and discarded after the answer, never written to a database or log. Swiss-only mode makes sure a request is never answered outside Switzerland.
Do I need to translate text before sending it to Laya?
No. Send the original text with English questions. The router detects the script and language and sends non-English text to the multilingual checkpoint.
How many languages does Laya support?
The multilingual checkpoint is built on mmBERT-base, which covers 100+ languages. On the model card benchmark, 45 of 51 tested languages scored more than three times random when routed.
Why not use the English checkpoint for everything?
It collapses on non-Latin scripts and stays confident while wrong: 0.000 accuracy at 0.952 confidence on Khmer, per the model card. Confidence thresholds cannot catch that.
Can I force a specific checkpoint?
Yes. Pass "model": "english" or "model": "multilingual" in the request body. An explicit model always takes precedence over automatic routing.
Does the multilingual checkpoint cost more?
No. Billing is per input token (1 credit = 1 input token) whichever checkpoint answers. See /pricing.

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.