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.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
docs(finetune): add Apple Silicon MPS fine-tuning script guide
zhangangcae76a4d9de1
diff --git a/README.md b/README.mdindex 328a6194..7c597762 100644--- a/README.md+++ b/README.md@@ -88,7 +88,7 @@ From the command line, `laya "My payment failed twice" --preset triage` answersThe shipped checkpoints work zero-shot, but fine-tuning on decisions from your own domain is where accuracy jumps. On the typed-decisions benchmark (2,000 decisions across four workflows), the fine-tuned `laya-typed-decisions` checkpoint scores **0.766** accuracy, against **0.362** for the base English checkpoint on the same decisions.-**[Fine-tuning notebook](https://github.com/NandhaKishorM/laya/blob/main/notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb)**: runs the whole loop on Kaggle's free 2x T4 GPUs (build the dataset, train, fit calibration temperatures, evaluate, and push the result to the Hub). Details in [Fine-Tuning](#fine-tuning).+**[Fine-tuning notebook](https://github.com/NandhaKishorM/laya/blob/main/notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb)** (Kaggle 2xT4) and **[Apple Silicon script](notebooks/laya_finetune_typed_decisions_mps.py)** (MPS / CPU): run the whole loop (build dataset, train with RLCD, calibrate temperatures, evaluate, export). Details in [Fine-Tuning](#fine-tuning).## Documentation@@ -1373,13 +1373,20 @@ Shortlisting the same option set on every request re-embeds option texts that do## Fine-Tuning-Fine-tune Laya on your own domain data. The notebook runs on Kaggle's free 2xT4 GPUs and does-the whole loop: build the dataset, train with RLCD (proper-scoring-rule rewards, GRPO-style-policy gradient), fit calibration temperatures, evaluate, and push the result to the Hub.+Fine-tune Laya on your own domain data. Two training options are provided:-* **[`notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb`](notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb)**+* **[`notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb`](notebooks/laya_finetune_typed_decisions_2xT4_kaggle.ipynb)**: runs on Kaggle's free 2xT4 GPUs (DDP) and does the whole loop: build the dataset, train with RLCD (proper-scoring-rule rewards, GRPO-style policy gradient), fit calibration temperatures, evaluate, and push the result to the Hub.+* **[`notebooks/laya_finetune_typed_decisions_mps.py`](notebooks/laya_finetune_typed_decisions_mps.py)**: standalone training script for Apple Silicon MacBooks (PyTorch MPS with CPU fallback). Replaces DDP with single-process training and configurable micro-batches and gradient accumulation.-The notebook enables gradient checkpointing on both the encoder and the decision head.+For Apple Silicon (e.g. 16 GB MacBook), fine-tuning runs locally with unified memory:++```bash+python notebooks/laya_finetune_typed_decisions_mps.py \+ --micro-batch 1 \+ --grad-accum 32+```++The notebook and script enable gradient checkpointing on both the encoder and the decision head.For custom training loops, `model.head_checkpointing = True` enables activationcheckpointing for the decision-head layers; enable the encoder's gradient checkpointingseparately. During gradient-enabled training, this reduces stored intermediate activations