Comparison

Laya vs a fine-tuned BERT classifier: which should you use?

A fine-tuned BERT model is the classic way to build a fast, accurate text classifier, but it needs labelled training data and a retrain every time your categories change. Laya is built on the same kind of model, yet reads its categories from each request. This page explains when each one is the better choice.

9 min readLast updated

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

In 30 seconds

  • Both use BERT-family encoders; the difference is where the labels live and how the model is trained.
  • A fine-tuned BERT has its labels baked in, so adding one means relabelling and retraining. Laya takes the labels in each request.
  • BERT needs hundreds to thousands of labelled examples per task; Laya works on day one, and fine-tuning it helps a lot on complex workflows (0.362 to 0.766 on typed-decisions).
  • A dedicated BERT head handles large label sets better; Laya works best under about 20 options per question.
  • Both usually need a temperature refit before their probabilities can be trusted.

Code and dense tables are folded away. Open any of them on demand.

At a glance: Laya vs Fine-tuned BERT classifiers

Showing 12 of 12 rows.

Laya compared with Fine-tuned BERT classifiers, feature by feature
FeatureLaya (via Laya Studio)Fine-tuned BERT classifiers
BackboneModernBERT-large (English) or mmBERT-base (multilingual), fully fine-tunedBERT, RoBERTa, DeBERTa, ModernBERT or similar
Head2-layer transformer head + option-marker scorer: one logit per option at its [MASK]Linear layer with one fixed output per label
Label setDefined per request in the question; new labels need no retrainingFixed at training time; a new label means relabelling and retraining
Questions per modelAny number of choice, score and noul questions, answered in one forward passOne task per head (or a hand-built multi-head model)
Training data neededNone to start; fine-tune on your workflow for best accuracyHundreds to thousands of labelled examples per task
Accuracy on a trained workflowtyped-decisions: 0.766 after fine-tuning (base checkpoint 0.362)typed-decisions: 0.646 for a published ModernBERT-base specialist
Training objectiveRLCD: reward from strictly proper scoring rules (log + spherical + RPS)Cross-entropy (the log score, itself a proper scoring rule)
Calibration out of the boxOver-confident; ECE 0.466 → 0.081 after temperature refitOften over-confident; temperature scaling is the standard fix
Latency39.5 ms / 32.8 ms per question on a T4; larger than BERT-baseDepends on size; a base-size model is usually faster
Large label setsOptions share a token budget; keep under ~20 (Banking77 0.425)A linear head handles hundreds of labels without a token budget
OperationsHosted API (Laya Studio) or self-host one model for many tasksYou train, version and serve one model per task
LicenseApache-2.0 weightsDepends on the base model; most are open

The verdict

A task-specific BERT is still the right tool for one fixed, large label set with plenty of labels; Laya is better when schemas change, when many small decisions share an input, and as a base to fine-tune for a whole workflow.

What is the difference between Laya and a fine-tuned BERT?

A fine-tuned BERT classifier is an encoder trained on labelled examples, with one fixed output per label. Laya uses the same family of encoder but reads its labels from each request, answers several typed questions per input in one pass, and is trained with proper scoring rules. BERT suits fixed tasks; Laya suits changing ones.

If you have shipped a text classifier in the last few years, it was probably a BERT-family encoder with a linear layer on top, trained with cross-entropy on a few thousand labelled examples. That recipe is well understood (Devlin et al., 2019). It is cheap to serve and, on a stable task with enough data, hard to beat.

Laya is also an encoder. The English checkpoint is ModernBERT-large, fully fine-tuned, with a decision head trained from scratch, 421M parameters in total. The multilingual checkpoint is mmBERT-base at 322M. So the comparison is not "old BERT vs a new architecture". It is about three design choices on top of the same kind of backbone:

  1. Where the labels live. In a BERT classifier they are baked into the output layer. In Laya they arrive in the request.
  2. How many tasks one model serves. A BERT head does one task. Laya answers any mix of choice, score and noul questions about one input in one pass.
  3. What the training objective rewards. Laya is trained with RLCD, reinforcement learning against strictly proper scoring rules. A BERT classifier uses cross-entropy.

Laya Studio is an independent hosted API powered by the open-source Laya model. It is not affiliated with its authors, Convai Innovations. Background reading: encoder vs decoder models, ModernBERT and mmBERT.

How do their architectures differ?

A standard fine-tuned classifier reads the [CLS] vector and multiplies it by a weight matrix with one row per label. Label 17 is row 17. The model has no idea what label 17 means except through the examples it was trained on, which is why adding a label or renaming one means retraining.

Laya puts the options into the input:

Show technical details· text sample
text
[CLS] choice question: Which team should handle this? [SEP]
  [MASK] billing: invoices, payments, refunds
  [MASK] technical: bugs, outages, system errors
  [MASK] sales: pricing, new contracts [SEP]
  <state> [SEP]

