mizorewww /laya-mlx

Native MLX runtime for Laya typed decision models — 7–14 ms short decisions on M3 Max. No text generation, PyTorch, or cloud API.

★ 7,104⑂ 577👁 21⑃ 18● 10▤ 4
PythonApache-2.0Created 2026-09-19pypi.org/project/laya-mlx/
Download: laya-mlx v0.6.0laya-mlx-0.6.0 ↓0.6.02026-10-29
+2
Daily
+25
Weekly
+216
Monthly
7,104
stars
577
forks
21
watchers
18
prs
10
issues
4
releases

README

Laya-MLX

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

中文 · Usage reference · Benchmarks · Hugging Face weights · Changelog

Laya answers constrained questions (pick an option, score against a rubric, judge true or
false) with calibrated probabilities from one bidirectional forward pass. It generates no
tokens and returns no JSON to parse. This package runs the original
Laya weights in MLX,
without PyTorch, Transformers or a cloud API.

13.4 ms median for a short English decision, 7.4 ms with the multilingual checkpoint (M3 Max, FP16).

!Laya MLX playing Snake: actual decisions at original speed

 Quick start

Requires Apple Silicon, macOS 14+ and Python 3.11+.

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": "Which department should handle this request?",
            "criteria": {
                "billing": "Payments, invoices, refunds, and duplicate charges.",
                "technical": "Broken features, errors, and product troubleshooting.",
                "sales": "Pricing, upgrades, and new purchases.",
            },
        },
        "refund": {
            "type": "noul",
            "instructions": "Does the customer ask for money back?",
        },
    },
)
print(result["answers"]["department"]["choice"])   billing


Describing each option, as above, works much better than bare labels. The first load
downloads the checkpoint; later inference is fully local.

 Question types

| Type | You provide | You get |
|---|---|---|
| choice | Named options, as a list or a label → description dict | Probability per option |
| score | Ordered rubric levels | Probability per level and the expected level |
| noul | A yes/no proposition | P(true) |

States can be text, JSON-like dicts or conversation lists. Each answer carries calibrated
probabilities and confidence fields; confidence does not guarantee accuracy on a new task.

 Checkpoints

| Pre-converted MLX (FP16) | Original | Parameters | Context | Use |
|---|---|---:|---:|---|
| aac6fef/laya-mlx | convaiinnovations/laya | 421M | 512 | English |
| aac6fef/laya-multilingual-mlx | convaiinnovations/laya-multilingual | 322M | 1,024 | Multilingual input |
| aac6fef/laya-typed-decisions-mlx | convaiinnovations/laya-typed-decisions | 421M | 1,024 | Upstream typed-decisions workflows |

laya.load accepts either column. Context counts instructions, options and state together.
Each published checkpoint includes its model card, validation results, provenance and
checksums (pinned revisions and hashes).

 What else it does

All of these are covered in the usage reference:

- Language routing: Router() detects the language, picks a checkpoint and keeps up to two resident. You can register your own checkpoints.
- Batches and long documents: predict_batch shares forward pas

Latest release

laya-mlx v0.6.0 v0.6.0 2026-10-29
What's Changed
 feat: port upstream Laya v0.4.17 behavior to MLX by @Omicron0314 in https://github.com/mizorewww/laya-mlx/pull/25
 Fix typed batch grouping and hook timeout serialization by @JurhoRr in https://github.com/mizorewww/laya-mlx/pull/26

 New Contributors
 @Omicron0314 made their first contribution in https://github.com/mizorewww/laya-mlx/pull/25
 @JurhoRr made their first contribution in https://github.com/mizorewww/laya-mlx/pull/26

Full Changelog: https://github.com/mizorewww/laya-mlx/compare/v0.5.0...v0.6.0

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON