madewithlaya

Catalog / Tools & apps

0051GitHub

laya.cpp: standalone C++ inference with CUDA and Vulkan backends

ggml-based C++ runtime for all three checkpoints. Native tokenization, decision heads and JSON output; optimized FP16/BF16 CUDA on RTX with FP32 accumulation, plus Vulkan.

Throughput measured on an RTX PRO 6000 Blackwell at batches 1–8; precision checked against the Python baseline.

Open source ↗ github.comcostfree, localtime-
lkarlslund/laya.cppREADME ↗
# laya.cpp

Native C++ inference for Laya typed decisions, powered by ggml with CUDA and
Vulkan and Apple Core ML backends. Tokenization, inference and JSON output run without Python.
Supports the `english`, `multilingual` and `typed-decisions` models, plus a
JEV-compatible HTTP server with automatic request batching.

[Binary releases](https://github.com/lkarlslund/laya.cpp/releases) provide Windows
and Linux x64 CUDA/Vulkan executables plus a macOS arm64 Core ML executable. See
[runtime requirements](docs/releases.md) to choose CUDA 12 or 13, check drivers, Windows CUDA DLLs and
compiled Core ML model buckets.

## Performance

Latest paired comparisons against matching-precision Python, using 250 fixed
questions across all three models at batch sizes 1, 2, 4 and 8. Higher is better;
**1× means equal throughput**. NVIDIA measurements use an **RTX PRO 6000
Blackwell (96 GB), capped at 450 W**; AMD measurements use a **Radeon 8060S**.

| GPU | Backend / mode | Throughput relative to Python |
|---|---|---:|
| NVIDIA | CUDA optimized FP32 | 1.35–2.48× |
| NVIDIA | CUDA BF16 | 1.11–2.71× |
| NVIDIA | Vulkan plain FP32 | 0.44–0.73× |
| NVIDIA | Vulkan compensated FP32 | 0.60–1.14× |
| NVIDIA | Vulkan FP16 / BF16 | 0.64–1.02× |
| AMD | Vulkan plain FP32 | 0.61–1.82× |
| AMD | Vulkan compensated FP32 | 1.26–2.45× |
| AMD | Vulkan FP16 | 0.72–1.25× |
| AMD | Vulkan BF16 | 0.49–0.92× |

All measured answer checks pass: exact categories and numeric absolute error
at most **0.0001**. Timings include preprocessing, inference and formatting,
excluding model loading and JSON transport.

See [latest measurements](docs/performance.md) for per-model throughput,
Vulkan FP32 results, direct CUDA/Vulkan comparisons and measurement identities.

## Build

Requires a C++20 compiler, CMake 3.2

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