Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

docs(readme): correct above/below cross-references and a missing article

Ashd5e9955e04e3
diff --git a/BENCHMARKS.md b/BENCHMARKS.md
index 39213d9b..336fbfef 100644
--- a/BENCHMARKS.md
+++ b/BENCHMARKS.md
@@ -153,7 +153,7 @@ Each is real labelled data, 400 cases, all three checkpoints. *held out* means t
### On the public datasets where Jev numbers exist
-Laya columns are from the same Applications run (`research/results/app_benchmark_results.json`, N=400 per task), so AG News / DAIR Emotion differ slightly from the committed T4 English suites below (N=600: 0.947 / 0.573 for `laya`).
+Laya columns are from the same Applications run (`research/results/app_benchmark_results.json`, N=400 per task), so AG News / DAIR Emotion differ slightly from the committed T4 English suites above (N=600: 0.947 / 0.573 for `laya`).
| dataset | laya | laya-multilingual | laya-typed-decisions | Jev (published) |
|---|---|---|---|---|
diff --git a/README.md b/README.md
index 9fba1026..755e38c9 100644
--- a/README.md
+++ b/README.md
@@ -883,7 +883,7 @@ else:
escalate_to_human_agent(dept, reason=f"Low confidence ({conf:.2f})")
```
-A threshold is a policy you choose from measured accuracy at that coverage on your data, not a property of the model. Both checkpoints are over-confident as shipped and `laya-multilingual` has no fitted temperatures at all, so fit them before relying on these numbers — see [Calibration](#calibration) above, and the [fine-tuning notebook](notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb) for the fitting loop itself. Then pick the point where the errors you accept are ones you can live with. Confidence orders decisions; it does not establish that a decision is correct.
+A threshold is a policy you choose from measured accuracy at that coverage on your data, not a property of the model. Both checkpoints are over-confident as shipped and `laya-multilingual` has no fitted temperatures at all, so fit them before relying on these numbers — see [Calibration](#calibration) below, and the [fine-tuning notebook](notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb) for the fitting loop itself. Then pick the point where the errors you accept are ones you can live with. Confidence orders decisions; it does not establish that a decision is correct.
A threshold also depends on the autocast dtype. On CUDA at compute capability 8 or above the runtime uses the checkpoint's `amp_dtype`, which is bf16 for all three shipped checkpoints. On the fixed set from `benchmarks/parity_fast.py` (60 states, 288 questions per checkpoint, RTX 2000 Ada) bf16 moves a probability by up to 0.073 against the fp32 forward and flips 3 of 864 argmaxes across the three checkpoints; fp16 stays within 0.019 and flips none, at the same latency. `LAYA_CUDA_AMP=fp16` selects fp16 and `LAYA_CUDA_AMP=bf16` selects bf16 (`LAYA_CPU_AMP=bf16` is the CPU counterpart). MPS autocasts in fp16 too, but the overhead dominates on a single small row, so there it engages only once a call reaches `mps_amp_min_rows` rows -- 5 by default, `LAYA_MPS_AMP_MIN_ROWS` to move it; a value that does not parse falls back to 5 and anything below 1 is clamped to 1. On MPS, `agent.dtype` is the autocast target, so it says float16 even when every call stays below the gate and runs in fp32; `agent.dtype_for(rows)` returns the precision a call with that many rows runs in. Fit and measure a threshold in the dtype you serve with.
@@ -1070,7 +1070,7 @@ routing batch, **2.2x** across 24 mixed-language tickets through a `Router`, **1
preset, with every route label and guardrail flag unchanged. On CPU the same workloads are
2.2-2.4x over the one-by-one loop and 1.1-1.5x over the thread pool.
-See [**`docs/langchain.md`**](docs/langchain.md) for full guide, support ticket triage nodes, and remote HTTP server configuration.
+See [**`docs/langchain.md`**](docs/langchain.md) for the full guide, support ticket triage nodes, and remote HTTP server configuration.
---
@@ -1387,7 +1387,7 @@ failure; it does not establish calibrated confidence.
evidence that every negated state fails. Validate the exact checkpoint and wording you serve;
using semantic keys alone does not avoid this failure.
* **High-cardinality choice questions and token budgets:** Sequences split into an option prompt budget (`head_max_len`) and the remaining document/state budget. **`head_max_len` is a cap, not the head length.** The renderer fills the option prompt budget only as far as the question and its option descriptions need, and `build_sequence` then sizes the state from the head it *actually built* (`room = max_len - head_len - 1`). The real room therefore depends on the question, not on the cap:
- * `laya` (English) defaults to 512 context (`head_max_len = 192`). The shipped department question below renders a **48-token** head, leaving **463 tokens for state**, not 320.
+ * `laya` (English) defaults to 512 context (`head_max_len = 192`). The shipped department question above renders a **48-token** head, leaving **463 tokens for state**, not 320.
* `laya-multilingual` and `laya-typed-decisions` default to 1,024 context (`head_max_len = 256`). The shipped question renders a **45-token** head, leaving **978 tokens for state**, not 768 (mmBERT-base encoder supports up to 8,192 with RoPE).
`max_len - head_max_len` is **not a safe figure in either direction**, so size a state to `max_len - head_len - 1` for the question you are actually asking:
* For a question that does not fill the cap it **understates** the room, as above — conservative, but it discards state the model would have read.
diff --git a/research/README.md b/research/README.md
index 1aaf3373..899753b0 100644
--- a/research/README.md
+++ b/research/README.md
@@ -145,7 +145,7 @@ not sample", not as a per-cell ranking.*
**Routing takes Laya from 23 to 48 of 51 languages.** On MASSIVE intent (20 options, random =
0.050) the English checkpoint macro-averages 0.227 and clears 3x random on 23 of 51 languages;
the multilingual checkpoint reaches 0.401 and clears it on 48. The multilingual figures are the
-re-run, not the committed sweep — see `results/cpu_51_language_sweep_refreshed.json` below.
+re-run, not the committed sweep — see `results/cpu_51_language_sweep_refreshed.json` above.
**The English checkpoint's confidence gives no warning when it cannot read the input.** Khmer:
0.000 accuracy at 0.952 mean confidence — that is the *raw* temperature; as served, after the