Commit Graph
15 Commits
Author SHA1 Message Date
Joseph Magly e795df746b Merge remote-tracking branch 'upstream/main' into feat/331-pinned-extraction-layer
# Conflicts:
#	README.md
#	docs/CONCEPT_PACKS.md
#	obliteratus/cli.py
#	obliteratus/concepts/cli.py
#	obliteratus/concepts/direction.py
#	obliteratus/concepts/geometry.py
#	obliteratus/concepts/intervention.py
#	obliteratus/concepts/target.py
#	tests/fixtures/refusal_golden.md
2026-10-17 19:08:09 -04:00
Joseph MaglyandClaude Opus 5.5 05c0857128 Merge upstream/main into feat/328-raw-steering
Resolve ExtractionRecipe conflict with #329: keep collateral_margin and
steering_scale and validate both in __post_init__.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 14:39:03 -04:00
Joseph MaglyandClaude Opus 5.5 6b3acf21bb Merge upstream/main into feat/331-pinned-extraction-layer
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>
2026-10-17 14:37:59 -04:00
Joseph MaglyandClaude Opus 5.5 6e6f97291c Merge upstream/main into feat/329-collateral-margin
Resolve additive README and risk-map conflicts with #330.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 14:18:40 -04:00
Joseph MaglyandClaude Opus 5.5 e284526632 Merge upstream/main into feat/328-raw-steering
Resolve additive conflicts with #330 in concepts/target.py and the
risk map.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:59:23 -04:00
Joseph MaglyandClaude Opus 5.5 10e01101fe feat(concepts): pinned extraction layers and grouped CV (#331)
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>
2026-10-17 13:07:11 -04:00
Joseph MaglyandClaude Opus 5.5 2eb8a1d16d feat(concepts): record and check entry-point special-token policy (#330)
Add an optional BOS policy to pack entry points (schema 1.2), warn or
fail on EOS-as-BOS and policy mismatches, and persist resolved special
tokens through extraction, run and export provenance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:07:10 -04:00
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 83ac05aead feat(concepts): fixed-magnitude steering scale modes (#328)
Add scale=residual_norm|raw|vector to concept steering across the API,
CLI, recipes and run metadata, recording effective vector norms. The
default residual-norm path is unchanged. The Pain Axis resteer stage now
uses the concept API with identical arithmetic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:07:10 -04:00
Joseph MaglyandClaude Opus 5.5 20d4fb0ac8 feat(concepts): add first-class pack entry points for latent concepts (#311)
A Concept Pack can now declare how to locate and activate its latent
representation, as schema v1.1 (v1 packs and refusal are unchanged):

- `entry_point.messages`: a system message and prior turns wrapping each
  prompt, rendered with the chat template (plain-text fallback recorded).
- `entry_point.prefill`: assistant prefill so readout can happen at an
  assistant position.
- `entry_point.readout`: final_token, mean_pool, span:<name> (a marked
  span in the template) or last_k:<k>.
- `entry_point.template`: `{variable}` rendering over prompt record fields.
- `entry_point.group_by`: grouped CV folds and held-out validation, so
  related samples never straddle folds.

Record annotations (person, split, group) now survive pack loading and
selectors. Unknown recipe and entry-point keys are rejected instead of
silently ignored. The entry point is part of activation identity, direction
metadata and provenance, so changing it invalidates cached activations and
saved directions. Generated-state readout is documented as not yet
supported.

Fixes #311

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 17:37:51 -04:00
Joseph MaglyandClaude Opus 5.5 5f558a78db feat(concepts): apply #223 maintainer rulings on publication, leace and steering
Maintainer decisions for epic #223 (2026-10-15):

- Q1: `leace` is a deprecated alias of the Fisher LDA direction. It keeps
  its numerical behaviour, warns once per public resolution with a
  DeprecationWarning naming `fisher_lda` and `leace_exact`, and will be
  removed in a future minor release.
- Q4: a collateral FAIL blocks both the model card and any Hub push of
  modified weights or adapters on every path (pipeline, export_run, both
  CLIs, Concept Lab, the Hub UI and tourney uploads), checked before any
  network call. `--allow-collateral-fail REASON` (and the matching API
  argument and UI field) overrides the block and stamps the FAIL and
  reason into the card, checkpoint metadata and provenance. Local save
  and export are never blocked.
- Q5: research-tier packs no longer carry publication or local-export
  restrictions; the tier is provenance only and Q4 applies to every pack.
- Steering defaults are removal-first: `steer` defaults to alpha -1 and
  the default dose ladder is non-positive. Positive doses stay available
  explicitly; `project` keeps its positive removal strength.
- Q3 (gate modes) and Q7 (dense only, follow-up #310) are unchanged and
  documented.

Refs #223

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 15:37:51 -04:00
Joseph MaglyandClaude Opus 5.5 d531158d30 docs(concepts): add concept workflow and interpretation guide
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>
2026-10-05 23:50:49 -04:00
Joseph MaglyandClaude Opus 5.5 14854019dd feat(concepts): add research-tier pain pack with pinned upstream data
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>
2026-10-05 22:18:08 -04:00
Joseph MaglyandClaude Opus 5.5 13a20bc147 feat(concepts): add validation gate and report before intervention
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>
2026-10-05 20:06:19 -04:00
Joseph MaglyandClaude Opus 5.5 88e8ceeb57 feat(concepts): add Concept Pack format v1 with pinned remote references
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>
2026-10-05 19:14:54 -04:00