Commit Graph
470 Commits
Author SHA1 Message Date
Joseph Magly 4b0113c00a Merge main 6a2b84d into fix/600-602-vocab-discovery-roundtrip-concurrency
# Conflicts:
#	CHANGELOG.md
2026-11-24 18:46:57 -05:00
Joseph Magly bf36682ad8 fix(persistence): never roll back a checkpoint destination another writer replaced
Codex review r2 for #621: the promoted directory's identity is recorded at
promotion and rollback leaves a destination whose identity changed untouched
(keeping any backup); no-replace rename tests run portably on hosts without
the primitive; ENOTEMPTY maps to FileExistsError and the unsupported-rename
message names a remedy.
2026-11-24 18:45:59 -05:00
Joseph Magly 343f68dafa Merge main a837fec into fix/600-602-vocab-discovery-roundtrip-concurrency
# Conflicts:
#	CHANGELOG.md
2026-11-24 17:54:54 -05:00
Joseph Magly 5f50feaeb5 fix(vocab-surgery): verify residual pins and publish outputs with atomic no-replace renames
Codex review r1 for #621: discovery refuses to stamp a pin onto inherited
ID-only operations it cannot verify (unpinned base, or an unfingerprintable
loaded tokenizer). The opt-in no-clobber checkpoint commit and the discovery
publisher use an atomic no-replace rename (renameat2 RENAME_NOREPLACE on
Linux, renamex_np RENAME_EXCL on macOS) and fail closed where none exists;
rollback deletes only files whose identity still matches what was published.
The recipe-digest compatibility test now uses a preserved pre-change
normalizer and a frozen recipe fixture, so normalization drift is caught.
2026-11-24 17:54:25 -05:00
Joseph Magly 638a728531 Merge main 08997c2 into fix/611-603-cli-json-mcp-hint
# Conflicts:
#	CHANGELOG.md
2026-11-24 17:13:27 -05:00
Joseph Magly b6ac2aeffc fix(cli): keep runs stdout empty on errors; send guard diagnostics to stderr
Codex review r1 for #617: the pre-parse secret-token and
distributed+preflight guards now print to stderr, and `runs` catches archive
errors (unknown or malformed run id, unfinished run) with a one-line stderr
diagnostic, exit 1 and empty stdout. Docs and changelog state the success
and error output contract; MCP_LOCAL_SETUP.md notes that policy validation
runs before the missing-extra check.
2026-11-24 17:12:24 -05:00
Joseph Magly 222c33ab3c fix(vocab-surgery): guard study-runner ID-only edits; derive recipe digest baselines
From the BT6 re-audit: the legacy `obliteratus run` study path (enumerate →
apply_batch) now runs the shared ID-only guard and fails closed with no
opt-out. The bundled-recipe compatibility test derives its baseline from a
pre-pin technique registry instead of hard-coded digests, so legitimate recipe
changes on main don't break it. A pin that cannot be verified (tokenizer
without get_vocab) is recorded as pin_unverifiable.
2026-11-24 16:10:20 -05:00
Joseph Magly 43393d841b Merge main 16f181a into fix/600-602-vocab-discovery-roundtrip-concurrency 2026-11-24 15:59:08 -05:00
Joseph Magly c3d134cf24 fix(vocab-surgery): pin ID-only operations to the tokenizer vocabulary in apply and recipes
From the BT6 audit of this PR: discovery now emits ID-only operations
routinely, so applying a config with a different tokenizer could edit the
wrong rows. Discovery embeds the tokenizer vocabulary SHA-256 in the config
(a field serialized only when set, so existing configs and bundled recipe
digests are unchanged). One shared guard, called by `vocab-surgery apply` and
the recipe technique, refuses ID-only operations unless the pin matches the
loaded tokenizer. The CLI keeps an explicit, receipt-recorded
--allow-unpinned-id-operations; the recipe path has no opt-out. An
unavailable vocabulary digest is recorded with a reason, and discover writes
the config before the report.
2026-11-24 15:59:05 -05:00
Joseph Magly fa719ec885 docs(checkpoints): avoid a backticked project name the docs checker runs as a CLI example
scripts/check_checkpoint_docs.py treats inline code that starts with the
project name as a CLI example and parses it, so the runbook wording added for
#626 failed test_checkpoint_documentation_contract_passes_offline.
2026-11-24 15:52:06 -05:00
Joseph Magly 1760d85238 Merge main 16f181a into fix/626-install-hints 2026-11-24 15:45:49 -05:00
Joseph Magly 931b630f92 Merge main 16f181a into fix/611-603-cli-json-mcp-hint 2026-11-24 15:45:39 -05:00
Joseph Magly 16f181a578 Merge pull request #605 from elder-plinius/feat/590-analysis-on-device
Run abliteration analysis math on the model's device
2026-11-24 15:36:12 -05:00
Joseph Magly 3cdc3ce065 fix(checkpoints): stop naming the quarantined PyPI project in install hints
The checkpoint adapter reason rendered `install_extra=obliteratus[<extras>]==<version>`,
and the refusal-recovery pilot printed `install obliteratus[recovery]`. pip
resolves both against an index, where the `obliteratus` project is
quarantined with no installable files. The reason keeps its `install_extra=`
key with bare extra names and adds `install_hint` (source checkout
`uv sync --locked --extra ...`) and `project_version`, within the schema's
2048-character limit. The pilot gives the same source-checkout guidance.

