Files
OBLITERATUS/docs/MODEL_RECIPES_PLAN.md
Joseph Magly 3797d10229 docs(recipes): publish the recipe plan and v2 design; mark v1 ready for testing
The per-model recipe issues (#539-#547) and the v2 issues (#563-#571)
reference a plan and a design review that existed only in a local
artifact store. Publish both as docs/MODEL_RECIPES_PLAN.md and
docs/MODEL_RECIPES_V2_DESIGN.md (machine-specific paths removed), and
add a status note to docs/MODEL_RECIPES.md: v1 is the supported format
for testing, the v1 testing loop, the matric-eval requirement for
deterministic capability scoring, and the open KL-margin question.
2026-11-19 17:04:11 -05:00

13 KiB
Raw Permalink Blame History

Per-model abliteration recipes: plan

Design for the next schema version: MODEL_RECIPES_V2_DESIGN.md. User documentation for the current (v1) recipes: MODEL_RECIPES.md.

Date: 2026-11-19. Status: filed 2026-11-19 as #539 (registry), #540 (margins), #541 (--recipe), #542 (bind Qwen3.8), #543 (search), #544 (confirm); family scope added as #546 (family recipes) and #547 (family promotion); existing #533 and #537 linked. Source: the operator's direction that each model needs its own recipe ("e03 was developed for qwen 3.8 27b, there is likely no one size fits all technique"), plus the initial core run evidence below.

1. Evidence: one recipe does not transfer

All runs were on an RTX 4090 against the protocol split (500 extraction / 142 tune / 200 final test pairs), scored by verify-edit with the default margins. Raw run outputs were kept with the local runs; the numbers below are copied from them.

Model Recipe Held-out refusal (stock → edited) Notes
Qwen2.5-1.5B default knee_cosmic (advanced) 92% → 80% selected the last 5 layers only (#533)
Qwen2.5-1.5B advanced, pinned 12–16, 1 diff-means dir 91% → 25% (tune) best Qwen result; next-token KL 0.18
Qwen2.5-1.5B E03, small-model caps active 92% → 92% caps turned it into layers 5–9 / 2 dirs
Qwen2.5-1.5B E03 as published (caps off) rejected E03's own KL gate: 0.83 > 0.50 budget
Llama-3.1-8B advanced, pinned 14–18 89% → 89% (tune) no effect
Llama-3.1-8B advanced, all layers 89% → 75% (tune) first-token KL 0.95
Llama-3.1-8B basic, all layers (raw text) 89% → 99% (tune) induced refusal on benign prompts (#537)
Llama-3.1-8B E03 as published 85% → 0% (test) capability −2.29 pt (limit 2.0), KL far over

Conclusions:

  • Placement, direction count and strength are model-specific. The same settings are best on one model and useless or harmful on another.
  • A recipe tuned for Qwen3.8-27B did the job on Llama-3.1-8B but not on Qwen2.5-1.5B. Transfer is an empirical question per model, not an assumption.
  • Silent adaptation is the worst outcome. The small-model caps rewrote E03 without saying so and produced a misleading null result. A recipe should run as written or be rejected loudly.
  • The default KL margins (first-token 0.1, next-token 0.05) have failed every edit that removed refusal. verify-edit measures KL on the held-out harmless prompts (obliteratus/verify_edit/measure.py:165), so these failures are real drift on benign prompts. They are not an expected side effect of removing refusal. Margins need per-model calibration, and recipes should be searched for lower harmless-prompt drift.

2. What exists today

  • METHODS presets in obliteratus/abliterate.py. Most are generic; qwen38_e01–qwen38_e03 are model-specific but are not bound to a model id, so nothing stops or warns when they run elsewhere.
  • ArchitectureProfile.method_overrides (obliteratus/architecture_profiles.py): heuristic overrides by architecture class, used by UI auto-detect. Not evidence-backed per model.
  • Concept packs: exact model-id → extraction-layer pins (ConceptRecipe.extraction_layer), for non-refusal concepts.
  • MODEL_PRESETS (obliteratus/presets.py): a catalog of model ids, tiers and dtypes, with no edit recipe.
  • Run tooling that a recipe workflow can reuse: --layers pins (#300), --extraction-layer global refusal direction and --chat-template (#537, in review), small_model_safeguards per preset (E03 fix PR, in review), verify-checkpoint, verify-edit with frozen spec digests, and the protocol tune/test split.

3. Target design

A model recipe is a versioned, evidence-backed record that binds one model to one edit:

  • Identity: exact model id and revision (weights digest), plus architecture family.
  • Edit: base method preset plus explicit overrides (layers or layer rule, direction method and count, regularization, norm preservation, chat template, extraction layer and scope, KL optimization settings, safeguards).
  • Margins: the verify-edit spec (and its sha256) the recipe was accepted under, which may differ per model.
  • Evidence: the tune-split search that chose it, the single final-test confirmation, reload parity, and the run provenance (code commit, hardware, seeds).
  • Status: candidate → accepted → superseded, with who accepted it and when.

Behaviour:

  • obliterate --recipe <name> (or automatic lookup by model id and revision) applies the recipe exactly. Every override is recorded in metadata, alongside the recipe name and version.
  • Applying a recipe to a model it is not bound to fails by default with a clear message. An explicit --allow-recipe-transfer runs it and labels the output as a transfer experiment.
  • No silent adaptation: caps and safeguards never rewrite a recipe; they either belong to the recipe or reject it.
  • Unknown models get no implied recipe. The operator runs a search (below) or picks a generic preset knowingly.

3a. Two recipe scopes: family and individual (operator direction 2026-11-19)

Recipes exist at two scopes:

  • Individual recipe: bound to one exact model id and revision. Layer settings may be absolute indices. This is what the Qwen3.8-27B E03 recipe is.
  • Family recipe: bound to a model family by a match rule over config fields that are read without loading weights (ModelProfile: model_type, architecture, layer count, hidden size, parameter range, plus optional id patterns such as meta-llama/Llama-3.*-Instruct). Because family members differ in depth, family recipes express placement relative to depth: layer windows and extraction layers as fractions, resolved to indices per model and recorded.

Resolution, most specific first:

  1. an accepted individual recipe for the exact model and revision;
  2. an individual recipe that inherits from a family recipe and overrides some fields (for example, a pinned window or regularization tuned for that member);
  3. an accepted family recipe whose match rule covers the model;
  4. otherwise no recipe (the operator searches or picks a generic preset).

Ambiguity is an error. If two family recipes match a model, resolution fails and names both; the operator picks one with --recipe or narrows the match rules.

Evidence and status per scope:

  • An individual recipe is accepted by its own single final-test confirmation.
  • A family recipe is accepted only after it has been confirmed on at least two member models of different sizes, with the member list recorded. A family recipe applied to a member it has not been confirmed on runs as a family-application. That is labelled in metadata, and it is not evidence for that member until confirmed there; a confirmation can promote it to an individual recipe that inherits from the family.
  • Margins: each family recipe carries default margins; an individual recipe may override them with its own calibrated spec (#540).
  • Inheritance is explicit and recorded: metadata lists the resolved chain (family → individual), every inherited and overridden field, and the resolved absolute layers.

Example from this run: E03 (an individual Qwen3.8-27B recipe) worked on Llama-3.1-8B and failed on Qwen2.5-1.5B. A Qwen family recipe could not have been accepted from E03 alone. A Llama-3.x family candidate would start from the Llama-8B result and need confirmation on a second Llama size before acceptance.

4. Recipe development workflow (per model, and per family)

  1. Gate: concept baseline (concepts baseline refusal --require-verdict warn) and the lexical-confound check.
  2. Search on the tune split only: a small, preregistered grid over placement (pinned windows vs. all layers vs. global direction from layer L), direction count, strength and template. Score each candidate with verify-edit --heldout tune. Record every candidate, not just the winner.
  3. Select by a preregistered rule (for example, the lowest refusal subject to the capability and over-refusal margins, with KL as a tie-breaker until the KL margins are settled).
  4. Confirm once on the final test split with the frozen spec digest. If it fails, the recipe stays candidate; the test set is not reused for another selection round.
  5. Reload check (verify-checkpoint), then record the recipe as accepted with its evidence.

For a family recipe: run the same search on one member with depth-relative parameters, confirm on that member, then confirm unchanged on at least one more member of a different size. A failure on the second member keeps the family recipe a candidate; the first member's result can still become an individual recipe.

Cost note: on a 24 GB GPU an 8B edit plus verify-edit takes about 17 minutes of GPU time per candidate (L6 measurements). A 6–8 candidate grid fits a local session. The 27B Qwen3.8 recipe search belongs on the rented window.

5. Draft issues (for approval before filing)

  1. Model recipe registry and schema (P1). Add a versioned ModelRecipe record (identity, edit, margins, evidence, status), stored as JSON files under obliteratus/recipes/ with a schema and validation. Seed it with qwen38-27b-e03 (accepted, from the published E03 evidence) and the local candidates from this run (qwen2.5-1.5b, llama3.1-8b, as candidate). Acceptance: schema validation, loading, and round-trip tests.
  2. obliterate --recipe and model binding (P1, depends on 1). Apply a recipe exactly, record the recipe name/version and the effective overrides in metadata, and reject when the model id or revision doesn't match unless --allow-recipe-transfer is set. Acceptance: CPU tests for exact application, mismatch rejection, transfer labelling and metadata.
  3. Bind the Qwen3.8 presets to their model (P2, depends on 2). qwen38_e01–e03 become recipes bound to Qwen3.8-27B; using them on another model warns or requires the transfer flag. The campaign's small-model rehearsal passes the transfer flag explicitly and is labelled as a software check. Builds on the E03 safeguard fix.
  4. Tune-split recipe search command (P2, depends on 1). obliteratus recipe search <model> --grid <file> runs a preregistered candidate grid on the tune split through obliterate + verify-checkpoint + verify-edit, writes every candidate's result, and proposes a winner by the preregistered rule. It never touches the final test split.
  5. Recipe confirmation and acceptance (P2, depends on 4). obliteratus recipe confirm runs the single final-test confirmation with the frozen spec digest and records accepted or keeps candidate, refusing a second confirmation for the same model and test set.
  6. Per-model verification margins (P1; operator decision 2026-11-19: per model). Each recipe carries its own frozen verify-edit spec and digest. Harmless-prompt KL (first-token and next-token) stays a gate, with thresholds calibrated per model, for example against stock-vs-stock or seed-to-seed noise and the model's capability sensitivity. Record the calibration evidence with the recipe. 7a. Family recipes: match rules, depth-relative parameters and resolution (P1, depends on 1, #546). Family scope in the schema, match rules over ModelProfile fields, fractional layer windows and extraction layers resolved per model, the four-step resolution order, ambiguity errors, and inheritance (individual inherits from family with recorded overrides). 7b. Family recipe promotion (P2, depends on 5 and 7a, #547). A family recipe becomes accepted only after confirmation on at least two member models of different sizes; applying an unconfirmed family recipe to a member is labelled family-application; a member confirmation can be promoted to an inheriting individual recipe.
  7. Fix layer selection defaults (P2, existing #533). Keep it as the default-path fix for users without a recipe, but out of the recipe path's critical path.
  8. Refusal-increase gate in VERIFY (P3, remainder of #537). A cheap stock refusal baseline on the evaluation prompts, so VERIFY fails when an edit increases refusal.

6. Order and decisions needed

Order: 6 (margins decision) and 1 in parallel → 7a → 2 → 3 and 4 → 5 → 7b. Issues 7 and 8 are independent.

Decisions for the operator:

  • Margins (issue 6): decided 2026-11-19: per model, keeping harmless-prompt KL as a gate. An earlier draft wrongly described the failing KL as measured on harmful prompts; it is measured on harmless prompts.
  • Where recipes live: in-repo JSON (reviewed by PR) or an external store.
  • Which models get recipes first: suggested Qwen3.8-27B (rented window), Llama-3.1-8B (E03 is already close locally), and Qwen2.5-1.5B (cheap local iteration).