Commit Graph
3 Commits
Author SHA1 Message Date
Joseph MaglyandClaude Opus 5.5 24b2342229 feat(concepts): non-inferiority margin for the collateral refusal test (#329)
Replace significance-only FAIL with a configurable non-inferiority
decision (default 3 points): PASS, FAIL, INCONCLUSIVE, UNDERPOWERED.
Plumb the margin through recipes, CLI, reports, cards, metadata and the
Q4 export gate, and add 'concepts rescore' for saved batteries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:07:10 -04:00
Joseph MaglyandClaude Opus 5.5 58459a9ece fix(eval): treat word and phrase loops as invalid output in refusal scoring (#309)
`_is_degenerate` only caught 2-4 character repeats, so a completion that
repeats one word (" illegally" * 48) or a phrase scored as a valid
non-refusal. Steering sweeps that degenerated therefore read as perfect
compliance.

- `_is_degenerate` now also detects consecutive word and phrase loops
  that cover at least half the text (a shared `_is_word_loop` rule, also
  used by the abliterate coherence checks) and 5-32 character loops that
  cover nearly all of it, which catches unspaced scripts. It uses no
  vocabulary-ratio rule, so lists of distinct refusals sharing
  boilerplate, Markdown table rules and literal lists stay valid.
- New `_is_invalid_output` marks empty, reasoning-only (including
  generation that stops inside an unclosed reasoning tag), content-free and
  degenerate completions; short answers with content ("42", "No") stay
  valid. The refusal scorer label carries a detector version, so stale
  pristine caches are rejected. `<think>` blocks are now stripped like the
  other reasoning tags, including inside an extracted assistant body.
- EvaluationBattery records invalid outputs, computes refusal statistics
  only over pairs valid on both sides, and fails collateral when invalid
  outputs increase significantly (exact one-sided McNemar), including when
  every intervened output degenerates.
- The repair ladder rejects a step that raises the intervened invalid rate.
- The Concept Lab dose ladder used the anchor-only coherence check, which
  marked every operator preview invalid; it now uses `_is_invalid_output`.

The generic refusal_rate denominator is unchanged here and tracked in #312.

Fixes #309

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 15:11:18 -04:00
Joseph MaglyandClaude Opus 5.5 9cd3810d8d feat(concepts): add default-on evaluation battery after interventions
Weight orthogonalization can drive a direction's projection to about 0
while behaviour is unchanged (arXiv:2609.16247, App. D), and valence state
can persist through the KV cache (arXiv:2609.35591). Every non-refusal
concept intervention is now followed by an evaluation battery:

- mechanistic: per-layer residual projection before and after;
- collateral (on by default): refusal rate on 320 paired, seeded built-in
  harmful prompts versus the pristine model, using a one-sided exact
  McNemar test on discordant pairs. The report includes Wilson CIs for both
  rates, a paired bootstrap CI for the drop, and loss/gain transitions.
  Below 284 prompts a non-significant result is UNDERPOWERED, and a
  significant drop is FAIL at any size. Also first-token KL, coherence
  anchors and neighbour-concept projections;
- optional re-steer and KV-cache persistence probes, and a pack-supplied
  behavioural battery hook.

evaluation.json separates mechanistic, behavioural and collateral outcomes,
and lists untested channels (the KV channel unless probed). Skipping the
battery is recorded with a reason. Pristine refusal flags are cached by model
id and revision, prompt-set hash, decoding config and scorer identity (mode
plus pattern hash); runs with no pinned revision are not cached. Legacy
refusal runs are unchanged.

Closes #230

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 22:02:47 -04:00