Fixes #626
2026-11-24 15:33:00 -05:00
Joseph Magly 9d766b48b7 fix(vocab-surgery): resolve discovered tokens by id and refuse concurrent output clobbering
Discovery checks that each token's text resolves back to its id. Tokens that
don't round-trip become flagged ID-only operations instead of failing at
apply time or being silently dropped. Reports record the tokenizer
vocabulary SHA-256, and apply/discover accept --expected-tokenizer-sha256.

apply rechecks its destination under the commit lock (new opt-in
replace_existing=False on atomic_checkpoint_directory); discover publishes
its files atomically with exclusive creation. Other checkpoint writers are
unchanged.

Fixes #600
Fixes #602
2026-11-24 14:54:36 -05:00
Joseph Magly 73b8b7233f fix(cli): emit clean JSON from runs commands and drop the PyPI MCP install hint
Add `runs` to the CLI machine-JSON command set so every durable-run
subcommand writes only its JSON document to stdout.

Replace the missing-`mcp`-extra hint with the source-checkout installs from
docs/MCP_LOCAL_SETUP.md. The PyPI project named `obliteratus` is quarantined
and has no installable files, so the hint no longer points there.

Fixes #611
Fixes #603
2026-11-24 14:43:55 -05:00
Joseph Magly 001057182a fix(process): deliver SIGINT as KeyboardInterrupt and bound selector waits
Codex review r5 for #592 (2 x P2):
- A deferred SIGINT is raised as an exact KeyboardInterrupt instance
  carrying `signum` and the original exception as context, so
  `except KeyboardInterrupt` callers handle it and an uncaught one still
  exits by SIGINT on Python 3.12 (which only does so for the exact type).
  SIGTERM keeps ProcessInterrupted(SystemExit).
- Each post-cleanup selector wait is capped at the poll interval while
  the overall drain deadline is kept, so huge finite drain values cannot
  overflow the platform timestamp.
Docs note that a drain of zero skips the post-cleanup read. Regressions
fail on the previous head; verified on the pinned Python 3.12 lane.
2026-11-23 19:59:03 -05:00
Joseph Magly 71576c39f8 fix(process): bound post-cleanup drain and share signal state across owners
Codex review r4 for #592 (4 x P2):
- After the group is terminated, draining uses an independent short
  bound (0.25 s default, OBLITERATUS_PROCESS_DRAIN_SECONDS override) and
  then closes both pipes, so a descendant that escaped the group while
  holding stdout/stderr cannot hang the evaluator.
- Nested owners share pending cancellation up the ownership chain, so
  the earliest signal wins and is delivered exactly once in either
  order.
- A SIGINT during exception cleanup reaches the outermost owner as a
  KeyboardInterrupt with the original exception kept as context.
- Deterministic coverage of the ownership-loss guard: an independently
  reaped leader raises the ownership error with zero killpg calls.
