A decision model that answers with probabilities, not prose
Laya runs in Node.js via ONNX Runtime, turning tickets and emails into calibrated choices, rubric scores, and P(true) values in a single forward pass.
What it does
@receptron/laya wraps the Laya decision model — a ModernBERT encoder with a decision head — for Node.js and TypeScript. You feed it a state (a support ticket, an email, a JSON object) plus typed questions, and it returns answers with calibrated probabilities in one forward pass: choice picks an option with per-option probabilities, score places the state on an ordered rubric, and noul gives a calibrated P(true) for a yes/no statement. No text generation, no Python at runtime — ONNX Runtime does the inference, and outputs match the Python reference implementation to four decimal places.
The interesting bit
The boring part is the value: it’s a classifier you can interrogate with many questions at once, batched into a single model run (three questions in ~140 ms on Apple silicon, warm). The answer_confidence field is the same quantity — max probability — across all question types, so you can build one confidence-gating rule for everything instead of per-type thresholds.
Key highlights
- Three answer types (
choice,score,noul), each with calibrated probabilities and a uniformanswer_confidence. - Runs fully offline after the ~1.7 GB weights are cached; no PyTorch or Python needed.
- Typed responses — a
choicequestion yields aChoiceAnswerwithout casting. - Reproducible loads: pin a
revision, point at a local ONNX export, or swap checkpoint variants. - Ships an ONNX export script (
export/export_onnx.py) with a logit-diff check against PyTorch (~1e-5).
Caveats
- Heavy footprint: ~1.7 GB weights, ~2 GB RAM for the loaded model plus a few hundred MB per batch.
- Hard limits: 192 tokens per question’s options, 512-token state truncation, and roughly 20 options max per
choiceper the model’s own recommendation. - Confidence values for
choicequestions with 11+ options intentionally differ from upstream due to temperature clamping (0.945 vs. the checkpoint’s 0.1006, which Python clamps to 0.5).
Verdict
Worth a look if you’re routing tickets, triaging emails, or gating LLM pipelines on calibrated confidence in a JS stack. Skip it if you need generated text or want a model under a gigabyte.
Frequently asked
- What is receptron/laya?
- Laya runs in Node.js via ONNX Runtime, turning tickets and emails into calibrated choices, rubric scores, and P(true) values in a single forward pass.
- Is laya open source?
- Yes — receptron/laya is open source, released under the MIT license.
- What language is laya written in?
- receptron/laya is primarily written in TypeScript.
- How popular is laya?
- receptron/laya has 948 stars on GitHub.
- Where can I find laya?
- receptron/laya is on GitHub at https://github.com/receptron/laya.