Laya | Non-Autoregressive System 1 Calibrated Decision Engine
Laya
Introduction
Laya is an open-source, Apache 2.0 licensed, non-autoregressive ‘System 1’ decision engine engineered to replace slow, expensive, and hallucinatory autoregressive LLMs for structured routing, classification, scoring, and guardrail decisions. Operating in a single forward pass (~33ms latency) across 100+ languages, Laya combines a compact 421M-parameter ModernBERT-large encoder trained via RLCD (Reinforcement Learning for Calibrated Decisions against strictly proper scoring rules) with a newer VegaML physics-inspired conformal decision engine (`laya.Agent()`) capable of processing multimodal inputs (text, image, audio, video) and up to 73,728 tokens of context with calibrated confidence, abstention, and out-of-distribution flags.
Use Cases
Sub-40ms Multi-Agent & Workflow Routing
Replace multi-second LLM router calls in LangGraph, CrewAI, and LlamaIndex pipelines with deterministic, calibrated single-pass intent and tool selection.
Prompt Guardrails, Safety Triage & Escalation Gating
Evaluate user inputs and agent actions in real time with calibrated yes/no probabilities (`noul`), automatic abstention flags, and teacher-escalation triggers (`laya.Escalator`) when confidence is low.
Multilingual Ticket Triage & Urgency Scoring
Automatically detect scripts across 100+ languages, classify incoming customer requests (billing, HR, PR, sales, technical), and assign continuous urgency scores in one forward pass.
Continuous CPU-Based Online Learning Without Fine-Tuning
Deploy `laya.Learner` to adapt to domain-specific labels and human-confirmed corrections on local CPU hardware in seconds (~34 seconds for 300 examples) without rewriting neural network weights.
Long-Context & Multimodal Document Classification
Analyze up to 73,728-token contracts, logs, and conversation threads—as well as images, audio, and video—to output typed Pydantic or JSON-schema decisions locally with zero cloud egress.
Features & Benefits
Single-Pass Non-Autoregressive Typed Decisions
Produces deterministic `choice` (categorical selection), `score` (continuous scale), and `noul` (calibrated yes/no probability) outputs in ~33ms without token-by-token generation.
Calibrated Uncertainty, Abstain & Out-of-Distribution (OOD) Flags
Trained against strictly proper scoring rules (RLCD) and paired with conformal prediction sets so every decision includes calibrated probability estimates, abstention signals, and OOD detection.
VegaML Multimodal & 73k-Token Reader Engine (`laya.Agent()`)
Layers a deterministic physics-inspired decision head atop frozen readers (0.8B to 27B) to handle text, images, audio, video, and 73,728-token documents in one unified API call.
Gradient-Free Continuous Learning & Teacher Escalation
Includes `laya.Learner` for rapid CPU-only incremental adaptation from labeled CSVs or live feedback streams, alongside `laya.Escalator` and `laya.vllm_teacher` for uncertain edge cases.
Automatic Language & Checkpoint Routing
Built-in `Router` inspects input language and task complexity to dispatch requests dynamically between English, 100+ language multilingual (`max_len=8192`), and domain-specialized checkpoints.
Full Ecosystem, Edge & Multi-Language SDK Support
Apache 2.0 licensed (`pip install laya`, `npm install laya-ts`) with extras for HTTP serving (`laya[serve]`), MCP stdio server (`laya[mcp]`), LangChain/LangGraph, LlamaIndex, CrewAI, Pydantic structured outputs, ONNX Runtime, and TileLang GPU acceleration.
Orders-of-Magnitude Faster & Cheaper Than LLM Routers
Eliminates autoregressive token generation overhead, delivering sub-40ms local decisions with constant compute cost and zero API latency.
Mathematically Calibrated Confidence & Safe Abstention
Proper scoring rule training and conformal prediction prevent overconfident hallucinations, letting systems reliably abstain or escalate ambiguous inputs to larger models or humans.
Runs 100% Locally on CPU, GPU, or Edge Hardware
Compact footprint with ONNX Runtime and TypeScript/WASM builds enables private, zero-egress deployment on standard CPUs, edge devices, and air-gapped servers.
Cons
Not a Generative Text or Reasoning Engine
Strictly designed for ‘System 1’ reflex decisions (classification, routing, scoring, gating) rather than open-ended text synthesis, summarization, or multi-step code generation.
Rapidly Moving Pre-1.0 API Surface
Active architectural evolution (such as transitioning default engines from classic ModernBERT encoders to VegaML in v0.5.x) requires pinning versions and tracking release notes in production.