Docs and docstrings now state that an inherited SIGCHLD=SIG_IGN is
rejected before spawning (fail closed) rather than restored.
2026-11-23 18:24:48 -05:00
Joseph Magly ffe66b8096 fix(process): drain safely, own reaping, and never drop cancellations
Codex review r3 (5 x P2):
- Evaluator output is drained while polling the leader's exit; once the
  leader exits the group is terminated and draining completes, so a
  descendant holding a pipe no longer turns a pass into a timeout/hang.
- Owned groups require exclusive reaping: SIGCHLD=SIG_IGN is restored
  to SIG_DFL for the owned scope, and detected loss of ownership fails
  closed without signalling an unreserved PGID (contract documented).
- A signal deferred during exception cleanup is forwarded to the
  enclosing owner while the in-flight exception is kept; ProcessSignals
  documents and tests 'first signal wins, delivered exactly once'.
- Test helpers track every group from creation and terminate+reap in
  finally, including before readiness and in nested verify-edit.
Regressions fail on the previous heads and pass now; also synchronizes
the vLLM repeated-stop test and covers the procfs fallback.
2026-11-23 16:39:51 -05:00
Joseph Magly 52c4d0eee5 fix(analysis): size SAE and exact LEACE work before choosing the device
Codex review r1 for #605:
- High: SAE expansion was estimated from _harmful_means, empty before
  collection, so it was sized as zero. SAE training counts now come from
  the configured positive and control prompts.
- High: exact affine LEACE was sized as float32 but fits in float64 on
  CPU/CUDA. Device selection and distill admission now budget its
  covariance, decomposition and live operands at the fitter's actual
  dtype, shared from leace_exact.
- Medium: terminal cleanup after a failed run now drops all transient
  analysis references (means, shield atoms, directions, subspaces,
  workspace, resolved device) so accelerator memory is released.
Regression tests cover SAE and exact-LEACE fallback at a mocked memory
boundary, LEACE in distill admission, and cleanup after PROBE and
DISTILL failures.
2026-11-23 16:12:16 -05:00
Joseph Magly 2d79987f9b Merge remote-tracking branch 'upstream/main' into fix/589-search-process-groups 2026-11-23 12:21:30 -05:00
Joseph Magly f2db169384 Merge upstream/main into feat/590-analysis-on-device
Resolve against #593 (quick-check settings) and #591 (tied-head
migration) by keeping both sides: the pipeline gains analysis_device
alongside refusal_check_mode/confidence; migration and the shipped
recipes emit allow_tied_head_edit and the analysis_device cpu pin;
_structured relaxes both the refusal-check settings and
analysis_device for historical resolution records; both sides' tests
are kept.
2026-11-23 12:20:52 -05:00
Joseph Magly d62f4aafe9 feat(abliterate): run analysis math on the model's device
When the model is on CUDA or MPS, activation stacks and the analysis
math (difference means, winsorizing, whitening, per-layer SVD in
float32, refinement and KL logits) now stay on that device instead of
being copied to the host, where they used about 10 host cores per edit.
A new analysis_device setting (auto | model | cpu) is a v2 projection
parameter: auto, the default for v2 recipes, uses the model's device and
falls back to the CPU with a logged reason for offloaded, split or meta
models or when the pre-collection memory estimate exceeds free device
memory. The device actually used is recorded in resolution records and
checkpoint metadata. v1-migrated recipes and the shipped recipes pin
cpu so confirmations made with CPU-extracted directions re-apply
exactly; direct pipeline calls keep their CPU default. CPU results are
unchanged.

