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
reckon
Quietcatalpa
Organizes and reviews Windows files offline using rules and the local Laya decision model
god-llm-decisions
surajvs2710-stack
A decision engine fuses Laya and Jev predictions with confidence weighting and auditable logs
lime-jev
yzxoi
Adds optional Laya reranking to a local Chinese pinyin input method on Apple Silicon
laya-console
biyyl234
Provides a local web console and REST API for Laya inference and intent classification
laya-reader
msudars
Ranks new arXiv papers against a reader profile using the local Laya model
laya-sentiment-analyzer
SwatiK425
A local command-line sentiment analyzer using Laya's typed choices and calibrated probabilities
laya-decision-api
bmw8080
An HTTP service wraps local Laya with OpenAPI documentation and Java, TypeScript, and Python SDKs
jevtpp
wiatrM
A C++20 library for typed model-backed decisions with optional ONNX Runtime and native Laya backends
seems-laya
ericmjl
Runs natural-language judgments in the Seems programming language using the local Laya decision model
laya-mlx-zh
ZLHAOOO
Provides Chinese fine-tuned Laya weights, training data, and evaluations for Apple Silicon MLX
design-os-generative-ui
jangtrinh
Builds a generative UI engine using local Laya-MLX decisions and a TypeSafe JEV cascade router
leanest
baronunread
A TypeScript test selector uses semantic judgments from classifier.dev, Jev, or Laya
@scruple/provider-laya
nalexpear
A local Laya decision provider for the Scruple framework
next-jev-laya-test
JonesLin
Provides multilingual evaluation data for testing Jev and Laya across text-classification tasks
danish-dynaword-laya
syvai
Provides Danish Dynaword data associated with Laya
openjev
gillmoreno
Demonstrates local Laya email-triage and simulated trading-tick decisions
XERON
PIXELZX0
Fine-tunes Laya decision models for multilingual classification, scoring, routing, and browser actions
Nekomimi-Waifu-Seeker
CooLguNxDD
Uses Laya to guess anime and other fictional characters through typed decisions
laya-web
nvkudva
Runs a quantized Laya decision model entirely in the browser using ONNX Runtime Web
laya-test
byteling
CLI and Flask demos show typed decisions from the Laya model
laya-web-poc
alexander-voronkov
A browser prototype runs a quantized Laya model locally for typed question answering
laya-assist-proxy
dwyschka
A local Home Assistant bridge that classifies voice commands with Laya and routes uncertain requests to an LLM
classify-goblin
Sharkelot
A local typed-decision service offers Laya alongside rules, DistilBERT, and Qwen backends
calibrated-decisions-iot-demo
javierdv7
An interactive smart-home demo compares local Laya inference with Jev using shared rules
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