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.

1713 projects

Laya-Dockerized

sseeyyeedd

A local FastAPI service runs the multilingual Laya decision model and exposes prediction endpoints

1·GitHub repo

laya-compactor

Gjusev

Compacts RAG context by scoring and removing less relevant retrieved documents with Laya

1·GitHub repo

laya-router

Gjusev

Routes prompts between inexpensive and frontier models through an OpenAI-compatible proxy using Laya

1·GitHub repo

laya-moderation

vinay162

Fine-tunes Laya for toxic-comment moderation and publishes a demo and API

1·GitHub repo

laya-phishield

Gjusev

Combines Laya-based semantic signals with deterministic checks to explain phishing email classifications

1·GitHub repo

laya-triage

Gjusev

Uses Laya for multilingual support-ticket routing, risk signals, and confidence-based escalation

1·GitHub repo

laya-evals

Gjusev

Evaluates Laya decision models and audits confidence calibration for automated decisions

1·GitHub repo

laya-skill

StevenLi-phoenix

A Claude Code skill runs, fine-tunes, evaluates, and exports Laya typed-decision models

1·GitHub repo

poc-laya

macu-dev

A Jira issue-triage proof of concept uses Laya to classify tickets and assess confidence

1·GitHub repo

laya-blueprint-es

CamiloBernal

A Spanish-language guide teaches Laya installation, evaluation, integration, and production use

1·GitHub repo

hoja-de-ruta

fcori47

A Python web app orders YouTube videos into learning roadmaps using Jev or Laya

1·GitHub repo

laya-evals-gate

Gjusev

Compares Laya evaluation metrics against baselines and fails CI when accuracy or calibration regresses

1·GitHub repo

typed-decision-slay-the-spire

MindrLabs

Compares Convai Laya and Nimble models playing Slay the Spire, including fine-tuned runs

1·GitHub repo
H

laya-hebrew

hugging-apps

Demonstrates calibrated Hebrew and English decisions with a Laya decision model

1·HF Space

Claude-laya

HardikCoder45

A Claude Code plugin uses Laya to select models, skills, agents, and plugins for each prompt

1·GitHub repo

hermes-laya

agusbyna

A Hermes Agent plugin uses Laya for local triage, classification, routing, and risk flags

1·GitHub repo

google-adk-laya-router

derrickqin

A Google ADK example routes requests among Gemini tiers using Laya and evaluates routing results

1·GitHub repo

laya-jev-benchmark

eugeneproai

Compares local Laya and hosted Jev across decision scenarios with benchmark telemetry

1·GitHub repo

ComfyUI-SystemOne

dante01yoon

Adds ComfyUI nodes that route workflows using local Laya or hosted Jev judgments

1·GitHub repo
D

laya-engine

devinblaze

A Gradio API and interface for multilingual Laya decisions

1·HF Space

safe-laya

ottosulin

Fine-tunes Laya to classify prompt injections, jailbreaks, harmful requests, and benign text

1·GitHub repo

playground

ufuayk

Provides a browser playground for a Laya-MLX decision model served by FastAPI

1·GitHub repo

laya-graph-harness

FMsongX2

Integrates a trained Laya model with Cognee and Neo4j for evidence-backed graph selection

1·GitHub repo

edge-decision-laya-system1-demo

skdwriting

Demonstrates low-latency edge decisions using the Laya System 1 model and safety guardrails

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