Fixes #590
2026-11-23 12:19:09 -05:00
Joseph Magly 1de580f7a1 Merge pull request #595 from younger-plinius/research/vocabulary-row-edits
Add experimental vocabulary-row editing with prompt and export audits
2026-11-23 12:18:46 -05:00
Joseph Magly cb49b92777 Merge remote-tracking branch 'upstream/main' into fix/589-search-process-groups 2026-11-23 12:18:43 -05:00
Pliny the Younger 5e55cdae09 Add experimental vocabulary-row editing with prompt and export audits 2026-11-22 22:18:34 -05:00
Joseph Magly 51c31b712e Merge remote-tracking branch 'upstream/main' into fix/589-search-process-groups 2026-11-22 13:37:39 -05:00
Joseph Magly d5275b5a78 Merge remote-tracking branch 'upstream/main' into fix/588-migrate-tied-head 2026-11-22 13:37:35 -05:00
Joseph Magly 3c8c20242f fix(recipes): stop candidate subprocess trees when a search is interrupted
recipe search, recipe confirm and verify-edit's capability vLLM server
started subprocesses that survived when the parent was stopped. An
orphaned edit kept 18 GB of GPU memory and broke the next queued
search. Subprocesses now start in their own process group; on
SIGTERM, SIGINT or an exception the whole group gets SIGTERM, a grace
period, then SIGKILL. The interruption is recorded in the candidate
record so a resumed search retries it. POSIX only; Windows behaviour
is unchanged.

Fixes #589
2026-11-22 11:51:16 -05:00
Joseph Magly c47c2c1033 fix(recipes): preserve v1 tied-head behaviour when migrating to v2
v1 recipes projected a tied LM head implicitly; the v2 projection
technique refuses that unless the recipe declares it. migrate_v1 now
emits allow_tied_head_edit: true when v1 would project the head (a
no-op on untied models) and lm_head: skip when v1 disabled head
projection, with provenance. It never silently skips a head edit v1
would have made. Migrated v1 search grids follow the same rule, and
shipped v1-derived data is updated.

Fixes #588
2026-11-22 11:51:15 -05:00
Joseph Magly a38b556862 fix(verify): make the quick refusal check confidence-aware
The pre-export refusal comparison judged harmless-refusal increases on
16 prompts against a 5% limit, so a single prompt changing (6.25%)
rejected edits that the 200-prompt verify-edit gates would judge. It
now rejects only when the paired Newcombe interval's lower bound
exceeds the limit (95% confidence by default), reports counts, rates
and bounds, and keeps the old point-estimate rule available as
refusal_check_mode: point. Both settings are v2 projection parameters,
normalized explicitly and recorded in resolution payloads and
checkpoint metadata. Also fixes the perplexity-weighting test, which
built a pipeline without the refusal sample attribute introduced in
46d6dc6 and failed in the full suite.

Fixes #587
2026-11-22 11:51:14 -05:00
Joseph Magly a897159ad8 fix(export): copy source processor configs into abliteration checkpoints
Checkpoints saved weights, configs and tokenizer files but not the
source model's processor configuration, so models packaged as
multimodal wrappers (Qwen3.5, Gemma 4 E-models) could not be served
from an exported checkpoint (vLLM: "Can't load image processor").
Export now copies processor-side config files present in the local
source directory or the exact cached Hub revision, records their
SHA-256 digests in the checkpoint metadata and projection resolution
records, and checkpoint validation rejects a listed file that is
missing or changed. No network access; a source without these files
exports exactly as before.

Fixes #585
2026-11-21 06:24:28 -05:00
Joseph Magly eef8007f53 feat(models): generalize the Qwen3.5 hybrid surgery contract to dense sizes
The hybrid surgery contract accepted only the Qwen3.8-27B text backbone
(48/16 layers, hidden 5120). It now validates any dense qwen3_5_text
backbone, deriving the expected residual-writer shapes from the model's
own text_config (linear_attn.out_proj, self_attn.o_proj, mlp.down_proj)
and keeping every fail-closed check: no MoE config or modules, a
repeating linear/full pattern consistent with full_attention_interval,
a layer count matching layer_types, no writer biases, and Linear writers
whose shapes match the config. The CUDA fast-path and pristine-logit
requirements are unchanged, tied embeddings follow the existing
tied-head rules, and the validated topology is recorded in metadata.
The old 27B entry point remains as a compatible wrapper.

Fixes #583
2026-11-21 04:29:24 -05:00
Joseph Magly ee4935e798 Merge upstream/main into feat/569-concept-unification
Apply #571's projection resolution schema additions (reference,
$defs) before wrapping it in the concept-or-projection conditional.
2026-11-21 01:40:04 -05:00
Joseph Magly 7c9f9764ec feat(recipes): unify concept packs with v2 edit steps
Concept-pack ExtractionRecipe maps onto the direction_source and
placement of v2 techniques: concept_recipe_to_v2 converts every shipped
pack into a normalized v2 step whose direction source is a pinned
concept_pack input, with pack-level extraction pins normalized into
explicit parameters. Packs applied by activation steering use a new
steering.activation_addition v1 technique wrapping the existing
intervention code; refusal is expressed as weight projection like any
other concept. Applied steps may register cleanup that the executor
runs if a later step fails, so steering hooks are removed.

