# results_sam

Sharpness-Aware Minimization (SAM; Foret et al.) fine-tune of `stem_ms96` from SWA checkpoints. Each step: ascend `w ← w + ρ·g/‖g‖`, compute grad at the perturbed weights, restore `w`, AdamW-step with that sharpness-aware gradient. Architecture unchanged (abs pos, dilated stem, ms feats, w96). Init `models/stem_ms96_swa/{held-*,all5}.pt` with causal `-inf` mask restored. EMA 0.995 eval. Smoke ρ∈{0.02,0.05} (40 steps, held-AVGC) chose **ρ=0.02** (both frame-acc 0.914; lower loss). Full run 1000 steps, batch 512. HMM preset p_stay 0.994 scale 0.8. Also scored causal tau-30 high-pass of SAM evidence (`hp30`; corpus emissions). Never used AASD/Carta labels. Distinct from SWA/Polyak averaging.

Code: `stem_ms96_sam.py`. Checkpoints: `models/stem_ms96_sam/`. JSON: `results/research/stem_ms96_sam.json`. Log: `experiments/stem_ms96_sam.log` / `stem_ms96_sam_console.log`.

## LODO (preset)

| Held-out | SAM H | SAM Acc % | stem_ms96 H/Acc | SWA H/Acc | IRM↔SWA fuse H/Acc | hp30 H | hp30 Acc % |
|---|---:|---:|---|---|---|---:|---:|
| AVGC | 0.8088 | 75.16 | 0.7945/74.06 | 0.8015/74.91 | 0.8100/75.14 | 0.7916 | 71.21 |
| DTU | 0.9010 | 89.38 | 0.9061/89.85 | 0.9003/89.52 | — | 0.8204 | 69.90 |
| KUL | 0.8744 | 82.16 | 0.8755/82.33 | 0.8769/82.35 | — | 0.8449 | 74.33 |
| UHD | 0.8538 | 80.04 | 0.8407/79.47 | 0.8553/80.09 | 0.8580/— | 0.8071 | 72.96 |
| USTC | 0.9227 | 86.47 | 0.9219/86.36 | 0.9161/86.19 | — | 0.8245 | 70.17 |
| **mean** | **0.8721** | **82.64** | **0.8677/82.42** | **0.8700/82.61** | **0.8725/82.58** | | |

## External (preset)

| Set | SAM H | SAM Acc % | linear_hp30 | stem_ms96 | SWA | fuse | SAM_hp30 H/Acc |
|---|---:|---:|---|---|---|---|---|
| AASD | 0.6197 | 51.03 | 0.6422/53.12 | 0.6158/51.54 | 0.6202/51.08 | 0.6179/50.94 | 0.5922/50.96 |
| Carta2026 | 0.5449 | 48.40 | 0.6520/60.54 | 0.5695/51.03 | 0.5507/48.68 | 0.5461/48.38 | 0.5701/49.68 |

## Targets

| Target | Result |
|---|---|
| AVGC H≥0.85 and Acc≥78 | miss (0.8088/75.16); ≈fuse AVGC Acc, −0.0012 H vs fuse; still open |
| UHD H≥0.85 | met (0.8538); already met under SWA/fuse; no new flip |
| AASD Acc>60 with H>0.63 | miss (0.6197/51.03); Acc flat vs SWA, below linear_hp30 |
| Carta vs linear_hp30 | moved away (0.5449/48.40) |

## Notes

- Smoke ρ=0.02 vs 0.05: identical frame-acc; ρ=0.02 slightly lower train loss → selected. Claim ρ≈0.05 also viable; effect size small.
- Mean LODO H 0.8721 / Acc 82.64 ≈ fuse (0.8725/82.58) and slightly above SWA (0.8700/82.61). AVGC does not clear 0.85/78.
- No open target flipped to met. AASD Acc unchanged (~51).
