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.

1712 projects

R

Laya-Hebrew-V2.1

RoeiG

Fine-tunes a Laya-style model for calibrated Hebrew and English typed decisions

40·HF model
H

laya-tr-karar

hayriyigit

Fine-tunes Laya for Turkish typed decisions, including choice, yes/no, and score questions

35·HF model
1

laya-prompt-guard

16sulphur

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

18·HF model
X

laya-burger

xamjiang

Fine-tunes Laya for calibrated typed decisions in Taiwanese Traditional Chinese and English

18·HF model
I

laya-browser-v32b

ichenney

Fine-tunes a Laya-based decision model for browser-agent navigation and page-state judgments

3·HF model
S

laya-vision

savita10

Adds image input to Laya for calibrated 16-class scanned document classification

3·HF model

chunklaya

myxamediyar

Chunks long documents and uses Laya for typed-decision lookup across inputs up to one million tokens

3·GitHub repo

laya-onnx

gqgs

Exports the Laya model to quantized ONNX for browser inference

3·GitHub repo

pastewhat-ranker-v1

mizorewww

Distills a candidate-aware clipboard ranker into Laya multilingual for local inference

3·GitHub repo

zero-shot-ie-bench

umstek

Compares Laya and other zero-shot systems across information-extraction and classification tasks

3·GitHub repo

docker-laya

chneau

Serves Laya typed-decision predictions through an authenticated, multi-checkpoint FastAPI service

3·GitHub repo

laya-mcp

wsargent

Runs local Laya inference on Apple Silicon and exposes typed-decision tools through an MCP server

3·GitHub repo

structured-decision-bench

zhengbangbo

Benchmarks structured decisions from Qwen3, Jev, and Laya CoreML

3·GitHub repo

laya-router-skill

wangmiaozero

Adds local Laya decision routing to coding agents through skills and MCP

3·GitHub repo

jev-chat-windows-laya

ZJemYoung

Adds an optional local Laya backend to a Windows WeChat chat assistant

3·GitHub repo

doomLaya

azalio

Trains and compares Laya and Jev agents playing FreeDoom with reproducible results

3·GitHub repo

Laya-Showcase

zamax14

Demonstrates and benchmarks multilingual Laya alongside Jev and GPT models

3·GitHub repo

laya-windows

Zuhair-01

Ports Laya typed-decision inference to Windows using ONNX Runtime and DirectML

3·GitHub repo

laya-cli

MIt9

A CLI runs Laya typed decisions with batch, routing, and resident-daemon modes

3·GitHub repo

Decis

chaitin

Serves open decision models through a self-hosted TypeSafe System One API

3·GitHub repo

laya-cn

yangshun2005

Provides a Chinese translation of Laya documentation for its multilingual typed-decision engine

3·GitHub repo

oh-my-laya

leo1394

Installs local Laya tools for classification, scoring, and routing in coding agents

3·GitHub repo

laya-ternary-lite

xixi3548942758-design

Quantizes Laya to ternary weights for smaller, lower-memory inference

3·GitHub repo

decidealot

psyb0t

Serves local Laya and Von decision models through TypeSafe-compatible HTTP and MCP APIs

3·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