Fixes #569
2026-11-21 01:27:14 -05:00
Joseph Magly 134bd2c32c feat(recipes): move recipe tools to v2 pipelines; v1 read-only
recipe search, confirm, promote and obliterate --recipe now operate on
v2 recipes: search grids are v2 step variations (recipe-search-grid v2,
same preregistered selection rule), confirmation and promotion consume
evaluation profiles and bind evidence to applied resolution records,
and --recipe applies pipelines through apply_recipe. v1 recipes and
grids load through mechanical migration with a notice; writing v1 is
refused. Shipped v1 data is migrated to v2, and the two recipes
confirmed on the protocol final test in the initial core run ship as
accepted v2 data: llama3.1-8b-e03-reg02 and qwen2.5-1.5b-mid10-18-dim1,
with KL-advisory profiles and value-only confirmation evidence.

Fixes #571
2026-11-21 01:27:13 -05:00
Joseph Magly 824adeeb21 Merge upstream/main into feat/567-evaluation-profiles
Keep both the evaluation-profile and pinned-input exports and risk-map
entries; apply_projection takes both #568's recipe_metadata and this
branch's device, dtype and reference_prompts.
2026-11-20 22:11:26 -05:00
Joseph Magly df61ca3db9 feat(recipes): reconcile pinned inputs with the LoRA repair executor
Recipes now declare everything a step consumes. Training corpora use
the new recovery_corpus input kind (pinned by the recovery metadata
digest, train or calibration role) and LoRA repair consumes the
resolved corpus. Run-specific locations are runtime_binding inputs with
the new runtime role; they cannot satisfy a data role. apply_recipe
rejects declared inputs the caller leaves unbound and caller bindings
the recipe does not declare, resolves pinned inputs once, and records
input digests and runtime binding names (never paths) in the
resolution record. Techniques adapt resolved inputs through an
optional TechniqueSpec.prepare_inputs hook, so the executor stays
technique-neutral.
2026-11-20 22:02:22 -05:00
Joseph Magly 635fff939b Merge upstream/main into feat/568-pinned-inputs
Resolve projection_runtime imports and risk-map entries; the LoRA
repair recipe's input declarations are reconciled in the next commit.
2026-11-20 21:46:01 -05:00
Joseph Magly ad32fb54d1 Merge upstream/main into feat/567-evaluation-profiles 2026-11-20 21:41:38 -05:00
Joseph Magly 790731ffea feat(recipes): add versioned evaluation profiles
Add obliteratus.evaluation-profile/v1: one digest-referenced evaluation
contract for v2 recipes. A profile carries a partial verify-edit spec
(endpoints, margins, capability decoding and tier), a kl_policy (gate or
advisory) and calibration evidence references (noise floor or random
control) whose digests and schemas are verified and whose adopted
thresholds are recorded per field. Profiles layer family then
individual over defaults with resolve_margins precedence; advisory KL
sets the endpoint not required. v2 recipe confirmation resolves the
profile and records the resolved spec digest; the v1 spec path is
unchanged. Ships a candidate Llama-3.1-8B-Instruct profile with advisory
KL and its random-control evidence, local paths redacted.

Fixes #567
2026-11-20 21:41:32 -05:00
Joseph Magly d57585ecae feat(recipes): add adapter.lora_repair technique and pipeline executor
The second v2 technique, registered only through the technique
registry with no change to the model-recipe.v2 schema or validator.
adapter.lora_repair v1 wraps the existing LoRA recovery (assistant-only
loss): explicit defaults from RecoveryConfig, LoRA targets from
placement writer roles, training on the previous step's model state,
and an adapter or merged-weight artifact with SHA-256 digests in its
resolution payload. apply_recipe runs ordered steps fail-fast, binds
declared inputs and outputs between steps, and chains each step's
payload into one resolution record. recover.py gains keyword-only
dropout and exact-target seams with unchanged defaults.

