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
11 KiB
Normalized recipe specification (v2): design review
Tracking issues: #563 (core), #564 (placement), #565 (projection technique), #566 (resolution records), #567 (evaluation profiles), #568 (pinned inputs), #569 (concept unification), #570 (LoRA repair technique), #571 (tools on v2). Plan and v1 issues: MODEL_RECIPES_PLAN.md.
Date: 2026-11-19. Status: approved 2026-11-19 (operator: file and build; second technique = LoRA repair adapter; v1 read-only once v2 lands). Context: operator direction that recipes are still being designed, and should become a normalized, extensible, flexible setup able to express many techniques now and through future model creation, tuning and generation work. Any expansion of the spec, contracts or rules should happen now, before recipes accumulate.
1. What v1 is
obliteratus.model-recipe/v1 (#539, #546, #541, #544, #547):
edit= one method preset name (enum of 16METHODSkeys) +overrides: 52 allow-listedAbliterationPipelinekeyword arguments.identity= exact model id + revision (individual) or a config match rule (family);inherits,margins(spec path + digest),evidence,status.- Concept packs separately carry
ExtractionRecipe(direction method, layer selection, intervention layer, readout, steering scale, preserve list). Two recipe notions, one pipeline each.
2. What the runs exposed (evidence from this session)
| # | Observation | Consequence for the spec |
|---|---|---|
| 1 | E03 had to be hand-expanded into 24 overrides to run on Llama, and advanced's embed_regularization 0.5 silently differed from E03's effective 0.35 (pipeline default) |
Recipes as deltas over mutable presets are not reproducible. A recipe must carry its fully resolved parameters, with presets only as authoring shorthand |
| 2 | The small-model safeguards silently rewrote E03 (layers 5–9, 2 directions) | Any runtime adaptation must be either part of the recipe or a rejection; the applied plan must equal the recorded plan |
| 3 | KL optimization rolls back layers after the edit; random-control calibration had to reconstruct the final state from kl_restored_groups |
Distinguish intent (what the recipe asks) from the resolved edit (what was actually applied); record the resolved edit as a first-class artifact |
| 4 | Search required explicit layers; middle60 had to be translated by hand (6–24 for 32 layers) |
Placement needs one vocabulary: absolute indices, depth fractions, and named selector rules with parameters, all resolved per model and recorded |
| 5 | Qwen2.5-1.5B ties input embeddings to the output head, so projecting lm_head also edits embeddings |
Recipes need structural preconditions (tied embeddings, attention type, layer count, MoE) and per-structure choices, not just a model id |
| 6 | Extraction data (train split, chat template, prompt pairs) is not pinned in the recipe | A recipe must pin its inputs by digest (datasets, templates), or it is not reproducible |
| 7 | Capability scores were non-deterministic (temperature 1.0) and stock-vs-stock KL noise is not a margin | Evaluation belongs in a versioned evaluation profile (decoding, tiers, metrics, calibration method and evidence), referenced by digest |
| 8 | Global single-direction vs per-layer directions, extraction layer, direction method, chat template are separate decisions that interact | The edit has distinct, separately specifiable parts: direction source, placement, operator, strength, constraints |
| 9 | E03 = E02 + one variable; future work stacks techniques (abliterate, then repair adapters; concept edits; merges) | A recipe is an ordered pipeline of steps, not one call; steps are composable and individually versioned |
| 10 | Recipe and code drift: metadata fields appeared in #560; old checkpoints can't serve as references | Recipes need an engine compatibility declaration and a normalization version |
3. Requirements for v2
- Technique-neutral core. The core schema knows nothing about abliteration. Techniques (projection, steering, adapters/LoRA, fine-tuning, merging, quantization-aware edits, decoding-time interventions, distillation, future generation-time methods) plug in through a technique registry: id + version + parameter schema + normalizer + applier + resolved-record emitter.
- Normalized, fully resolved records. Authoring may use presets and defaults; the stored recipe is normalized: every effective parameter explicit, canonical ordering, canonical JSON digest. Presets become named, versioned authoring templates.
- Ordered steps.
pipeline.steps[], each{id, technique, version, params, placement, inputs, outputs, constraints}. Steps can depend on earlier steps' outputs (e.g. a repair adapter trained against the abliterated model). - One placement vocabulary.
placementis{layers: absolute | {fraction_window} | {selector: name, params}}, pluswriters(attention out, MLP out, embeddings, LM head, router, specific modules by role), resolved per model and recorded. - Inputs by digest. Datasets (prompt pairs, concept packs, calibration sets), templates and reference models are referenced by id + digest; the split role (train / tune / final-test) is explicit and checked.
- Target and structure.
target= individual identity or family match, plusrequiresstructural predicates (tied embeddings, attention kind, KV heads, MoE, layer and width ranges, dtype support); techniques may declare structure-dependent rules (e.g. "if tied embeddings, do not project the LM head unlessallow_tied_head_edit"). - Intent vs resolution. The recipe is intent. Applying it emits a resolution record (resolved layers, writers, ranks, restored groups, effective params, code commit, engine version) stored with the artifact and digest-linked to the recipe. Verification and calibration consume resolution records, never re-derive them.
- Evaluation profile. Separate, versioned, digest-referenced: endpoints, decoding (temperature, seed), tiers, margins, calibration method (random-direction control, noise floor), family defaults and individual overrides. Margins attach to recipe + target.
- No silent adaptation. Runtime safeguards are either expressed as recipe constraints or cause rejection; the engine never mutates resolved parameters.
- Lifecycle and evidence (kept from v1): status, search/confirmation/promotion evidence, inheritance with per-field provenance, family promotion rules.
- Compatibility and migration.
engine: {min_version, normalizer_version}; v1 recipes migrate mechanically to a singleabliteration.projectionstep; v1 stays readable. - Unify concept recipes. Concept-pack
ExtractionRecipebecomes thedirection_sourcepart of the projection/steering techniques, so concept edits and refusal edits share one recipe model.
4. Proposed v2 shape (sketch)
{
"schema": "obliteratus.model-recipe/v2",
"name": "llama3.1-8b-e03-reg03",
"version": "1.0.0",
"engine": {"min_version": "…", "normalizer": "recipe-normalizer/1"},
"target": {
"scope": "individual",
"identity": {"model_id": "meta-llama/Llama-3.1-8B-Instruct", "revision": "0e9e39f…"},
"requires": {"architecture": ["LlamaForCausalLM"], "tie_word_embeddings": false}
},
"inputs": {
"extraction": {"kind": "protocol_split", "role": "train", "dataset": "qwen38-v1",
"split": "train", "sha256": "…"},
"chat_template": {"kind": "chat_template", "role": "train", "source": "tokenizer", "sha256": "…"}
},
"pipeline": {"steps": [{
"id": "refusal-projection",
"technique": "abliteration.projection", "technique_version": "1",
"params": {
"direction_source": {"method": "svd", "n_directions": 4, "scope": "per_layer",
"winsorize_percentile": 0.01, "refinement": {"rdo": true}},
"operator": {"kind": "orthogonal_projection", "norm_preserve": true,
"regularization": 0.3, "row_fraction": 1.0},
"writers": ["mlp_out", "attn_out"], "embeddings": {"project": true, "regularization": 0.35},
"post": [{"kind": "kl_rollback", "budget": 0.5}]
},
"placement": {"layers": {"selector": "middle_fraction", "params": {"start": 0.2, "end": 0.8}}},
"inputs": ["extraction", "chat_template"]
}]},
"evaluation": {"profile": "profiles/llama3.1-8b.json", "sha256": "…"},
"status": "candidate",
"evidence": [{"kind": "search", "path": "…", "sha256": "…"}]
}
Resolution record (emitted at apply time, stored with the checkpoint):
{"recipe_sha256", "steps": [{"id", "technique", "resolved_params", "resolved_layers", "resolved_writers", "ranks", "restored_groups", "artifacts"}], "engine", "code_commit"}.
5. Work breakdown (proposed issues, for approval)
- Recipe v2 core schema + normalizer (P1): technique-neutral core, canonical normalization and digest, v1 reader and mechanical v1→v2 migration; registry interface for techniques.
- Technique registry +
abliteration.projectionv1 technique (P1): parameter schema, normalizer (expands presets into fully resolved params, eliminating implicit defaults), applier wrappingAbliterationPipeline, structure rules (tied embeddings). - Placement vocabulary + resolver (P1): absolute / fraction window / named selectors (middle_fraction, all_except_first, knee_cosmic, …) and writer roles, resolved per model.
- Resolution records (P1): emitted by every applied step, stored with the artifact, consumed by verify-edit, random-control calibration, confirmation and search.
- Evaluation profile v1 (P2): unify verify-edit spec + calibration method/evidence + family/individual margins into a versioned profile referenced by recipes.
- Inputs by digest (P2): dataset/template references with split roles and checks.
- Concept recipe unification (P2): concept packs'
ExtractionRecipemaps ontodirection_source; concept edits expressible as v2 steps. - Second technique to prove extensibility (P2): e.g.
steering.activation_addition(decoding-time) oradapter.lora_repair, implemented only through the registry. - Search/confirm/promote/--recipe on v2 (P2): migrate the tools to v2 and resolution records.
Ordering: 1 → 2/3/4 (parallel) → 5/6 → 9; 7 and 8 after 2. Current runs (Llama confirmation, Qwen search) continue on v1 and migrate mechanically.
6. Decisions (2026-11-19)
- Direction approved as written; file the issues and build.
- Second technique: LoRA repair adapter (multi-step pipeline, trained artifact).
- v1: read-only once v2 lands; v1 stays readable and migrates mechanically; new recipes must be v2.