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

0·GitHub repo

laya-burmese

aungthuhein2005

Studies Laya zero-shot transfer, calibration, and fine-tuning for Burmese topic classification

0·GitHub repo

laya-api

WissemHajbi

Provides a Dockerized local HTTP API for Laya model inference

0·GitHub repo

laya-breakout

Eng-Ahmd

Runs a locally hosted Laya decision model to control a Windows Breakout game

0·GitHub repo

sway-laya

CallSohail

A Gradio word game where players try to elicit specific decisions from Laya

0·GitHub repo

laya-todo

firede

Classifies to-do items locally with Laya and compares its predictions with an optional Kev backend

0·GitHub repo

laya-local

koljahuang

Runs Laya locally with a browser playground, REST API, and SageMaker deployment tools

0·GitHub repo

laya-noul

samiwolf

Runs Laya yes/no decisions on customer-support statements and records calibrated results

0·GitHub repo

laya-codex-bench

pbrehmer-ai

Benchmarks Laya-assisted Codex workflows for call reduction, latency, and decision quality

0·GitHub repo

laya-api-go

jstdlee

A Go REST API serves requests through a persistent Python Laya runtime worker

0·GitHub repo

laya-gfx1030

Thotheris

Runs and benchmarks the Laya decision model on Windows with an AMD Radeon RX 6900 XT

0·GitHub repo

laya-hexagon-npu

EricYu123456

Deploys Laya inference on Qualcomm Hexagon NPU using ONNX Runtime

0·GitHub repo

laya-snake-ai

ArjunSonara

Integrates Laya decisions into a Snake game that navigates hazards and hunts apples

0·GitHub repo

SnakeGame-laya

Cong-Quang

Serves a Laya-powered decision API for a self-playing Snake game

0·GitHub repo

laya-doom-agent

Jaiswal-Siddhant

Uses Laya-MLX to choose actions for an autonomous DOOM agent

0·GitHub repo

exp-laya-router

zheyar-ltd

Demonstrates a CUDA-based Laya policy router in real-time Snake and Tetris games

0·GitHub repo

laya-robot-arm

ramb5144

Uses structured Laya decisions to control a simulated pick-and-place robot arm

0·GitHub repo

laya-snake-ai

IrMaho

Runs a tactical Snake arena powered by the local Laya decision model

0·GitHub repo

laya-agent-kit

Maxwell00000086

Local Laya decision tools integrate with coding agents and ChatGPT through MCP

0·GitHub repo

laya-mlx-advisor

esse

Uses a resident Laya-MLX model to adapt reasoning effort in Codex CLI and Claude Code

0·GitHub repo

obsidian-laya-tagger

tyPhoon-collab

Automatically tags Obsidian notes using the local Laya MLX typed-decision model

0·GitHub repo

laya-trader-binance

XSirch

Builds leakage-aware crypto trading datasets and fine-tunes Laya for typed trading decisions

0·GitHub repo

laya-snake-cuda

inhabitants

Ports the laya-mlx Snake demo to PyTorch for CUDA or CPU and adds a disturbance mode

0·GitHub repo

laya-vs-jev

darrenli6

Compares Laya and Jev in snake-racing and fighting-game arenas

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