caelum0x a59767507f fix: otsone-base ONNX export broken Split opset downgrade, run first real training
ModernBERT-base's GeGLU-gated MLP lowers to an ONNX Split node using the
opset-18-only `num_outputs` attribute; torch's dynamo exporter's opset-17
downgrade pass can't rewrite it, so onnxruntime rejected the exported graph
as invalid during temperature calibration. otsone-mini (plain-GELU MiniLM)
never hits this Split pattern, so the bug was invisible until otsone-base
was actually trained for the first time. Fix: export at opset 18 directly.

Ran the fixed pipeline end to end (otsone distill --backbone otsone-base):
a full 14-epoch run stalled twice under ~500-900 load average from other
concurrent agents on this shared Mac (one killed after 23min/0 epochs, one
suspended by the OS post-training at 35min before export), so this records
a labeled reduced 3-epoch run that completed clean in <6min once load eased.
Real held-out gold-set result: 12/14 cases, 14/18 checks, accuracy=0.7778,
ece=0.1596 - slightly behind otsone-mini-run1-nogold's 14-epoch 0.8333/0.1255,
honestly attributable to the 4.7x-shorter training budget on a 6.6x-larger
backbone, not the architecture. Full writeup + model_card/rl_agent_config
(no weights) in otsone/docs/results/otsone-base-reduced-3ep/.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-11 04:09:33 +03:00

74 lines
4.7 KiB
Markdown

# otsone-base (ModernBERT-base) — reduced 3-epoch run, 2026-11-11
**Labeled reduced run, not the full default recipe.** This is the first otsone-base
checkpoint ever trained to completion (prior sessions were disk-blocked before any
epoch ran). It used `--epochs 3` instead of the default 14 because the shared Mac this
ran on had a sustained load average of 500-900+ from ~10 other concurrent agent
workflows (rustc/cargo building Scribase, a Gradle daemon, Jest workers, VS Code) —
a full 14-epoch run was started twice and both times stalled (one hung with zero
epochs completed in 23 minutes before being killed; a second attempt completed
training but was suspended by the OS, state `T`/stopped, at the 35-minute mark and
never reached export). The reduced run below completed end-to-end (train + ONNX
export + calibrate + eval) in under 6 minutes once load briefly dropped, confirming
the pipeline itself is not the bottleneck — wall-clock contention on this shared
machine is. No disk-safety issue occurred in this run: the Mac had 27-40GB free
throughout (the 8GB checkpoint/cache cap set for this task was never approached;
peak usage was the single ~1.17GB `otsone-base-reduced-3ep/` checkpoint dir).
## Real bug found and fixed in this run
Training (3 epochs, loss 0.9591 → 0.8334 → 0.4061) and ONNX export succeeded, but the
first attempt crashed one step later during post-hoc temperature calibration:
```
onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 :
INVALID_GRAPH : ... Node, ("node_Split_52", Split, ...) ... Error Unrecognized
attribute: num_outputs for operator Split
```
Root cause: `laya_mlx/distill.py`'s `torch.onnx.export(..., opset_version=17)` asks
torch's dynamo exporter for opset 17. ModernBERT's GeGLU-gated MLP lowers to an ONNX
`Split` node that uses the opset-18-only `num_outputs` attribute; torch's own opset-17
downgrade pass cannot rewrite that attribute, producing an onnx file onnxruntime
rejects as invalid. `otsone-mini` (plain-GELU MiniLM, no gating) never emits this
`Split` pattern, which is why the bug was never hit by any prior mini run and only
surfaced on the very first real otsone-base run. Fix: export at `opset_version=18`
directly (the version torch already said it would keep) instead of requesting the
lower opset and relying on its buggy downgrade path. See the comment and diff in
`laya_mlx/distill.py`. Re-running after the fix produced a clean export with no
warnings about opset downgrade.
## Real held-out metrics (`gold.json`, 14 cases, never folded into training — `--no-gold`)
| model | epochs | backbone | cases | checks | accuracy | ece |
|---|---|---|---|---|---|---|
| `otsone-mini-run1-nogold` (2026-11-09, existing baseline) | 14 | MiniLM-L6 (22.7M) | 12/14 | 15/18 | 0.8333 | 0.1255 |
| `otsone-base-reduced-3ep` (this run, 2026-11-11) | **3 (reduced)** | ModernBERT-base (149M) | 12/14 | 14/18 | **0.7778** | **0.1596** |
Per-type breakdown (this run): `choice` accuracy 0.625/ece 0.2577 (n=8, worst slice,
same failure mode as every prior checkpoint — `shoes-multi` misroutes billing/returns);
`score` accuracy 1.0/ece 0.0072 (n=4); `noul` accuracy 1.0/ece 0.0734 (n=6). New failure
vs. the mini baseline: `refund-requested` (a `noul`+`choice` case) now fails here where
mini passed it — plausibly undertraining (3 vs 14 epochs) on a 149M-param backbone that
needs more steps than a 22.7M-param one to reach the same per-case decision boundary,
not evidence the architecture itself is worse.
**Honest read: otsone-base at 3 epochs is not better than otsone-mini at 14 epochs** —
slightly worse accuracy and ECE on the same held-out set. This is expected and not a
fair head-to-head: it is a ~4.7x-shorter training budget on a 6.6x-larger backbone,
forced by real-time contention on a shared machine, not a result of the architecture
or corpus. The real, apples-to-apples 14-epoch otsone-base number remains unmeasured —
two full-recipe attempts this session died to the same shared-machine contention
(one 0-epoch stall, one post-training-but-pre-export OS suspend), not to the disk cap,
corpus, or (after the fix above) the code.
## What's committed vs. not
Committed here: this README, `model_card.json`, `rl_agent_config.json`,
`encoder-config.json` (copied out of the gitignored `models/` tree) — config and real
metrics only. **Not committed:** `model.onnx` / `model.onnx.data` (571MB of real
weights) or the tokenizer vocab dump — both stay local, `models/` is gitignored
repo-wide, and this task's instructions were explicit: commit code/config/metrics, not
weights. The local checkpoint directory was deleted after this file was written to
keep this disk-constrained run's intermediates from persisting past verification.