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.

696 projects

1

laya-prompt-guard

16sulphur

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

1·HF model
F

laya-idjvsuen-v1

faall7479

A multilingual Laya fine-tune returns calibrated typed decisions on Indonesian, Javanese, Sundanese and English text

1·HF model

nlp-serving

saugataroyarghya

A BentoML playground serving and comparing focused NLP models, including Laya

1·GitHub repo

laya-jev

KonghaYao

Runs local Laya inference and exposes Jev-compatible HTTP endpoints

1·GitHub repo

decision-model-playground

tedliou

A local web playground comparing Laya and Jev for recommending articles

1·GitHub repo

hermes-skill-router

cdepuy

Routes tasks to relevant Hermes skills using a local Laya model or SemIf

1·GitHub repo

ultra_laya

roadius2

A fork of Laya adds multilingual decision routing and checkpoint selection

1·GitHub repo

omp-laya

KiidxAtlas

Adds local Laya decision policies and verification controls to Oh My Pi

1·GitHub repo

laya-go

lengoman

Provides Go types, routing, batching, and transports for using local Laya checkpoints

1·GitHub repo

laya-tetris-finetuning

hama-jp

Fine-tunes Laya for real-time Tetris placement decisions and documents the experiments

1·GitHub repo

laya-plays-doom

shantanugoel

Trains Laya with reinforcement learning to play Doom through ViZDoom

1·GitHub repo

pastewhat

mizorewww

A native macOS clipboard companion recommends entries using a local Laya model or optional Jev backend

1·GitHub repo

jev-codex-workbench

qualixar

Adds Jev decisions and optional local Laya-MLX routing to a Codex plugin and MCP server

1·GitHub repo

jev-vs-open-decision-models

elcronos

Benchmarks Jev against Laya and PrismNLI on zero-shot text classification tasks

1·GitHub repo

sokudan

hiroki-abe-58

Builds a Japanese typed-decision model and benchmarks it against Laya

1·GitHub repo

laya

givespace-asia

A Claude Code plugin uses Laya to guard shell commands and code patches

1·GitHub repo

laya

xosi

Runs Laya typed-decision inference locally on Apple Silicon with MLX

1·GitHub repo

fastlaya

emtay-com

Serves English and multilingual Laya decision models through a FastAPI service

1·GitHub repo

laya-server

pambrose

Implements a Jev-compatible API server backed by local Laya checkpoints

1·GitHub repo

chatassistant-laya

HarrisXiu

Analyzes pasted chat messages locally with Laya and can generate optional reply suggestions

1·GitHub repo

laya-mcp

PerryLink

An MCP server for Laya typed decisions with preflight checks and persisted calibration

1·GitHub repo

laya-mlx-ddz

smile-magic

A browser-based 斗地主 game lets two local AI seats play using Laya on Apple Silicon

1·GitHub repo

jev-vs-laya

DDnim

Benchmarks Jev and Laya on typed decisions for reviewing SQL statements

1·GitHub repo

laya-plays-mario

DavidDevGt

Fine-tunes Laya as a control policy for playing Super Mario Bros

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