Laya for Python

The reference implementation of Laya is the `laya` package on PyPI, maintained by Convai Innovations under Apache 2.0. It ships three checkpoints, a Router that picks one per request by script and language, a CLI, an HTTP server and an optional MCP server.

768 projects

gut-check

rfi-irfos

Uses Laya confidence to route uncertain agent-verification cases to a larger language model

0·GitHub repo

crisis-triage

mazenDDr

Fine-tunes and evaluates Laya for multilingual disaster-message triage with uncertainty routing

0·GitHub repo

vybir

Galactic717

Runs Laya locally with conformal error guarantees and includes score-based game-learning demos

0·GitHub repo

laya

joldibaev

Demonstrates Laya classifying Russian customer requests and scoring urgency and churn risk

0·GitHub repo

laya

vk-alto-none

Provides a multilingual non-autoregressive Laya decision engine with checkpoint routing

0·GitHub repo

laya

lucasnpinheiro

Runs Laya in a Docker container and exposes predictions through an HTTP API and MCP server

0·GitHub repo

LayaGUIDemo

SaturnAura

Provides a Gradio interface for asking Laya choice, score, and yes-or-no questions about text

0·GitHub repo

LayaMCP

aydinozturk

Exposes Laya classification, triage, guardrail, and routing tools through an MCP server

0·GitHub repo

layaSample

MatiasIac

Provides a local FastAPI playground for Laya decisions, including a chess interface

0·GitHub repo

system1

cloudn1ne

Containerizes Laya as a self-hosted HTTP server compatible with the TypeSafe Jev API

0·GitHub repo

LayaBasedAssistant

userasg

Uses Laya to route requests and gate risky actions in a local voice-and-text assistant

0·GitHub repo

comfyui-laya

latent-inpainter

Adds custom Laya nodes to ComfyUI

0·GitHub repo

laya-api

rykhalskyi

Provides an API server for Laya prediction requests with API-key management and rate limits

0·GitHub repo

system-one-poc

tonysprite

Integrates Laya-based typed decisions into DeepSeek Harness tool approvals and selection

0·GitHub repo

laya-service

42tr

Packages Laya's HTTP serving API in a Docker image

0·GitHub repo

jevlaya

holiq

Integrates local Laya inference and hosted Jev into a provider-agnostic decision framework

0·GitHub repo

pixel

adetbekov

Uses Laya to route robot-pet commands locally and Gemini for unknown requests

0·GitHub repo

AudioLaya

ThanabordeeN

Trains a speech-to-decision prototype that classifies calls using Laya decision heads

0·GitHub repo

LAYA-RLCD

shyamsridhar123

Teaches RLCD and trains Laya pilots through a tactical game, lessons, and benchmarks

0·GitHub repo

laya-forge

devjothish

Fine-tunes and calibrates Laya decisions, then uses them to guard production agents

0·GitHub repo

laya-test

JVMoreiraD

Evaluates the Laya model's decision-making capabilities

0·GitHub repo

laya-mlx

Gates-456

Runs open-weight Laya typed decisions locally on Apple Silicon using MLX

0·GitHub repo

laya-ultrafast

ShinyDataTech

Ports a browser-use agent to run Laya locally for browser action decisions

0·GitHub repo

laya-windows

mateusgl8

Ports a terminal Snake game to Windows with real-time decisions from the Laya model

0·GitHub repo

Install

Python 3.10 or newer, per the core README:

python -m pip install laya

Optional extras: laya[serve] (HTTP server), laya[mcp] (MCP server), laya[langchain], laya[onnx] (ONNX Runtime) and laya[fast] (TileLang GPU fast path).

First decision

from laya import Router

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

state = "Hi, we were billed twice for March. Please refund the duplicate today or we will cancel our plan."
questions = {
    "department": {"type": "choice", "instructions": "Which department should handle this?",
                   "criteria": {"billing": "invoices, payments, refunds",
                                "technical": "bugs, outages, system errors",
                                "other": "everything else"}},
    "urgency": {"type": "score", "instructions": "How urgent is this?",
                "criteria": ["not urgent", "soon", "blocking"]},
    "churn_risk": {"type": "noul", "instructions": "Does the user threaten to cancel or leave?"},
}

result = router.predict(state, questions)
print(result["answers"]["department"]["choice"])  # billing
print(result["routing"]["model"])                 # english

The package also installs a laya command, for example laya "My payment failed twice" --preset triage.

Checkpoints

checkpoint encoder params context
laya ModernBERT-large 421M 512
laya-multilingual mmBERT-base 322M 1024 (up to 8,192)
laya-typed-decisions ModernBERT-large 421M 1024

The README reports 32.8 ms for one question with laya-multilingual on a Tesla T4, and 193 to 464 ms per request on CPU with checkpoints preloaded.

Other Python projects

laya-mlx and laya-coreml for Apple Silicon, laya-openvino for Intel CPUs, edgejev for INT8 ONNX on CPU, and laya-mcp for agent tools.

Caveats

The README is direct about limits: the base checkpoints score near chance on its typed-decisions benchmark (0.362 and 0.352), and the 0.766 figure comes from the fine-tuned checkpoint. Temperatures should be refit on your own data before you trust the probabilities. The English checkpoint collapses on non-Latin scripts, which is why the Router exists.

More ways to use Laya