Run Laya in the browser

Laya is small enough to run in a browser tab with no server and no API key. The input never leaves the page. The trade-off is a download of several hundred megabytes on the first visit and much slower inference than a native runtime.

361 projects

laya-workbench

uu889

Installs and serves local Laya with a bilingual web workbench and remote decision API options

3·GitHub repo
I

laya-onnx

inferenceprince

Exports Laya to ONNX for inference with ONNX Runtime on CPUs, GPUs, and browsers

344·HF model
T

laya-typed-decisions-onnx

ti3x-m

Exports the Laya typed-decisions checkpoint to ONNX for CPU and browser inference

247·HF model
K

open-jev-laya-multilingual-onnx

killkli

A browser-ready ONNX export of Laya multilingual for typed decisions

124·HF model
N

laya-web-q8

nvkudva

Runs an 8-bit ONNX conversion of Laya locally in web browsers

2·HF model
N

laya-onnx-q8

nvkudva

Runs an 8-bit ONNX export of Laya in the browser for local text classification and decisions

2·HF model

laya-sdk

ryuzcorp

Provides a TypeScript SDK for running cached Laya decision models locally in browsers and Node

2·GitHub repo

laya-portable

MatteoGauthier

Exports Laya to ONNX and provides JavaScript runtimes for Node.js and browser inference

2·GitHub repo

laya-needle

50bbx

Finds semantically relevant webpage passages with a locally running Laya model

2·GitHub repo

laya-asteroids-local

Klerith

Runs the Laya decision model locally to play Asteroids in a browser

2·GitHub repo

systemone-lab

baldellimtt

Demonstrates typed System One decisions with local Laya, a playground, routing examples, and evaluation tests

2·GitHub repo
A

laya-typed-decisions-web-q8

alfred361

Provides a quantized web build of Laya typed-decision models

1·HF model
V

layaForWeb

VishalMysore

Provides quantized ONNX checkpoints and a demo for running Laya in browsers

1·HF model
H

cut-laya-onnx

harshpreet931

An 8-bit ONNX conversion runs Laya text classification in browser-based editors

1·HF model
V

layaForWebTrained

VishalMysore

Provides a quantized ONNX version of Laya typed decisions for browser inference

1·HF model
B

laya-plays-google-snake

BoogieKn

Provides an imitation-trained Laya checkpoint that scores moves in the Google Snake game

1·HF model
G

laya-web-q8

go-vertika

Provides an 8-bit ONNX quantization of Laya for in-browser decision inference

1·HF model
K

laya-browser-agent

knpatil

Fine-tunes a ModernBERT-based Laya model for autonomous browser control

1·HF model
N

laya-typed-decisions-onnx

ningsuhen

Converts Laya typed decisions to fp16 ONNX for browser inference with WebGPU

1·HF model

decision-model-playground

tedliou

A local web playground comparing Laya and Jev for recommending articles

1·GitHub repo

laya-mlx-ddz

smile-magic

A browser-based 斗地主 game lets two local AI seats play using Laya on Apple Silicon

1·GitHub repo

laya-jev-arena

dante01yoon

Compares local Laya and hosted Jev models in games and measurement tools

1·GitHub repo

laya-invaders

inhabitants

Uses Laya to choose targets in a Space Invaders game and compares it with a rule baseline

1·GitHub repo

system-one-playground

minkhant1996

Provides a local web playground for Laya and other System One decision models

1·GitHub repo

Libraries

kevala is a zero-dependency Rust engine compiled to WebAssembly, with WebGPU kernels. It works from any page:

<script type="module">
  import { Kevala } from "https://cdn.jsdelivr.net/npm/kevala@latest/js/src/index.js";
  const kevala = await Kevala.load({ model: "laya", onProgress: console.log });
</script>

or pnpm add kevala. According to its README, the Laya int8 pack is 479 MB and is kept in browser storage after the first visit.

@r4ai/laya-web runs ONNX Runtime Web with WebGPU and a WebAssembly SIMD fallback, and is designed to run in a Web Worker:

npm install @r4ai/laya-web onnxruntime-web

Demos you can open

  • layaForWeb: the English checkpoint as quantized ONNX (default build about 440 MB), with a live demo.
  • open-jev-laya: multilingual Laya on Transformers.js (fp16 ONNX about 647 MB) with Gomoku, Big Two and a 3D maze.
  • layaAsRagJudge: checks RAG claims against retrieved evidence entirely in the tab.

Speed and support

The layaForWeb README reports that a three-question call on the default WASM backend took about 2 to 5 seconds on a 2-core machine. In that project, WebGPU works only with the int4 build, because ONNX Runtime's WebGPU MatMulNBits kernel supports 2- and 4-bit weights. open-jev-laya tries WebGPU and falls back to WebAssembly.

Caveats

Quantized browser builds do not match PyTorch exactly. layaForWeb reports 97.9% top-answer agreement for all three of its quantized builds, with the largest probability gaps in int4. For a real-time loop, laya-pong keeps the model native. Its README gives the reason: the checkpoint wants about 2.4 GB resident in f32, and wasm32 has a 4 GB address space and no Metal.

More ways to use Laya