Text classification with Laya

A Laya `choice` question is a zero-shot classifier. You name the labels, optionally describe each one, and get the top label with a probability for every option in one forward pass. Labels are defined at request time, so there is no training step to get started.

252 projects

T

laya-onnx

tozp

Hosts ONNX-converted English Laya model weights in FP32, FP16, and INT8 formats

146·HF model
S

laya-multilingual-coreai

smdesai

Provides a Core AI conversion of multilingual Laya for typed decisions on Apple devices

1·HF model
S

laya-multilingual-onnx

soyelmismo

Provides CPU-optimized, quantized ONNX checkpoints for multilingual Laya

1·HF model
C

laya-banking77-v1

Cahol

Fine-tunes Laya for classifying customer messages into the 77 BANKING77 banking intents

1·HF model
H

laya-issue-triage

harikarthikmanyam

Fine-tunes Laya to classify GitHub issue types and assess whether more information is needed

1·HF model
H

cut-laya-onnx

harshpreet931

An 8-bit ONNX conversion runs Laya text classification in browser-based editors

1·HF model
1

laya-prompt-guard

16sulphur

A Laya fine-tune detects prompt injection and jailbreak attempts in text

1·HF model
F

laya-idjvsuen-v1

faall7479

A multilingual Laya fine-tune returns calibrated typed decisions on Indonesian, Javanese, Sundanese and English text

1·HF model

nlp-serving

saugataroyarghya

A BentoML playground serving and comparing focused NLP models, including Laya

1·GitHub repo

decision-model-playground

tedliou

A local web playground comparing Laya and Jev for recommending articles

1·GitHub repo

jev-vs-open-decision-models

elcronos

Benchmarks Jev against Laya and PrismNLI on zero-shot text classification tasks

1·GitHub repo

sokudan

hiroki-abe-58

Builds a Japanese typed-decision model and benchmarks it against Laya

1·GitHub repo

chatassistant-laya

HarrisXiu

Analyzes pasted chat messages locally with Laya and can generate optional reply suggestions

1·GitHub repo

jev-vs-laya

DDnim

Benchmarks Jev and Laya on typed decisions for reviewing SQL statements

1·GitHub repo

laya-mac-serve

chrisns

Serves Laya from a macOS menu bar app through an OpenAI-compatible HTTP endpoint

1·GitHub repo

chinese-workflow-decision-bench

Adkid-Zephyr

Benchmarks Jev and Laya on synthetic Feishu message classification scenarios

1·GitHub repo

SmartMom

clydechen0228

Uses Laya for edge classification and training within a smart-factory operations platform

1·GitHub repo

jev-laya-benchmark

EnesDemir143

Benchmarks TypeSafe Jev and Laya-MLX on structured issue classification

1·GitHub repo

laya-mlx-per-turn-classifier

M37Labs

Demonstrates per-turn customer message classification with Laya on Apple Silicon

1·GitHub repo

layaAsRagJudge

vishalmysore

Verifies RAG claims in the browser using Laya decisions and evaluates accuracy against labeled claims

1·GitHub repo

laya-main

bill9924

Maps patent texts to OpenAlex concepts using TF-IDF retrieval and a Laya decision model

1·GitHub repo

laya-adk-toolkit

Ashfaqbs

Google ADK tools expose Laya's typed-decision engine for classification, scoring, and detection

1·GitHub repo

decision-making

tzt-company

A local demo runs Laya for multilingual text decisions and Git commit risk checks

1·GitHub repo

laya-ko-decision-onnx

2nugu

Fine-tunes Laya for Korean decisions and provides PyTorch training and ONNX export scripts

1·GitHub repo

Example

From the core README:

from laya import Router

router = Router()
questions = {
    "department": {"type": "choice", "instructions": "Which department should handle this?",
                   "criteria": {"billing": "invoices, payments, refunds",
                                "technical": "bugs, outages, system errors",
                                "other": "everything else"}},
}
result = router.predict("La aplicación se cierra cada vez que abro la configuración.", questions)
print(result["answers"]["department"]["choice"])  # technical

Each answer includes probabilities for every label and a confidence value you can gate on.

Label count matters

All options share a token budget (head_max_len: 192 on laya, 256 on the other two checkpoints). The README reports Banking77 (77 labels) at 0.425 for Laya against 0.870 for Jev on 72 labels, because each label gets only 3 to 4 tokens. Keep a question under about 20 options, or raise head_max_len, split into coarse and fine questions, or use predict_shortlist with embeddings.

Accuracy you can expect

  • The core README lists AG News 0.947 and DAIR Emotion 0.573 for the English checkpoint.
  • sysone-bench ran Laya and Jev on byte-identical inputs: AG News 0.940 vs 0.910, emotion 0.540 vs 0.550, and a 12-intent Banking77 subset 0.802 vs 0.906.
  • jevbench (dhruvmehra) compares Jev, Laya, LLMs, fine-tuned DistilBERT and zero-shot NLI on SST-2, AG News and Banking77.

Fine-tune when zero-shot is not enough

The base checkpoints score 0.362 and 0.352 on the README's typed-decisions benchmark. The fine-tuned laya-typed-decisions checkpoint reaches 0.766. The fine-tuning notebook runs on Kaggle's free 2x T4 GPUs.

Projects

ollaya serves Laya alongside zero-shot NLI and GLiClass classifiers behind one API. edgejev reports AG News accuracy for fp32 and INT8 CPU builds.

Caveats

The README warns against boolean-word labels such as yes/no or true/false in choice questions, and it reports failures on negated requests. Use descriptive labels and test on your own data.

More ways to use Laya