Resolve ExtractionRecipe conflicts with #329/#330: keep
collateral_margin and extraction_layer, and keep the entry-point
special_token_policy pop before the extraction_layer pop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lift the dense-only restriction for supported OLMoE, Qwen2-MoE and
Qwen3-MoE layouts: routing-aware extraction readout, per-expert
down-projection edits through the fused/ModuleList MoE paths, optional
router orthogonalization, expert gate checks, and routing-drift and
expert-load reports. Unsupported MoE layouts still fail closed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Allow packs and the CLI to pin per-model extraction layers, recorded as
pinned or selected, and add grouped layer CV. The pain pack pins the
paper's layers for Qwen2.5-7B-Instruct, Gemma-2-2B-it and Gemma-2-9B-it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Non-refusal concepts on MoE models were rejected only after the full model
had loaded, so an MoE run allocated every weight before failing.
`load_model` now accepts a config-only `config_validator` that runs before
conversion or weight loading. The pipeline passes its concept architecture
check for non-refusal concepts, and the post-load check remains as a
backstop. Architecture detection also recognises MoE model classes named
only in `architectures`. The error names #310, which tracks per-expert
concept targeting.
Refs #310
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Non-refusal concepts now extract directions through a declarative recipe,
implemented as pure tensor functions in obliteratus/concepts/extraction.py
and wired into the pipeline:
- pooled control sets with no pairing or truncation (mean of means);
- control principal-component denoising by variance fraction;
- final-token readout with an optional suffix, or masked mean pooling,
correct under left and right padding;
- seeded k-fold layer selection on projection AUC (rank-based), using cached
activations with no extra forward passes;
- an intervention-layer rule (same, norm_ratio, explicit), separate from
the extraction layer.
ConceptDirection save/load carries the recipe, layer choice, CV scores and
seed in safetensors plus JSON, with no pickle. Explicit n_directions or
direction_method values that conflict with the recipe are rejected. Preset
defaults superseded by the recipe are logged, and invalid recipes fail
before probing.
The refusal path is unchanged: the golden test passes for every CPU preset.
Refusal metadata keeps its historical pooling value, because refusal does
not pool.
Closes#227
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Introduce obliteratus.concepts: ConceptTarget, ExtractionRecipe,
ConceptDirection (safetensors persistence plus a JSON sidecar; no pickle)
and an offline ConceptRegistry with refusal as the built-in core concept.
AbliterationPipeline gains concept= (a name, or a ConceptTarget, deep-copied)
and concept_registry=. concept=None and concept="refusal" build the refusal
target exactly as before: same prompt pairing, truncation and METHODS
resolution. Internal storage uses neutral concept_directions /
concept_subspaces names, with refusal_* aliases kept for every caller.
Metadata keeps the refusal technique and adds a concept block that records
the seed.
Non-refusal concepts reject refusal-only options (jailbreak contrast,
refusal-head and safety-expert identification, inversion), reject preset
extraction settings that conflict with the concept recipe after resolution,
and are dense-only for now; MoE refusal behaviour is unchanged.
A golden test checks that default and concept="refusal" runs match exactly
(config and direction tensors) for every CPU-runnable METHODS key on the
tiny offline fixture, and that both match a baseline captured from the base
commit (provenance in tests/fixtures/refusal_golden.md).
Refs #224
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>