madewithlaya

Catalog / Tools & apps

0054GitHub

laya-zig: a from-scratch, dependency-free Zig CPU runtime for Laya

Tokenizer, mmBERT-base encoder and decision head in one binary for the 322M multilingual checkpoint. No Python, torch or BLAS; forward pass checked against a reference.

Author calls it about two hours of work and a work in progress.

Open source ↗ github.comcostfree, localtime-
li-ming1/laya-zigREADME ↗
# laya-zig — a pure-Zig CPU runtime for the Laya decision model

**English** | [简体中文](README.zh-CN.md)

> ### Status: work in progress
>
> This is about **two hours of work**, from "can this model run outside Python?"
> to a working port. It runs end to end and the forward pass is checked against an
> independent reference implementation, and it has had one serious performance
> pass (see *Measured* — a Snake decision costs ~200 ms on a laptop CPU), but
> treat it as a **half-finished project**: expect rough edges and missing
> features. It has not been used in anything real.
>
> Issues, corrections and pull requests are welcome.

A from-scratch Zig runtime for the [Laya](https://github.com/NandhaKishorM/laya)
System-1 decision model (`convaiinnovations/laya-multilingual`, 322M). No Python,
no torch, no BLAS: it reads `model.safetensors` directly and runs the whole forward
pass — tokenizer included — on the CPU, in a single process.

It ships with a CLI, a local browser UI, and a Snake probe that measures what a
zero-shot decision model actually does on a task it was never trained for.

## What this is

Laya is a **System-1 decision model**: one forward pass, non-autoregressive, no text
generation. You give it a state (text, JSON, or a conversation) and typed questions,
and it returns option probabilities directly — nothing to parse, nothing to
hallucinate. The reference implementation is Python (`pip install laya`); the model
and its training come from
[Convai Innovations](https://github.com/NandhaKishorM/laya).

This repository is an independent **Zig re-implementation of the same weights**,
aiming at a single dependency-free binary that reads 614 MB of weights and starts
answering in about half a second, offline.

## Highlights

- **No dependencies** — no torch, nump

Also filed under Tools & apps

  1. 0005

    laya-mlx plays Snake at 60 decisions per second

    介绍比Jev快50倍,在你设备上跑的laya-mlx! 只在你的设备上占用最高1G内存 Laya是一个开源的类似于Jev的,基于文本输出概率的分类系统 我将其移植到MLX,并且做了一些性能优化! 视频中就是这个模型在我的本地M3Max上玩贪吃蛇 这个模型能够以每秒决策60次的速度玩贪吃蛇! https://t.co/31KGUiNunb

    @mizorewww · Tools & apps · free, local · 60 decisions/s

  2. 0112

    Laya on Axera AX650 and AX8850 edge NPUs, under 70 ms

    AXERA-TECH's conversion of all three Laya checkpoints for its edge AI chips, reported at latency under 70 ms per decision on AX650/AX8850.

    AXERA-TECH · Tools & apps · free, on-device · < 70 ms on AX650 / AX8850

  3. 0099

    laya-mcp (PerryLink): a warm sidecar that fixes Laya's silent truncation and constant noul

    MCP server plus HTTP sidecar: token-budget preflight that reports what would be cut, a persisted calibration store, structured errors, and a noul fix (P(true) 0.5 → 1.0).

    @PerryLink · Tools & apps · free, local

  4. 0097

    Gomoku against Laya-MLX: you play black, the model picks white's move from six candidates

    Local 15x15 Gomoku on Apple Silicon. Rules in Python, board in the browser, every AI move one real Laya choice over up to six candidates, probabilities shown. No Gomoku training.

    smile-magic · Tools & apps · free, local