Fixes #570
2026-11-20 17:23:40 -05:00
Joseph Magly 65439c0a8b feat(recipes): pin v2 inputs by digest with declared split roles
Add an extensible input-kind registry (protocol_split, prompt_pairs_file,
concept_pack, chat_template, reference_model). resolve_inputs
materializes each named input, verifies its SHA-256 and returns its
declared role. Normalization validates input declarations and step
consumption before hashing: technique steps may consume only train or
calibration inputs, search evaluation only tune and confirmation only
final_test, so the final test set cannot reach fitting. The projection
technique extracts from the resolved train input, and the resolution
record carries verified input digests. Protocol disjointness checks are
shared with search.

Fixes #568
2026-11-20 17:23:39 -05:00
Joseph Magly e25c6e94e7 Merge upstream/main into feat/565-projection-technique
Resolve docs/MODEL_RECIPES.md keeping both the projection technique
section and the checkpoint resolution records section from #576, and
correct the latter's stale note: legacy records use a fixed created_at
sentinel, not the metadata file's modification time.
2026-11-20 16:45:18 -05:00
Joseph Magly bb13f0fb6c Merge pull request #576 from elder-plinius/feat/566-resolution-records
Persist checkpoint resolution records
2026-11-19 19:15:34 -05:00
Joseph Magly c10db5abee feat(recipes): persist checkpoint resolution records
Add obliteratus.recipe-resolution/v1: what an applied recipe actually
did, as a canonical record (recipe digest, engine and code commit,
target with structure facts such as tied embeddings, per-step technique
payloads validated by registered techniques, artifacts with digests).
Checkpoints now save recipe-resolution.json atomically beside the
weights. resolution_from_metadata adapts older checkpoints from
abliteration_metadata.json; such records use a fixed created_at
sentinel because the metadata has no timestamp, so their digest depends
on content (bound by the metadata sha256), not on file times. The
random-direction control reads the record when present and records its
digest, and confirmation records the resolution digest.

Fixes #566
2026-11-19 18:54:59 -05:00
Joseph Magly 370ab37352 feat(recipes): register the v2 abliteration.projection technique
The first technique in the v2 registry. Its normalizer expands the
authoring form (preset plus overrides, which v1 migration emits) into
fully explicit parameters through _effective_projection_options, now the
single source for both AbliterationPipeline.__init__ and recipes, so
implicit defaults such as embed_regularization 0.35 (fallback) versus
0.5 (advanced) become explicit. The applier resolves placement, runs the
pipeline with pinned layers and returns a resolution payload (resolved
layers, writers, effective ranks, KL-restored groups, effective params,
checkpoint digests). On models that tie input and output embeddings an
LM-head edit is rejected unless allow_tied_head_edit is set (or the head
is skipped), and safeguards that would change the plan reject unless
declared.

Fixes #565
2026-11-19 18:54:57 -05:00
Joseph Magly 40d6399fc1 Merge pull request #575 from elder-plinius/fix/capability-batch-invariant
Launch vLLM batch-invariant for capability scoring
2026-11-19 18:39:52 -05:00
Joseph Magly 7c3dcb309e fix(verify-edit): launch vLLM batch-invariant for capability scoring
Greedy, seeded decoding (#562) was not enough: in bf16 vLLM decodes the
same greedy request differently depending on what it is batched with,
so two launches of stock Llama-3.1-8B still disagreed on 4 of 75 arc
items and stock scores moved about 2 points between runs.

The capability endpoint now starts its vLLM server with
VLLM_BATCH_INVARIANT=1 (spec capability.batch_invariant, default true).
Measured with vLLM 0.33 on an RTX 4090: two launches of stock
Qwen2.5-1.5B-Instruct gave identical completions on 150 of 150 arc and
gsm8k items. VllmServer gains an environment argument for server-only
variables; the rest of the environment is preserved.
2026-11-19 18:34:59 -05:00
Joseph MaglyandClaude Opus 5.5 2e13bdff53 Merge upstream/main into feat/564-placement-resolver
Resolved shared registration files by keeping both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 18:30:42 -05:00