The encoder attends across the instructions, every option description and the state at once. A two-layer transformer head then refines the representation, and a scorer reads one logit at each [MASK] position. The softmax over those logits is the answer distribution. Because the options are text, the model can use their descriptions, and you can change the label set in the next request. The model card puts it this way: "The answer space is defined at request time, so new schemas need no retraining." See option-marker scoring.

The trade-off is a token budget. All options share head_max_len (192 tokens on the English checkpoint, 256 on multilingual). With 77 options each label gets about 3–4 tokens, and Laya's Banking77 accuracy falls to 0.425. A linear head has no such limit: it can have 77 or 700 outputs at no extra input cost. If your task is one large, fixed taxonomy, that is a real advantage for the classic approach.

How much training data does each need?

The classic recipe needs labelled data before it produces anything useful: typically hundreds of examples per class for a reliable model, plus a validation set. Few-shot methods such as SetFit lower that requirement considerably, but you still train a model per task.

Laya gives you an answer on the first request, with no training. That makes it useful for prototyping a schema, for tasks whose labels change weekly, and for the long tail of small decisions that never justified a dedicated model.

That said, the zero-shot results need stating plainly. On the typed-decisions benchmark (400 cases, 2,000 decisions across four business workflows), the base checkpoints are near chance:

Show technical details· 7 rows × 2 columns
ModelAccuracy on typed-decisions
laya (base, zero-shot)0.362
laya-multilingual (base, zero-shot)0.342
Random guess0.318
Per-question majority class0.461
ModernBERT-base specialist (published)0.646
TypeSafe Jev 1.13.0 (published)0.727
laya-typed-decisions (fine-tuned)0.766

A task-specific fine-tuned encoder beats base Laya by a wide margin on that benchmark. The model card's own summary is: "Laya is a fast base to specialise, not a zero-shot decision engine." Zero-shot Laya does well on tasks close to its training mix, such as spam, phishing, topic and intent, and less well on novel multi-field business rubrics. See zero-shot vs fine-tuned.

Should you fine-tune Laya or BERT?

The most useful comparison is fine-tuned Laya against a fine-tuned BERT on the same data. The model card has one published data point. On typed-decisions, the published ModernBERT-base specialist scores 0.646. laya-typed-decisions, fine-tuned from the English Laya checkpoint on the benchmark's 1,200-case training split (6,000 decisions), scores 0.766, above the 0.735 teacher self-agreement ceiling. It wins all four workflows: invoice processing 0.804, security incidents 0.766, customer service 0.764 and agent-trace observability 0.730.

Some of that gap is backbone size (large vs base). Some is the head: one fine-tuned Laya model answers all 2,000 decisions, spread across noul, choice and score questions with different label sets. With the classic approach you would train several heads or several models. The fine-tuning run took about 4–5 hours on Kaggle's free 2xT4, and the notebook is public in the Laya repository.

