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
laya-mirror
heheebei-rgb
Mirrors Laya model checkpoints and provides a script to reconstruct and verify their weights
laya-tetris
cohenom
Runs Tetris with a placement-search heuristic while displaying Laya's live board-state decisions
laya-demo
cyyeh
Provides a Gradio playground, CLI scenarios, and device benchmarks for Laya
laya-deployment
80233456
Deploys Laya locally and tests its typed decisions and LLM integration
laya-rogue
satkur
Experiments with Laya-controlled play in a Rogue-like game, including a fine-tuned decision head
laya-test
petrixh
Runs Laya as the decision-making pilot in a browser game with reproducible evaluations
laya-snake
cohenom
Uses Laya’s text-decision classifier to choose Snake movements on each game tick
laya-api
sriramkasyap
Provides a self-hosted, Jev-compatible HTTP API for Laya typed decisions
Laya-2048
DjTaNg-404
Uses local Laya weights to play 2048 with browser, terminal, and batch-testing interfaces
laya-2048
cohenom
Shows Laya's live move votes alongside a heuristic 2048 player
laya-docker-api
ksalk
Packages the local Laya decision engine as a GPU-enabled Docker HTTP API
laya-multilingual-playground
DwainYu
Demonstrates running Laya Multilingual locally on CPU with ModelScope
laya-local-service
uibuckets
Provides a local HTTP inference service and Python client for Laya
laya-codex-triage
kanottonp
Evaluates local Laya recommendations for model tier and reasoning effort in Codex
laya-ems-test
frahlg
Tests Laya as a decision controller in a simulated Swedish home energy system
dsh-laya-router
ricardochen1996
Routes agent requests using a local Laya-MLX typed-decision model
laya-snake-cuda
kuchris
Compares Laya and SemIf for local real-time Snake decisions with a CUDA dashboard
docker-laya-api
TheNerdMan
Packages the Laya decision model as a containerized HTTP API with an optional browser demo
sag-laya-integration
DATN-SPRING2027
Integrates a local Laya router into the SAG application for question classification
lunar-mpc-laya
mraad
Pairs Laya with adaptive model-predictive control in a lunar lander decision game
laya-mlx-demo
knishika62
Uses laya-mlx to classify Japanese virtual streamer personas and compare results with an LLM
laya_ai-test
sirogarasu
Runs Laya multilingual inference in a CUDA-enabled Docker environment
laya-mcp-npm
PerryLink
Launches a Python MCP server that exposes Laya typed decisions to Node.js clients
jev-vs-laya
mouadse
Benchmarks hosted Jev, Kev-9B, and Laya on Moroccan Darija sentiment classification
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