# System 1

> On-device Ettin-17m ONNX drafter that compiles rehearsal messages into engine-checked Flow.

Canonical page: [https://docs.score.miso.fm/ai/system-1/](https://docs.score.miso.fm/ai/system-1/)

System 1 is Miso Score's fast, on-device natural-language drafter. Given a musician's message and the current Flow page context, it classifies the request, tags musical slots, and mechanically assembles Flow lines that the engine verifies before anything is proposed.

## Pipeline

System 1 separates neural understanding from musical arithmetic across three stages:

1. **Classification and slot tagging (ONNX):** The encoder reads only the speaker role, view, book name, and message text. Joint classification heads predict:
   - **Kind:** `edit`, `ask`, `no edit`, or `out of scope`.
   - **Frame:** One of **64** Flow 1 operation templates (such as `add`, `del`, `pitch`, `bar`, `bar_lyr`, `tempo`, `key`, `jump_*`, or `layout`).
   - **Slots:** O/B/I token spans for `bar`, `bar_end`, `letter`, `part`, `src`, `from`, `to`, `value`, and `beat`.
2. **Mechanical assembly:** A deterministic assembler (ported to Zig inside the engine) resolves slots against the visible Flow 1 page: matching part IDs, note indices (`@n`), beat offsets, octaves, and rehearsal-letter offsets.
3. **Engine judgment:** The engine applies the candidate Flow and prints the resulting document:
   - If the printed score is unchanged, the edit converts to `# no edit` (already so).
   - If the engine refuses the edit, it converts to `# ask`.
   - Frames the assembler cannot safely fill (such as complex compounds or unsupported rewrites) hand off to System 2 or a person — a handoff never drafts an edit.

The assembler never guesses. It automatically emits `# ask` when two notes of the named pitch appear on the page, two parts match the wording, a bar number disagrees with a rehearsal-letter offset, a bar does not exist, a named part is not on the page, or no location is given.

## Model Architecture and Latency

System 1 runs **Ettin-encoder-17m** (`jhu-clsp/ettin-encoder-17m`, ModernBERT architecture, MIT license) exported to ONNX Opset 17 for `onnxruntime-web`.

| Metric | Value |
| --- | --- |
| Parameters | 16.8 M |
| Shipped ONNX size | 27.6 MB (int8 embedding table, fp32 transformer) |
| PyTorch vs. int8 agreement | 100% kind, 100% frame, 99.85% slot tokens |
| Native ONNX CPU latency (1 thread, p50) | 3.1 ms (tokenizing included) |
| `onnxruntime-web` WASM latency (1 thread, p50 / p95) | 9.9 ms / 17.0 ms |

Dynamic int8 quantization on Ettin's transformer MatMuls degrades slot argmax due to ModernBERT activation outliers, so only the embedding table (the majority of bytes) is quantized to int8.

## Confidence Thresholds and Draft Gate

Every candidate edit computes a single conservative confidence score:

```text
confidence = min(p(kind), p(frame), min(p(slot tokens)))
```

When confidence falls below the gate threshold (default **`0.95`** in `engine/src/s1/gate.zig`), an edit is downgraded to a one-reading confirmation question instead of auto-drafting. On-device gating also filters out unnamed targets, bar-moving edits, and compound clauses before surfacing a draft.

## Benchmarks (Flow 1 v5n)

All metrics are engine-judged on the held-out v5 test set (3,433 items across unseen shows) and 300 negative conversational messages (call times, remarks, questions, musical judgment):

| Metric | v5n int8 (test) | Assembler Ceiling (gold slots) |
| --- | --- | --- |
| Full-Flow exact match | **84.6%** | 90.8% |
| Edits right (of gold edits) | 83.0% | 88.4% |
| Kind accuracy (after engine checks) | 90.2% | 95.7% |
| Model heads (kind / op / frame) | 96.3% / 97.5% / 96.0% | — |
| Ask recall / precision | 95.0% / 69.0% | 98.7% / 82.0% |
| Handoff rate | 1.0% | 2.4% |
| Applied / wrong edits at 0.95 threshold | 994 / 15 (0.44% of all items) | — |
| Negatives test (full-Flow / kind) | **94.0% / 94.0%** (0 wrong edits ≥ 0.5 confidence) | 100% |

Adding 900 negative conversational examples during training prevents chat messages (such as `"let's run 88 to 92 again before we break"`) from drafting spurious edits in active rehearsal rooms.