Two caveats from the same model card:

  • The fine-tuned checkpoint is a specialist: "Expect it to behave like the base laya checkpoint, or worse, on anything else."
  • Its per-type temperatures were fitted on training data (issue #186), so treat its confidence as uncalibrated until you refit.

Laya Studio serves the three published checkpoints. It selects typed-decisions only when you ask for it with "model": "typed-decisions". Custom fine-tunes are a self-hosting path today, using the open weights.

Which gives better-calibrated probabilities?

Cross-entropy is the log score, which is already a strictly proper scoring rule. A classifier trained to convergence with it is, in principle, rewarded for honest probabilities. In practice, modern deep networks tend to come out over-confident (Guo et al., 2017), and the standard fix is post-hoc temperature scaling on a held-out set.

Laya's RLCD objective combines the log score with a spherical score, and adds a ranked probability score for ordinal score questions. Exploration noise is added to the logits, and the update is REINFORCE with a group-mean baseline. See RLCD and proper scoring rules. The ranked probability score matters for ordinal rubrics: it penalises predicting "critical" when the truth is "low" more than predicting "medium".

Neither approach removes the need to calibrate on your own data. The Laya model card is explicit that the checkpoints ship over-confident. Refitting one temperature per (question type, option count) moves mean ECE from 0.466 to 0.081 on the English checkpoint and from 0.314 to 0.106 on the multilingual one. The runtime clamps temperatures to [0.5, 5.0] after a shipped bucket was found to sharpen probabilities about tenfold. The workflow is the same as for a BERT classifier: hold out labelled data, fit temperatures, then set thresholds. See temperature scaling and expected calibration error.

Which is faster and easier to run?

A base-size BERT classifier (around 110M parameters) is smaller and usually faster than Laya's 421M English checkpoint. If you need the absolute lowest per-item latency on CPU for a single fixed task, a small dedicated model is hard to beat.

Laya's latency figures, from the model card (Tesla T4, in-process):

Questions per callEnglish (421M)Multilingual (322M)
139.5 ms32.8 ms
10158.6 ms72.3 ms
50771 ms337 ms

On CPU, the preloaded router runs at 193–464 ms per request.

The operational comparison changes once you have more than one task. Ten classifiers means ten training pipelines, ten model versions to monitor and ten deployments, or one multi-head model you had to design yourself. With Laya those ten tasks become ten questions in one request, answered by one model in one pass. On Laya Studio you do not host anything: POST https://api.laya.studio/v1/systemone, billed per input token (1 credit = 1 input token), with 5 free runs. Prices are on the pricing page.

Show technical details· python sample
python
import requests

resp = requests.post(
    "https://api.laya.studio/v1/systemone",
    headers={"Authorization": "Bearer lsk_live_..."},
    json={
        "state": {"subject": "Duplicate charge on invoice #4411", "body": "We were billed twice for March."},
        "questions": {
            "department": {"type": "choice", "instructions": "Which department should handle this?",
                           "criteria": {"billing": "invoices, payments, refunds", "technical": "bugs, outages",
                                        "sales": "pricing, new contracts", "other": "everything else"}},
            "urgency": {"type": "score", "instructions": "How urgent is this request?",
                        "criteria": ["not urgent", "soon", "critical deadline or blocking issue"]},
            "refund_requested": {"type": "noul", "instructions": "Does the sender ask for money back?"},
        },
    },
    timeout=10,
)
answers = resp.json()["answers"]
print(answers["department"]["choice"], answers["urgency"]["score"], answers["refund_requested"]["noul"])

A score answer returns the probability-weighted level (for example 1.84 on a 0–2 scale), with the per-level probabilities and a legend. score is Laya's weakest primitive (SST-5 0.372), so validate it before you rely on it. A noul returns P(true). If a noul looks stuck on your data (issue #156), ask the same thing as a two-option choice with neutral keys.

When should you choose each?

Train a dedicated BERT classifier when:

  • You have one task with a large, stable taxonomy (dozens to hundreds of labels).
  • You have, or can buy, thousands of labelled examples.
  • You need the smallest possible model for CPU or edge inference.
  • The label set changes rarely enough that retraining is not a burden.

Use Laya when:

  • The label set is small and changes often, or you are still discovering it.
  • You ask several questions about each input: intent, urgency, sentiment, risk flags.
  • You want answers before you have training data, then a path to specialise.
  • You want one model and one API instead of a fleet of task heads.

Fine-tune Laya when you have a defined multi-question workflow and labelled data. That is where the published results are strongest (0.766 against 0.646 for the published ModernBERT-base specialist on typed-decisions). Keep the limits in mind: under ~20 options per choice question, calibrate before thresholding, and gate on confidence rather than action.act_probability, which carries no usable signal yet.

To start without training anything, sign up and send your schema. The docs describe every question type. For the underlying ideas, see typed decisions and decision models for AI agents.

Frequently asked questions

Is Laya just a fine-tuned BERT?
Its backbone is a BERT-family encoder (ModernBERT-large or mmBERT-base), fully fine-tuned. What differs is the head: a two-layer transformer and an option-marker scorer that read labels from the request, plus a training objective based on proper scoring rules (RLCD).
Do I need training data to use Laya?
Not to start: you define labels in the request and get answers immediately. For complex, multi-field workflows the base checkpoints are near chance (0.362 on typed-decisions), and fine-tuning raised that to 0.766. Plan to fine-tune or to validate zero-shot accuracy on your data.
Is a fine-tuned BERT more accurate than Laya?
On one published benchmark, typed-decisions, a ModernBERT-base specialist scored 0.646 against 0.766 for fine-tuned Laya. On large taxonomies a dedicated head is likely to do better, because Laya's options share a token budget (Banking77 0.425).
Can I add a new label without retraining?
Yes. Labels and their descriptions are part of each request, so you can add, remove or reword options in the next call. Check accuracy after the change, as you would with any schema edit.
Which is faster?
A base-size BERT classifier is usually faster per item than Laya's 421M English checkpoint. Laya scores 39.5 ms per question on a T4 and batches many questions into one pass, which matters when you ask several things about each input.
Are Laya's probabilities calibrated out of the box?
No. The checkpoints ship over-confident. Refitting one temperature per question type and option count on held-out data moved mean ECE from 0.466 to 0.081 on the English checkpoint, the same fix you would apply to a BERT classifier.
What is a fine-tuned BERT classifier?
A BERT-family encoder (BERT, RoBERTa, DeBERTa, ModernBERT and similar) with a linear layer on top, one output per label, trained with cross-entropy on labelled examples for one task. It is fast and accurate on stable tasks, but changing the label set means retraining.
Can I self-host Laya like a BERT model?
Yes. Laya's weights are Apache-2.0 on Hugging Face, and the laya package ships laya-serve, an HTTP server with the /v1/systemone API. You can also call Laya Studio, the independent hosted API, instead of running it yourself.

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.