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.

770 projects

K

laya-decision-lab

KGFCode

Demonstrates Laya text classification, scoring, and probability analysis with an API and MCP service

0·HF Space
2

laya-demo-0921

2045max

Demonstrates Laya decisions for routing, triage, moderation, RAG filtering, and other tasks

0·HF Space
N

laya-demo

nile1801

Demonstrates typed decisions, calibrated probabilities, and multilingual routing with Laya checkpoints

0·HF Space
M

laya-triage

Mezahir2025

Provides a Laya-based message triage API for Make.com

0·HF Space
N

laya-school-email-triage

nccyber

Demonstrates Laya for routing and assessing urgency in synthetic school emails

0·HF Space
A

laya_api

Anuragggggggg

Serves Laya typed-decision endpoints for generic decisions and candidate routing

0·HF Space
H

laya

henrybit

Demonstrates Laya typed decisions with English and multilingual checkpoints

0·HF Space
W

laya-demo

wuyouxiaobai

Provides a landing page and deployable Gradio demo for Laya typed decisions

0·HF Space
H

laya-decision-playground

hadeas

Provides a Gradio playground for Laya typed decisions with editable schemas and probability outputs

0·HF Space
A

laya-demo

aired

Demonstrates Laya typed decisions for triage, guardrails, filtering, moderation, and routing

0·HF Space
P

laya-prompt-guardrail

Parvathy-2025

Uses Laya to score prompts for jailbreak and injection risk before an LLM call

0·HF Space
N

laya-demo

nickfury6023

Demonstrates Laya typed decisions for triage, guardrails, filtering, moderation, and routing

0·HF Space
D

laya-multilingual-demo

DennisRadix58

Demonstrates multilingual Laya typed decisions for triage, guardrails, moderation, and exploration

0·HF Space
K

viralpilot-laya

khushali678

Analyzes content and scores its potential virality through an AI API

0·HF Space
T

laya-webgpu

ti3x-m

Runs Laya typed-decision checkpoints in the browser using WebGPU or WASM

0·HF Space
D

laya-demo

dungdq1

Demonstrates Laya typed decisions for routing, moderation, guardrails, and retrieval filtering

0·HF Space
X

laya-fp16-parity

xauberer93

Checks FP16 parity for the Laya model on a ZeroGPU lane

0·HF Space
R

Laya-demo

robynsd

Provides an API demo for Laya typed decisions without text generation

0·HF Space

laya-trader

antonellof

Uses Laya MLX to paper-trade crypto and stocks with a dashboard and backtesting tools

0·GitHub repo

system-one-reexamined

CodeWithMoin

Benchmarks Laya and Jev against zero-shot NLI and SetFit classifiers

0·GitHub repo

semantic-operators

jasonduncan

Provides Python, CLI, and MCP interfaces for typed judgments using Laya and Jev

0·GitHub repo

laya

byrash

Provides download instructions for the English and multilingual Laya models

0·GitHub repo

laya-shim

bunkerlab-net

Serves Laya or Laya-MLX behind TypeSafe's System One API route

0·GitHub repo

jev-vs-laya

vizakan10

Compares Jev and Laya decision quality and speed by having both models play Wordle

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