(cherry picked from commit f9a289e267889c297cefcdc67eea92c4b8eb8d4d)
Ported for #244 (part 2/6). Internal-only content from the archived
commit was dropped: .aiwg records and the internal security-docs test.
Marked experimental in user docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DiskSnapshot admitted six largest-tensor copies against a fixed 1 GiB
default, so any model with a tensor over ~179 MB (e.g. a large-vocabulary
embedding) could not create a restore point regardless of free memory.
staging_bytes now defaults to None, which admits half of currently
available host memory (DEFAULT_STAGING_HOST_FRACTION). Explicit values keep
their existing hard-cap semantics, min(staging_bytes, available). Rejection
stays fail-closed and names required bytes, admitted bytes, the budget
source and the snapshot.staging_bytes / staging_bytes= knob.
Closes#269
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4caf45b04a8faa55f191b22c069f58714236689b)
Ported for #244 (part 1/6). Internal-only content from the archived
commit was dropped: .aiwg records, internal runner-policy routing, and the
internal security-docs test. Marked experimental in user docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new Concept Lab tab (obliteratus/ui_concept_lab.py) drives the merged
concept APIs in six steps:
1. select a concept or pack;
2. extract with the pack recipe;
3. validate through the gate (an override needs a non-empty, recorded
reason);
4. intervene (orthogonalize, project, steer, lora), with pristine and
modified previews;
5. evaluate with the collateral battery, and run the repair ladder for
every intervention mode;
6. export through the #231 guards.
Under those guards, research-tier packs never push modified weights, a
collateral FAIL blocks only the publish card, and incomplete repairs need
an explicit acknowledgement. The UI never fetches pack data implicitly.
Selecting a concept pack disables or rejects the custom-prompt and dataset
controls, with a clear message.
The Obliterate tab still defaults to refusal and is unchanged. Legacy
refusal runs also expose their extraction as a ConceptDirection artifact,
best effort: a layout the artifact cannot represent is logged and never
aborts the run. Operator-UI coverage follows the existing conditional
policy pattern.
Closes#234
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/CONCEPT_WORKFLOW.md walks a concept from definition to export
(define, extract, validate, intervene, evaluate, repair, compare/export),
with offline CLI examples. Its interpretation guide covers what
validation, ablation and steering do and do not show: behavioural nulls
as first-class results, hidden KV-cache channels, steering fragility, and
why "direction removed" is not "experience removed". A responsible-use
section covers user-defined concepts.
Every literature claim is cited by arXiv id or DOI. The existing concept
docs link to the guide, and the README gains a short "Concept vectors
beyond refusal" section. A test runs the outcome-language lint over the
concept docs, resolves local links and anchors, checks that every
documented `obliteratus` command parses, and checks the required
citations.
Closes#235
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Any intervention export for a research-tier concept, such as the pain pack,
now requires the run's evaluation record to show that the collateral
battery ran with a refusal-rate result. A skipped or missing battery blocks
the export, with an error naming the missing channel; research tier has no
override. Direction- and validation-only exports stay allowed. User-tier
runs that skip the battery still export, with the skip reason recorded.
This implements the #232 acceptance criterion that the collateral battery,
including refusal rate, is required for any pain intervention export.
Refs #231#232
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Concept runs can now be compared and exported as directions, reports,
reversible adapters or full checkpoints. Each export carries
schema-validated provenance (concept-provenance.v1) with sorted content
digests, pack identity, gate verdict, evaluation outcome and repair status.
Exported cards use outcome language ("direction removed / behaviour
changed"), and a lint rejects claims about removing pain, suffering or
experience. Pack data is excluded from exports through a strict file
allowlist (model files, shard index cross-check, symlink rejection).
Publication guards follow the interim maintainer decisions on #223:
- Q4: a collateral FAIL blocks only --publish-card. Other exports proceed
with the FAIL recorded. Publishing anyway needs an explicit, recorded
reason, from the CLI or the UI acknowledgement panel.
- Q5: research-tier packs never push modified weights or adapters to the
Hub, from the pipeline, the CLI or the UI. Malformed concept metadata
fails closed.
Incomplete repairs need an explicit acknowledgement before export or a UI
Hub push. Refusal metadata changes are additive only.
Closes#231
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When an intervention costs coherence, a repair ladder runs steps in order
of invasiveness:
1. norm preservation;
2. retained-fraction regularization;
3. KL-budget rollback;
4. RDO refinement;
5. a reversible LoRA repair adapter.
A step is accepted only if coherence is within budget, the target
projection stays removed, and collateral metrics are no worse than before
the step. A step that re-introduces the direction is rejected, and its
weights are rolled back bit-exactly, including on exceptions. Every attempt
and its reasons are recorded. Non-finite measurements become rejection
reasons rather than errors. repair: incomplete is reported, and the report
saved, when no step satisfies all criteria. Steps that are unavailable for a
layout (for example offloaded or quantized weights) are recorded as
unavailable. The legacy refusal path is unchanged.
Closes#233
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ship `pain` as a research-tier Concept Pack for the representational
direction reported in The Pain Axis (Tagliabue, Dung & Berg,
arXiv:2609.16247). No third-party sentences are committed. The manifest
references valen-research/Pain-axis at pinned commit 4d75cd90, with a
per-file SHA-256 for every positive, control, confound/neighbour, battery
and reference file. Data is fetched only by an explicit step, then cached
and verified; a mismatch fails closed.
Remote references gain a declarative, data-only JSON selector (path,
category filter, text field) applied after hash verification. Selectors are
bounded and strictly validated, with no code execution. This is an additive
schema change.
The recipe mirrors the replication spike (signed cosine 0.972 against the
published Qwen2.5-7B-Instruct vector): raw prompts, final-token readout
after " I feel:" with a mean-pool comparison, pooled controls, 50%
control-PC denoising, cv_auc layer selection, and a norm_ratio 0.6
intervention layer for steering. The first-party dataset card records
intended use, confounds (numbness and injury-without-pain wording), the
upstream MIT licence, citations and differences from the authors' grouped
CV. Caveat: the pack identifies a representational direction; it does not
measure or remove pain or any experience.
`obliteratus concepts baseline` fetches explicitly, extracts with the pack
recipe, runs the gate in report mode and writes validation.json plus
direction files. A test checks that no upstream sentence is committed.
Refs #232
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
apply_concept_intervention(model, direction, mode, layers, positions, ...)
supports four modes:
- orthogonalize: the permanent weight projection, routed through the
offload-aware transactional path (all targets resolved before the first
mutation, including tied aliases; rollback on failure);
- project: a reversible inference-time projection hook;
- steer: reversible steering with signed alpha, per-layer vectors, a
runtime-mutable coefficient, and safetensors+JSON save/load;
- lora: a forward-time adapter that never modifies base weights, so
removal restores pristine logits exactly.
The pipeline and SteeringHookManager now share one hook mechanism, with the
public API kept compatible. Installation is transactional: a failure partway
removes any hooks already installed. evaluate_dose_ladder reports steering
over a default alpha ladder, with invalid-output and refusal denominators and
a caution that steering effects are coefficient-fragile and non-monotonic.
The validation gate is enforced. Only the built-in refusal pack (matched by
pack hash, not by label) is exempt. Other directions need a passing or
warning verdict, or a recorded override.
Closes#229
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A calibration spike on Qwen2.5-1.5B-Instruct (842 prompts per class)
confirmed the AUC and percentile thresholds, but found four gate defects:
- Arbitrary SVD/eigen signs failed valid directions. Directions are now
oriented on training rows only, so the positive class projects higher.
Reference and neighbour cosines keep the sign of the supplied vector.
- Supplied vectors were validated by refitting the recipe, so random
vectors scored held-out AUC 0.99. A supplied vector is now scored as-is
on held-out folds, and recipe-refit CV AUC is reported separately.
- A suffix-only lexical confound scored AUC 1.0 and only warned. A seeded,
cross-validated text-only lexical baseline now flags lexical_confound
when wording alone is about as separable as the activation direction.
- The default is now 1000 norm-matched null draws, up from 20.
Power floors: fail below 16 per class, warn below 32. The refusal default
(off) is unchanged. The docs and the ADR-004 amendment record the
calibration.
Closes#256
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Any contrast set yields a direction, and separability can come from
wording. The gate (obliteratus/concepts/gate.py) checks a concept direction
on cached activations before any weight edit:
- in-sample and held-out k-fold AUC, refitting the full recipe per fold;
- percentile against N seeded, norm-matched random directions;
- semantic-control AUCs, and neighbour-concept cosine and AUC;
- a confound scan (discriminating tokens, masked AUC) comparing
final-token and mean-pool readouts;
- an optional reference-vector cosine.
It returns pass | warn | fail with reasons and writes validation.json,
including the effective thresholds and a fixed statement of what validation
does not establish (causal use, behavioural effect, anything about
experience). Thresholds come from the pack, falling back to the initial
defaults, and await calibration.
Modes: enforce (default for concept entry points) stops the run after
DISTILL and before EXCISE unless --override-gate "<reason>" is given, and
the reason is recorded. report never blocks. off records validation:
skipped. Legacy refusal runs, including concept="refusal", default to off;
report is opt-in, so existing runs are never blocked and pay no gate cost.
Non-gate validation errors are raised as PipelineFailure with cleanup.
New obliterate flags: --concept, --override-gate and --gate-mode. ADR-004
gains an amendment documenting the neighbour forward-pass budget and the
refusal default.
Closes#228
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Concept Packs are data-only directories or byte-deterministic .cvpack zips:
manifest.yaml, positive.jsonl, controls/*.jsonl, and optional neighbours,
battery, baseline and reference files, plus a dataset card. Every file
carries a SHA-256 and an SPDX licence. A packaged JSON Schema and built-in
validation gate the schema_version major. Tiers: core (refusal only),
research, and user (namespaced user/<id>).
Loading treats packs as untrusted. It rejects hash mismatches, missing
licences, executable content, symlinks, hardlinks, special files, nested
archives, path traversal, duplicate and colliding names, unsafe YAML,
control characters in decoded text, oversized members and unknown major
versions.
A data file may instead be a pinned remote reference (https repository,
40-hex commit, path, sha256). It is fetched only by an explicit fetch step,
cached atomically and verified, and a mismatch fails closed; lint works
before fetch. URL import requires --sha256, and installs are exclusive.
The built-in refusal pack is generated from the built-in harmful and
harmless sets and equals the #224 refusal target. New CLI group: concepts
list | show | init | lint | pack | import | fetch. Ids resolve before paths,
and corrupt cache entries are skipped with a warning. DatasetSource gains an
optional licence field. No new runtime dependencies.
Closes#225
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 2e8c362430830f1b4ce23757b9a364596bcee6ac)
Adapted for upstream: _admit_phase does not exist upstream (grep finds no
definition in obliteratus/), so dropped the internal mock and rewrote the
main test to group model forwards per cache policy instead of assuming a
single two-prompt batch (upstream batches by available memory; on CPU-only
hosts each prompt runs its own forward). Kept docs/attention-cache-
qualification.md verbatim (no hostnames, receipts, or private refs; the
#95/#96/#97 refs are public issue numbers) and the
ci/test-risk-map.json registration, which matches the final test file name.
analysis/leace.py documents that it returns the Fisher LDA direction
S_w^{-1} delta and is not a faithful LEACE (Belrose et al.,
arXiv:2306.03819), but the pipeline logged "closed-form optimal concept
erasure", and the informed preset, CLI help, UI and docs advertised
optimal LEACE erasure.
Reword the logs, preset description, CLI help, UI hint, docstrings and docs
to "Fisher LDA direction (LEACE-inspired)", and label the per-layer loss as
an LDA quantity in log text only. The leace option name, numerics,
signatures and persisted keys are unchanged; a test pins the direction to
an independently computed S_w^{-1} delta.
Fixes#221
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exact setuptools/wheel pins block platform-specific backend patches and
make isolated pip installs fail on Android/Termux Python. Keep a setuptools
lower bound only, drop the unused wheel backend pin, keep requirements.txt
aligned with core package deps, and install the Spaces extra in Docker
instead of pulling bitsandbytes by default.
Android/Termux is still not a supported runtime; the new platform note
documents host wheels, ANDROID_API_LEVEL, and --no-build-isolation so
pip does not isolate a second setuptools or compile manylinux-only
extensions.