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

0·GitHub repo

laya-tetris

cohenom

Runs Tetris with a placement-search heuristic while displaying Laya's live board-state decisions

0·GitHub repo

laya-demo

cyyeh

Provides a Gradio playground, CLI scenarios, and device benchmarks for Laya

0·GitHub repo

laya-deployment

80233456

Deploys Laya locally and tests its typed decisions and LLM integration

0·GitHub repo

laya-rogue

satkur

Experiments with Laya-controlled play in a Rogue-like game, including a fine-tuned decision head

0·GitHub repo

laya-test

petrixh

Runs Laya as the decision-making pilot in a browser game with reproducible evaluations

0·GitHub repo

laya-snake

cohenom

Uses Laya’s text-decision classifier to choose Snake movements on each game tick

0·GitHub repo

laya-api

sriramkasyap

Provides a self-hosted, Jev-compatible HTTP API for Laya typed decisions

0·GitHub repo

Laya-2048

DjTaNg-404

Uses local Laya weights to play 2048 with browser, terminal, and batch-testing interfaces

0·GitHub repo

laya-2048

cohenom

Shows Laya's live move votes alongside a heuristic 2048 player

0·GitHub repo

laya-docker-api

ksalk

Packages the local Laya decision engine as a GPU-enabled Docker HTTP API

0·GitHub repo

laya-multilingual-playground

DwainYu

Demonstrates running Laya Multilingual locally on CPU with ModelScope

0·GitHub repo

laya-local-service

uibuckets

Provides a local HTTP inference service and Python client for Laya

0·GitHub repo

laya-codex-triage

kanottonp

Evaluates local Laya recommendations for model tier and reasoning effort in Codex

0·GitHub repo

laya-ems-test

frahlg

Tests Laya as a decision controller in a simulated Swedish home energy system

0·GitHub repo

dsh-laya-router

ricardochen1996

Routes agent requests using a local Laya-MLX typed-decision model

0·GitHub repo

laya-snake-cuda

kuchris

Compares Laya and SemIf for local real-time Snake decisions with a CUDA dashboard

0·GitHub repo

docker-laya-api

TheNerdMan

Packages the Laya decision model as a containerized HTTP API with an optional browser demo

0·GitHub repo

sag-laya-integration

DATN-SPRING2027

Integrates a local Laya router into the SAG application for question classification

0·GitHub repo

lunar-mpc-laya

mraad

Pairs Laya with adaptive model-predictive control in a lunar lander decision game

0·GitHub repo

laya-mlx-demo

knishika62

Uses laya-mlx to classify Japanese virtual streamer personas and compare results with an LLM

0·GitHub repo

laya_ai-test

sirogarasu

Runs Laya multilingual inference in a CUDA-enabled Docker environment

0·GitHub repo

laya-mcp-npm

PerryLink

Launches a Python MCP server that exposes Laya typed decisions to Node.js clients

0·GitHub repo

jev-vs-laya

mouadse

Benchmarks hosted Jev, Kev-9B, and Laya on Moroccan Darija sentiment classification

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