madewithlaya

Catalog / Tools & apps

0052GitHub

laya-rust: pure-Rust Laya inference on candle, CPU/Metal/CUDA

No Python, no torch, no ONNX export. Loads the ungated safetensors directly and runs any of the three checkpoints on CPU, Metal or CUDA.

Open source ↗ github.comcostfree, localtime-
aovestdipaperino/laya-rustREADME ↗
# laya

Rust inference for [Laya](https://huggingface.co/convaiinnovations/laya), a non-autoregressive
typed-decision model of the kind TypeSafe calls a
[System One model](https://typesafe.ai/blog/introducing-system-one-models-and-jev). You give
it a **state** (text or JSON) and a set of **typed questions**; it returns typed answers with
calibrated probabilities in a single forward pass. It never
generates text, so there is nothing to parse and nothing to hallucinate.

Pure Rust on [candle](https://github.com/huggingface/candle) — no Python, no torch, no ONNX
export step. Runs on CPU, Metal, or CUDA.

## Getting the weights

The root checkpoint is Apache-2.0 and ungated, so no token is needed:

```sh
mkdir -p models/laya-base/encoder models/laya-base/tokenizer
B=https://huggingface.co/convaiinnovations/laya/resolve/main
for f in model.safetensors encoder/config.json tokenizer/tokenizer.json \
         tokenizer/tokenizer_config.json rl_agent_config.json; do
  curl -sL -o models/laya-base/$f "$B/$f"
done
```

That is ~847 MB. The repo also carries two sibling variants under
[`multilingual/`](https://huggingface.co/convaiinnovations/laya-multilingual) and
[`typed-decisions/`](https://huggingface.co/convaiinnovations/laya-typed-decisions); this crate
loads any of them, since the layout is identical, so point `--model` at the directory you
downloaded. `typed-decisions/` is the fine-tuned one, marked
`"fine_tuned": true` with temperatures near 1.0 rather than near 2.0, and it is the sensible
default for typed decisions.

## CLI

```sh
cargo build --release
./target/release/laya \
  --state-file examples/ticket.txt \
  --questions examples/questions.json
```

```json
{
  "model": "rl-agent",
  "answers": {
    "department": {
      "type": "choice",
      "choice": "billing",

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