fix(ENG-3282): swap the Tier-2 model and recalibrate its threshold
What
Ships the new Tier-2 model (candidate 3, jbv2-mh-grid-agpjb2pinstr-s2) in 0.9.3, together with the Tier-3 fixes already on main (#112). It replaces v5.
| v5 (shipped) | Candidate 3 | |
|---|---|---|
| ONNX | minilm-multihead-v5 | md5 3f23821d74d23b39a832f6fa30615e47 (Modal classifier-eval-data, release dir) |
| Temperature | 2.41 | 2.41 (unchanged) |
Default highRiskThreshold (single-head) | 0.64 | 0.52 |
| Multihead presets (main/aux) | old | High 0.77/0.325, Medium 0.88/0.325, Low 0.94/0.30 |
-
Same folder. The model stays in
src/classifiers/models/minilm-multihead-v5/. agent-plugins, ai-benchmarks and adaptive-defender reference that path, so a rename would break them on their next bump. Thevariantfield inclassifier_config.jsonand the README name the real model. -
Only the weights and thresholds change. The tokenizer and encoder
config.jsonare byte-identical to v5. -
0.52 is the measured single-head operating point. It was chosen to match the shipped false-positive rate. Compared with v5 at 0.64:
- org1 FP 1.11 vs 1.66, TOUCAN FP 4.96 vs 5.06, SFE FP 1.38 vs 4.15
- agentic recall 44.5 vs 19.1
- holdout recall 63.2 vs 64.0 (paired CI -2.1..+0.5, so within noise)
Keeping 0.64 with this model costs 4.1 points of holdout recall, and that CI excludes 0.
-
The presets are model-specific. They ship in
classifier_config.jsonundermultihead_presets. The old Low preset (0.90/0.20) drops recall to about 6% on this model.
Release notes (behavior changes)
highRiskThresholddefaults to 0.52, not 0.64. Callers that pass their own threshold aren't affected.- The
mediumband is now [0.5, 0.52), so Tier 2 rarely reportsmedium. This also affectstier3.onError: "block"in cascade, which fails closed only on medium-or-higher payloads. - Trade-offs:
- The multihead presets give up about 4โ6 points of holdout-attack recall in exchange for one-third the real-traffic FP and twice the agentic recall.
- At 0.52, jailbreak and tool-abuse recall drop: jailbreak 72.7% vs 81.8%, tool-abuse 70.0% vs 82.5%. The loss is in the main head.
Rollout (agreed with e1-integration)
- This PR, then release 0.9.3 (#114). Every platform consumer pins defender exactly: UCA's catalog pins 0.9.2, connect-handler pins 0.8.2, and connect's lockfile pins connect-sdk's
"*". Publishing alone changes nothing on the platform. - ENG-3393: connect-sdk updates
TIER2_PRESETSand the hybrid line to default 0.52 (min 0.51, max 0.95) plus specs, then releases. - UCA bumps defender 0.9.3 and connect-sdk together; connect-handler follows. Don't bump defender alone before step 2 ships. The old presets and the old 0.55 hybrid floor are wrong for this model.
Checks
- Release gates cleared 2026-10-14: aux/preset re-tune, bit-identical score parity across package versions, seed pick.
pnpm test: 710 pass. Five tests that pinned 0.64 now pin 0.52, and two medium-band tests now use 0.51.- Typechecks, the build and the examples smoke run pass. Lint shows only the pre-existing warning.
- End-to-end on the built package: three attacks score 0.96โ0.98 and block; three benign payloads score 0.03โ0.15 and are allowed.
- The model is stored in Git LFS (pointer committed, object uploaded).
๐ค Generated with Claude Code
Summary by cubic
Swaps the bundled Tier-2 model (candidate 3, jbv2-mh-grid-agpjb2pinstr-s2) into the existing minilm-multihead-v5 folder and recalibrates the default highRiskThreshold from 0.64 to 0.52. Only the weights and thresholds change; the tokenizer and encoder config are byte-identical, and the folder name is kept so consumers referencing that path keep working.
Behavior changes
- The default
highRiskThresholdis now 0.52, making the medium band [0.5, 0.52) โ Tier 2 rarely reportsmedium. - New model-specific multihead presets ship in
classifier_config.json(High 0.77/0.325, Medium 0.88/0.325, Low 0.94/0.30); the old presets are wrong for this model. The README now documents the blocking rule with the threshold names (a chunk blocks whenmain >= mainThresholdandaux < auxThreshold). - At 0.52 the model matches the shipped false-positive rate while nearly doubling agentic recall; holdout recall stays within noise of v5.
Rollout
- Platform consumers pin defender per-version, so publishing this PR alone changes nothing.
- Do not bump defender by itself: the connect-sdk update (ENG-3393) carries the new presets and the 0.52 default, and the old presets plus the 0.55 hybrid floor are incorrect for this model.