madewithlaya

Catalog / Tools & apps

0004GitHub

laya-mlx: Laya on Apple Silicon, 60 decisions a second

MLX port of Laya with performance work. Under 1 GB of memory on-device; the demo plays Snake at 60 decisions per second on an M3 Max.

Open source ↗ github.comcostfree, localtime60 decisions/s on M3 Max
mizorewww/laya-mlxREADME ↗
# Laya-MLX



**Open-weight typed decisions, running natively on Apple Silicon.**

**13.4 ms** median end-to-end for a short English typed decision. **7.4 ms** with the multilingual checkpoint. **0 output tokens.** Local MLX inference, with no PyTorch, Transformers runtime, or cloud API.

[中文](https://github.com/mizorewww/laya-mlx/blob/main/README.zh-CN.md) · [Benchmarks](https://github.com/mizorewww/laya-mlx/blob/main/BENCHMARKS.md) · [Snake demo](https://github.com/mizorewww/laya-mlx/blob/main/docs/SNAKE_DEMO.md) · [Hugging Face weights](https://huggingface.co/aac6fef/laya-mlx)

The GIF is an original-speed render of a real local Snake run. Every move calls Laya; the visible cycle safety layer can correct unsafe proposals. The latency figures above are the separate **one-question API benchmark**, not the frame time of the three-question Snake loop. [Watch the 30-second MP4](https://github.com/mizorewww/laya-mlx/blob/main/docs/assets/snake-demo.mp4) · [Snake speed and stability](https://github.com/mizorewww/laya-mlx/blob/main/docs/SNAKE_BENCHMARKS.md).

## Quick start

```bash
pip install laya-mlx
```

```python
import laya_mlx as laya

agent = laya.load("aac6fef/laya-mlx")
result = agent.predict(
    "I was billed twice. Please refund the duplicate.",
    {
        "department": {
            "type": "choice",
            "instructions": "Who should handle this?",
            "criteria": ["billing", "technical", "sales"],
        }
    },
)
print(result["answers"]["department"])
```

Apple Silicon, Python 3.11+, macOS 14+. First load downloads the checkpoint; later inference is fully local. The measured environment is macOS 27.2, Python 3.12.13 and MLX 0.32.2. That MLX release supplies macOS 14, 15 and 26 wheels; the local installer selected the 26 wheel. Older suppor

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. 0013

    Laya exported to ONNX

    ONNX export of the Laya checkpoint so it runs anywhere onnxruntime does, including browsers and edge boxes. An fp16 variant followed a day later.

    Mattepiu · Tools & apps

  3. 0010

    Laya-mlx tied with a custom JAX build on a local game benchmark

    The problem isn't the models, it's how you define the problem space, design the movements / decisions and optimize for it (batching e.g.) Jev wins for a network-based model any day. Local models tied - Laya-mlx and my custom build Jax. Look at them go.

    @tomhacks · Tools & apps

  4. 0009

    A home-made Snake benchmark: Jev vs Laya-MLX vs Kev-4B

    Jev vs locally running Laya-MLX and Kev-4B I built my own snake benchmark. Jev @typesafeai is running via API. The other models are small alternatives running on very little RAM on my Macbook! Jev seems to deliver the best quality no doubt! After running it for a while 0

    @tobiaswup · Tools & apps