Laya
Laya is a non-autoregressive System 1 decision engine for typed choice, score, and yes/no questions over text. It returns calibrated probabilities in one forward pass across 100+ languages and routes requests to the right checkpoint.
Visit NandhaKishorM/layaOverview
Laya is a multilingual, non-autoregressive decision model. Given a state such as text, email, ticket, or JSON and typed questions, it returns typed answers with calibrated probabilities in a single forward pass. It does not generate text; the Router detects language and script and dispatches to the appropriate English or multilingual checkpoint.
Key Features
- Typed choice, score, and yes/no (noul) questions over text, email, tickets, or JSON are answered in one forward pass.
- The Router detects scripts and languages in sub-milliseconds and dispatches to the optimal checkpoint; the multilingual checkpoint covers 100+ languages.
- Trained with RLCD against strictly proper scoring rules so reporting honest probabilities maximizes reward, with no generated text to parse or hallucinate.
- Fine-tuning on domain decisions can improve accuracy; the fine-tuned laya-typed-decisions checkpoint scores 0.766 on the typed-decisions benchmark versus 0.362 for the base English checkpoint.
- Self-hostable via Python SDK, optional HTTP server laya-serve, and extras for MCP, LangChain, ONNX, and a GPU fast path.
- Supports long documents with laya-multilingual via max_len=8192.
Use Cases
- Routing and triaging customer support emails or tickets by department, urgency, and churn risk.
- Guardrails and moderation decisions that require calibrated yes/no probabilities.
- Structured classification over multilingual text where generated text is undesirable.
- Domain-specific decision workflows after fine-tuning, such as invoice processing, security incidents, customer service, and agent-trace observability.
Getting Started
- Install with pip install laya; Python 3.10 or newer is required.
- Use from laya import Router; create Router() or Router(preload=True), then call router.predict(state, questions).
- For long documents with laya-multilingual, pass model="multilingual" and max_len=8192.
- Self-host with pip install "laya[serve]" and LAYA_DEVICE=cuda LAYA_PRELOAD=1 laya-serve; it binds 0.0.0.0:8000 and preloads the checkpoints.
- Use laya.load with subfolder="multilingual" or subfolder="typed-decisions" for single-checkpoint mode.
Deployment & Requirements
- Python 3.10 or newer.
- Optional extras include laya[serve] for the HTTP server, laya[mcp], laya[langchain], laya[onnx], and laya[fast].
- The Router lazy default keeps two checkpoints resident; Router(preload=True) preloads all checkpoints; max_loaded controls resident memory.
- laya-serve binds 0.0.0.0:8000 with no authentication unless LAYA_API_KEY is set.
Before You Adopt
- License: Apache-2.0. Review its terms before using, modifying, or distributing the project.
- The base checkpoints are near chance zero-shot on typed-decisions; the 0.766 score comes from a fine-tuned checkpoint.
- High-cardinality choice questions can lose accuracy at default token budgets; raising head_max_len and max_len or using hierarchical choice is recommended.
- The noul yes/no primitive can follow its option labels instead of the state on the English checkpoint; validate outputs or use a neutral two-option choice.
- action.act_probability is not currently a usable signal; gate on confidence instead.
- The model ships over-confident; temperature fitting on your own data is advised before trusting probabilities.