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

chinese-laya

yanqiangmiffy

Fine-tunes Laya multilingual for Chinese typed decisions and evaluates the resulting checkpoints

3·GitHub repo

fast-laya-compaction

ShinyDataTech

Uses local Laya decisions to compact agent context and provides filters, caching, and an MCP server

3·GitHub repo

laya-ocr-guard

okrath

Adds fast Laya triage to a dual-gate code impact and regression guard

3·GitHub repo

flappy-laya-openvino-cpu

rupeshs

Runs Laya inference with OpenVINO to control a Flappy Bird game on CPU

3·GitHub repo
W

laya-ara-rag

Wouze

Fine-tunes Laya multilingual for Arabic information retrieval and document reranking

158·HF model
W

laya-multilingual-FP8

Weidows

Provides an FP8 per-row quantization of the multilingual Laya checkpoint with multilingual evaluation results

2·HF model
A

laya-burmese-sib200

aungthuhein-dev

Fine-tunes Laya for calibrated seven-way Burmese topic classification on the SIB-200 dataset

2·HF model
T

laya-vision-modernvbert-250m

thaitea

Adds image inputs to Laya for calibrated typed decisions over images and optional text

2·HF model
T

laya-pt-es-typed

telepatia-ai

Fine-tunes multilingual Laya for typed decisions in Portuguese and Spanish

2·HF model
A

laya-blackjack

adambloebaum

Adapts Laya for blackjack action preferences and probability prediction in simulated play

2·HF model

laya-onnx

gqgs

Exports the Laya model to quantized ONNX for browser inference

2·GitHub repo

docker-laya

chneau

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

2·GitHub repo

laya-mcp

wsargent

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

2·GitHub repo

home-assistant-laya

allenporter

Runs Laya as a local conversation agent for Home Assistant Assist

2·GitHub repo

LayaSnakeGame

AmirTahaMim

A Pygame Snake game compares human play, a greedy baseline, and local Laya decisions

2·GitHub repo

laya-ara

ASNB-Smart-Solutions

Fine-tunes Arabic Laya models for NLU classification and short-list RAG

2·GitHub repo

laya-needle

50bbx

Finds semantically relevant webpage passages with a locally running Laya model

2·GitHub repo

laya-snake

zxrneu

Builds an autonomous Snake game agent using Laya decisions and BFS pathfinding

2·GitHub repo

laya-router-skill

wangmiaozero

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

2·GitHub repo

laya-snake-k3

JiongLab

Runs an offline Laya-powered Snake game on SpaceMIT K3 using ONNX and AI Core

2·GitHub repo

laya-jev-api

smallnest

Serves local Laya Core ML inference through a Jev-compatible HTTP API

2·GitHub repo

laya.axera

AXERA-TECH

Exports and calibrates Laya models for AXERA NPU deployment

2·GitHub repo

laya-serve

stiermid

Serves local Laya decision models through a Jev-compatible HTTP API

2·GitHub repo

laya-windows

Zuhair-01

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

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