fix(ENG-3282): swap the Tier-2 model and recalibrate its threshold
Merged
HI
1mo ago+141+141+012345678901234567890123456789-26-26-01234567890123456789
The same Tier-2 swap as StackOneHQ/defender#115, which shipped in @stackone/defender 0.9.3. The model files are byte-identical to TS, down to the same LFS object (3d4a1ba798).
Changes
- Model: candidate 3 (
jbv2-mh-grid-agpjb2pinstr-s2, ONNX md53f23821d74d23b39a832f6fa30615e47) replaces v5 in theminilm-multihead-v5folder. The tokenizer and encoder config are unchanged. - Default single-head
high_risk_threshold: 0.64 → 0.52 (T=2.41). 0.52 matches the shipped false-positive rate. Compared with v5 at 0.64:- org1 FP 1.11 vs 1.66, SFE FP 1.38 vs 4.15
- agentic recall 44.5 vs 19.1
- holdout recall 63.2 vs 64.0 (within noise)
- Multi-head presets ship in
classifier_config.json: High 0.77/0.325, Medium 0.88/0.325, Low 0.94/0.30. Multi-head stays opt-in throughtier2_config["multihead"]. - Fixtures are re-pinned to
defender-v0.9.3. The 4 new hardening cases pass: 138 cases, and the known-failures list stays empty. - README: the variant, calibration and presets text now matches StackOneHQ/defender#116.
Release notes (behavior changes)
high_risk_thresholddefaults to 0.52. Callers that pass their own value aren't affected.- The
mediumband is now [0.5, 0.52), so Tier 2 rarely reportsmedium. This also affectson_error="block"in cascade. - At 0.52, jailbreak recall is 72.7% vs 81.8% and tool-abuse recall is 70.0% vs 82.5% (the loss is in the main head). The multi-head presets give up 4–6 points of holdout recall in exchange for one-third the real-traffic FP.
Checks
uv run pytest: 557 pass. Three tests that pinned 0.64 now pin 0.52, and three medium-band tests now use 0.51.- The built wheel carries the real 22,984,191-byte model with
variantand0.52, and the LFS build hook passes. - End to end: three attacks score 0.96–0.98 and block; three benign payloads score 0.03–0.29 and are allowed.
Release
fix: → 0.9.3, matching TS. Merge after the 0.9.2 release (#43) is out.
🤖 Generated with Claude Code
Summary by cubic
Swaps the Tier-2 model in the minilm-multihead-v5 folder to candidate 3 (jbv2-mh-grid-agpjb2pinstr-s2), byte-identical to the model shipped in @stackone/defender 0.9.3, and recalibrates the default single-head high_risk_threshold from 0.64 to 0.52 (temperature stays 2.41).
Behavior changes
- Callers who pass their own
high_risk_thresholdare unaffected. - The
mediumrisk band narrows to [0.5, 0.52), so Tier 2 rarely reportsmedium; this also affects cascadeon_error="block". - At 0.52 the model cuts real-traffic false positives (org1 1.11 vs 1.66, SFE 1.38 vs 4.15) and raises agentic recall (44.5 vs 19.1), at the cost of jailbreak recall (72.7% vs 81.8%) and tool-abuse recall (70.0% vs 82.5%).
- Multi-head mode stays opt-in via
tier2_config["multihead"]; presets High 0.77/0.325, Medium 0.88/0.325, Low 0.94/0.30 are recorded inclassifier_config.json. - README benchmarks switch to an overlap-free method: 0.865 average F1 through the package pipeline at 0.52 (previous model 0.843); the old 0.908 used raw scores and isn't comparable.
Tests
- Conformance fixtures re-pin to
defender-v0.9.3; four new redaction hardening cases (URL passwords with@, quoted Bearer values, dict reprs) and one tier-3 refusal-blocks case are added. - Unit tests now assert the 0.52 boundary (0.52 rates high, 0.51 medium) and that Tier 2 only rates high while blocking still requires
block_high_risk=True.