Zero-shot classification with Laya

Zero-shot classification means naming your labels at request time instead of training a classifier on them. Laya was built for this. You write the labels as the options of a typed question and get a calibrated probability for each one in a single forward pass. How well that works depends heavily on the task.

827 projects

N

layazh-zh

NovaAI6868

A Chinese typed-decision model aligned with Laya's architecture and training recipe

1·HF model
E

laya-triage-en

elnachto

A Laya fine-tune that classifies GitHub issues for automated triage

1·HF model
E

laya-triage-multilingual

elnachto

A multilingual Laya fine-tune for classifying GitHub issues

1·HF model
2

laya-ko

2nugu

Fine-tunes Laya for Korean and evaluates it on classification, relation extraction, inference, and similarity tasks

1·HF model
Z

layazh-zh

ZichenAI

Fine-tunes a Chinese decision model using Laya's architecture and training recipe

1·HF model
I

laya-voice-router

IAMCB

Gated Laya fine-tune for voice-agent tool routing, tagged multilingual and Hinglish

1·HF model
A

laya-typed-decisions

Ankit1106

Fine-tunes Laya on typed-decision examples and reports held-out evaluation metrics

1·HF model
A

daylens-laya-onnx

aaronalexS

Provides an ONNX conversion of Laya for local activity labeling in the Daylens desktop app

1·HF model
S

recmeets-laya-words

somniusx

A Greek- and English-language Laya fine-tune identifies likely speech-recognition word errors

1·HF model
Q

Laya-GUT-Finetune

Qalarc

Provides a fine-tuned Laya checkpoint for local monitor-alert severity and urgency decisions

1·HF model
G

laya-web-q8

go-vertika

Provides an 8-bit ONNX quantization of Laya for in-browser decision inference

1·HF model
C

laya-typed-decisions-turkish-mmlu-10k

canbingol

A Laya checkpoint fine-tuned on 10,000 Turkish MMLU typed-decision examples

1·HF model
G

laya-triage-banking77

Gjusev

A Laya checkpoint fine-tuned for hierarchical BANKING77 support-ticket triage

1·HF model
A

swarm-laya

Aditharavind

Fine-tunes Laya to make per-robot decisions in simulated swarm-robotics scenarios

1·HF model
M

LayaVoxprompt

MainzelMennchen

Fine-tunes multilingual Laya to classify dictation as an assistant prompt or ordinary text

1·HF model
X

laya-cyber-v1

xmahbub

Laya typed-decisions fine-tune that picks allow or sigkill for security events (no model card)

1·HF model
K

caldec-v1-laya

kgrozdanovski

A fine-tuned Laya encoder returns calibrated probabilities for closed assistant decisions

1·HF model
M

laya-snake-mlx

madhavbiplov

Fine-tunes a multilingual Laya model for calibrated snake-game decisions on Apple silicon

1·HF model
Y

laya-typed-decisions

yashchouhann

Fine-tunes Laya on a typed-decisions benchmark and reports comparative results

1·HF model
B

laya-android

ByunByun

Fine-tunes Laya for selecting and grounding Android GUI actions from accessibility trees

1·HF model
M

laya-en-fp16

marrviin

FP16 ONNX export of the English Laya checkpoint (no model card)

1·HF model
W

laya-browser

wuyuanpei

Fine-tunes Laya as a browser-agent decision head compatible with jev-ultrafast

1·HF model
R

laya-typed-decisions-ov-int8

rupeshs

Provides an int8 OpenVINO conversion of Laya fine-tuned for typed-decision workflows

1·HF model
J

laya-fullft-typed-decisions

jjshin

Fine-tunes Laya with pure PyTorch RLCD for typed decisions and jailbreak detection

1·HF model

Example

With the official package, following the core README:

python -m pip install laya
from laya import Router

router = Router()  # downloads a checkpoint on first use

questions = {
    "topic": {"type": "choice", "instructions": "What is this message about?",
              "criteria": {"billing": "invoices, payments, refunds",
                           "technical": "bugs, outages, system errors",
                           "account": "login, password, profile changes",
                           "other": "everything else"}},
    "mood": {"type": "score", "instructions": "How does the customer feel?",
             "criteria": ["happy", "neutral", "annoyed", "angry"]},
    "refund": {"type": "noul", "instructions": "Does the customer ask for a refund?"},
}

result = router.predict("I was charged twice for March and nobody answers my emails.", questions)
print(result["answers"]["topic"]["choice"])         # the most likely label
print(result["answers"]["topic"]["probabilities"])  # one probability per label
print(result["answers"]["refund"]["noul"])          # probability that the answer is yes

The labels live in the request, so changing the label set is a code change, not a training run.

Three kinds of question

  • choice picks one label from a set: topic, intent, department. Describe each label in a few words, as in the README examples.
  • score places the text on an ordered scale: sentiment, urgency, severity.
  • noul returns the probability that a statement is true. For multi-label tagging, ask one noul question per tag.

Compared with NLI zero-shot pipelines

The classic approach, from Yin et al. (2019), reuses a model trained on natural language inference, such as facebook/bart-large-mnli (MIT licence). Each candidate label becomes a hypothesis like "This example is {label}." and the model scores whether the text entails it. The pipeline runs one text-hypothesis pair per label, so the cost grows with the number of labels. Laya scores all options of a question, and all questions in a call, in one forward pass.

For measured comparisons, jevbench (dhruvmehra) runs Jev, Laya, LLMs, a fine-tuned DistilBERT and zero-shot NLI on SST-2, AG News and Banking77. ollaya serves Laya next to zero-shot NLI and GLiClass classifiers behind one API, which makes a side-by-side test on your own data easy.

Compared with GLiNER-style models

GLiNER started as a zero-shot named-entity model: you pass entity types at inference time and it extracts matching spans. That is extraction, not classification. Fastino's GLiNER2 family added classification, and GLiNER2.5-Decide is a 340M English classifier that takes any label set at call time and supports multi-label output, under Apache 2.0. Its card reports 60.2% exact-match accuracy on Fastino's 17-domain fast-decisions suite.

In akitaonrails' benchmark, GLiNER2.5-Decide scored 52.4% on the compact set and Laya 42.9%, at 208 ms and 41 ms median latency on the author's machine. Both were far below the 4B+ decision models in the same test.

How accurate is zero-shot Laya?

It depends on the task:

  • Few broad labels work well, subtle or many labels much less. The per-dataset numbers (AG News, DAIR Emotion, Banking77) are on Laya for text classification. Options share a token budget, so keep a question under about 20 options or split it into coarse and fine questions.
  • Hard decisions sit near chance. The model card puts the base checkpoints at 0.362 and 0.342 on the typed-decisions benchmark, against 0.318 for random guessing and 0.461 for always picking the most common answer. Arize's benchmark found laya-multilingual at 59.8% balanced accuracy on RAGTruth hallucination detection, against 85.5% for Jev.
  • Wording matters. In the same Arize test, flipping the question from "Is every claim supported?" to "Does it contain an unsupported claim?" moved Laya's ROC AUC from 0.64 to 0.36. The core README also warns that noul can follow its option labels instead of the text, and suggests a two-option choice with neutral keys as a workaround.

When zero-shot is not enough

Label a few hundred real examples and measure first. If the numbers are too low, you have two routes. Fine-tune: the laya-typed-decisions checkpoint went from 0.362 to 0.766 on its benchmark, and the notebook runs on Kaggle's free GPUs. Or move to a larger decision model; see Laya alternatives. More on labels and benchmarks is in Text classification with Laya and ModernBERT and mmBERT in Laya.

More ways to use Laya