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
laya-gomoku
ttianeo
A tkinter Gomoku game uses Laya decisions and heuristics to choose moves
laya-burmese
aungthuhein2005
Studies Laya zero-shot transfer, calibration, and fine-tuning for Burmese topic classification
laya-api
WissemHajbi
Provides a Dockerized local HTTP API for Laya model inference
laya-breakout
Eng-Ahmd
Runs a locally hosted Laya decision model to control a Windows Breakout game
sway-laya
CallSohail
A Gradio word game where players try to elicit specific decisions from Laya
laya-todo
firede
Classifies to-do items locally with Laya and compares its predictions with an optional Kev backend
laya-local
koljahuang
Runs Laya locally with a browser playground, REST API, and SageMaker deployment tools
laya-noul
samiwolf
Runs Laya yes/no decisions on customer-support statements and records calibrated results
laya-codex-bench
pbrehmer-ai
Benchmarks Laya-assisted Codex workflows for call reduction, latency, and decision quality
laya-api-go
jstdlee
A Go REST API serves requests through a persistent Python Laya runtime worker
laya-gfx1030
Thotheris
Runs and benchmarks the Laya decision model on Windows with an AMD Radeon RX 6900 XT
laya-hexagon-npu
EricYu123456
Deploys Laya inference on Qualcomm Hexagon NPU using ONNX Runtime
laya-snake-ai
ArjunSonara
Integrates Laya decisions into a Snake game that navigates hazards and hunts apples
SnakeGame-laya
Cong-Quang
Serves a Laya-powered decision API for a self-playing Snake game
laya-doom-agent
Jaiswal-Siddhant
Uses Laya-MLX to choose actions for an autonomous DOOM agent
exp-laya-router
zheyar-ltd
Demonstrates a CUDA-based Laya policy router in real-time Snake and Tetris games
laya-robot-arm
ramb5144
Uses structured Laya decisions to control a simulated pick-and-place robot arm
laya-snake-ai
IrMaho
Runs a tactical Snake arena powered by the local Laya decision model
laya-agent-kit
Maxwell00000086
Local Laya decision tools integrate with coding agents and ChatGPT through MCP
laya-mlx-advisor
esse
Uses a resident Laya-MLX model to adapt reasoning effort in Codex CLI and Claude Code
obsidian-laya-tagger
tyPhoon-collab
Automatically tags Obsidian notes using the local Laya MLX typed-decision model
laya-trader-binance
XSirch
Builds leakage-aware crypto trading datasets and fine-tunes Laya for typed trading decisions
laya-snake-cuda
inhabitants
Ports the laya-mlx Snake demo to PyTorch for CUDA or CPU and adds a disturbance mode
laya-vs-jev
darrenli6
Compares Laya and Jev in snake-racing and fighting-game arenas
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