pieroot's picture
4-choice masked graph: priority + up to 4-way scheduling
61693f7 verified
|
Raw History Blame Contribute Delete
3.84 kB
---
license: apache-2.0
tags:
- coreml
- laya
- decision-model
---
# laya-priority-coreml (English, priority + scheduling, up to 4 choices)
Core ML conversion of `convaiinnovations/laya` (English checkpoint, revision
`55cf4c4ebb4ebe31b2550e8bdf3bd21b99753851`), generalized from a fixed
binary `choice` question to a fixed **2–4 option** `choice` graph. Used for
two purposes in the consuming app: deciding whether a to-do item should be
acted on now versus deferred, and picking a free processing day/time slot
among up to four candidates. This is not a general-purpose export of Laya —
only the masked-choice decision graph is included, and only `logits`
(pre-temperature) is returned.
Weights © Convai Innovations, Apache-2.0. Conversion graph and Core ML export
by this repository's owner.
## Known limitation — do not treat as validated for general use
Zero-shot measurement on the original 48-item balanced English/Korean-translated
priority fixture (this checkpoint, binary priority question) scored 17/24
(70.8%) on English and 15/24 (62.5%) on Korean text machine-translated to
English, both below an 80%-accuracy / 70%-recall gate. This artifact is
shipped anyway at the consuming application's explicit request, with
rule-based fallback preserved for degraded cases. Do not present its output
as high-confidence, and treat the added multi-option scheduling question the
same way — it has not been separately accuracy-gated, only numerically
parity-checked against the source model below.
## Static IO contract
- Inputs (`int32`): `input_ids [1,512]`, `attention_mask [1,512]`,
`marker_pos [1,4]`, `marker_mask [1,4]`, `qtype [1]`
- Output (`float32`): `logits [1,4]` — raw, pre-temperature logits from the
source `DecisionModel.scorer` head. Questions with 2 or 3 active options
set `marker_pos=0, marker_mask=0` on the unused trailing slot(s); the model
forces those logits to `-10000`, so only active options can win argmax.
- Special token ids: `pad=50283 cls=50281 sep=50282 mask=50284`
- Sequence format follows upstream `laya.common.build_sequence` with
`max_len=512, head_max_len=192`; instruction/option text is supplied by the
caller (fixed priority question, or a dynamic day/slot question), not fixed
in the graph.
## Parity evidence (from the exporter that produced this package)
- Source PyTorch vs traced PyTorch: max abs error `0.0` (exact) across the
fixture cases, including a synthetic 4-option scheduling case.
- Widening the graph from 2 to 4 marker slots does not change the active-slot
source logits: re-running the original 2-option English/Korean fixtures
through the 4-slot graph (inactive slots masked out) reproduced the exact
same active logits (`max_abs_error 0.0`).
- Native Core ML (`CPU_AND_NE` requested) vs source, 49 cases (24 English +
24 real Korean→English machine translations + 1 synthetic 4-option
scheduling case): argmax agreement 49/49 in the recorded run; a repeated
run showed 48/49 because one English case (`en-18`) has a near-zero source
margin and is numerically borderline — this is disclosed, not hidden. Max
abs logit error over active options ≈0.23–0.36 depending on run; max abs
error over masked/inactive options is `0.0` in every run (they are pinned
to `-10000` and never move).
- An FP32 variant reproduces the source almost exactly but the compiler
prefers CPU for all ops in that variant, so it is not an ANE artifact; it
is not published here.
## Files
- `laya_english.mlpackage/` — compiled-at-load Core ML package (FP16,
`logits`-only output, 4 marker slots)
- `tokenizer.json`, `tokenizer_config.json` — copied unmodified from the
source checkpoint's `tokenizer/`
- `laya_manifest.json` — file list with SHA-256 and sizes, IO contract,
special token ids, and masking semantics