Files
OBLITERATUS/docs/INITIAL_CORE_RUN.md
Joseph Magly 84381c09d8 docs(initial-run): audit matric-eval first and use per-model recipes
Capability checks now start by updating matric-eval to its latest main
and running audit-benchmarks --live, proceeding only on a clean audit
and recording the commit. A new section explains that recipes do not
transfer across models (evidence from the first local run) and walks
through the per-model workflow: calibrate margins, search on the tune
split, confirm once on the final test, apply with obliterate --recipe,
and promote a family only with confirmed members of two sizes.
2026-11-19 14:58:26 -05:00

10 KiB
Raw Permalink Blame History

Initial core abliteration run

This runbook proves the main abliteration pathway end to end on small models on a local 24 GB GPU (RTX 4090 class) first. Only then does it spend money on one rented H200 window for Qwen3.8-27B under an enforced cost cap. Every local step must pass before you rent.

It uses three commands:

  • verify-checkpoint: reload parity of saved checkpoints;
  • verify-edit: preregistered edited-vs-stock verification;
  • the Qwen3.8 campaign's enforced hard stop.

Run tests through the committed Nix flake (see NIX_TEST_ENVIRONMENT.md). Treat GPU-hours as cost units, not a schedule.

Before you start

  • Accept the model licences: Gemma 2, Llama 3.1, Qwen. Download the pinned revisions locally; verify-edit loads local files only unless --allow-download is given.
  • For cached stock models, pass the local snapshot directory (~/.cache/huggingface/hub/models--ORG--NAME/snapshots/<rev>/) as --stock / --stock-model. A Hub reference can fail offline snapshot resolution when non-weight files such as README/LICENSE are missing, even if weights and tokenizer files are cached. The directory must contain the model config, tokenizer and weights.
  • Freeze the verification margins: write the spec once, record its sha256, and pass --spec-sha256 to every verify-edit call. Margins can't change after you have seen results. Defaults are in verify-edit.md.
  • Export the extraction prompts disjoint from the held-out test set. By default obliterate extracts from all built-in pairs, which include the 200 held-out pairs verify-edit scores against:
obliteratus verify-edit --write-extraction-pairs runs/extraction-pairs.json

Local steps (free)

L1: GPU runtime gates and campaign dry run

The campaign needs a separate CUDA environment with qwen-hybrid kernels (flash-linear-attention/fla, causal-conv1d) and recovery (PEFT). Run setup first on the selected GPU; see toolkit/compiler choices. A project dev venv can lack fla; it also needs the recovery extra for the cuda-runtime recovery tests to run without skips. Use the setup venv directly; ordinary uv sync / uv run can restore CPU Torch.

bash scripts/qwen38_campaign_setup.sh --venv "$PWD/.venv-qwen38" --cuda-home /usr/local/cuda
campaign_python="$PWD/.venv-qwen38/bin/python"
"$campaign_python" scripts/run_conditional_gate.py cuda-runtime
"$campaign_python" scripts/run_conditional_gate.py bitsandbytes-runtime
"$campaign_python" scripts/qwen38_a100_campaign.py --root /data/qwen38-rehearsal --stages all --dry-run \
  --model-override Qwen/Qwen3.5-0.8B --rerun-seeds 0 --max-prompts 2 \
  --pain-pin /data/pain-axis-pin

The local dry run intentionally omits --hard-stop-hours: admission still uses production allowances (fetch 1 h, eval-stock 1.5 h, pain-axis 6 h), despite the smaller model and prompt count. A 2 h cap refuses stages; dry-run mode only reduces the default reserve, not those allowances. The advisory --budget-hours is not a timeout. Keep the enforced cap for the rental below.

Both gates must report zero skips, and the dry run must complete with receipts marked dry-run. Stop on failure.

L2: Concept gate

obliteratus concepts baseline refusal <model> --output-dir runs/<model>-gate \
  --device cuda --dtype bfloat16 --require-verdict warn

Run it for google/gemma-2-2b-it and Qwen/Qwen2.5-1.5B-Instruct. --require-verdict warn accepts pass/warn and exits 3 with reasons on fail, after writing validation.json and the direction artifacts. Stop that model on exit 3. Without this option, baseline remains report-only and can exit 0 on fail.

L3 and L4: Abliterate and record a reload reference

obliteratus obliterate <model> --method basic --device cuda --dtype bfloat16 \
  --prompt-pairs-file runs/extraction-pairs.json --record-reference \
  --output-dir runs/<model>-basic
obliteratus verify-checkpoint runs/<model>-basic --stock-model <stock-dir>

Repeat with --method advanced.

  • obliterate: its VERIFY stage must show refusal dropping, with perplexity no worse than 3× stock. VERIFY samples extraction-domain prompts, so it isn't independent validation; L5 is.
  • Layer placement: check strong_layers in abliteration_metadata.json. On small models the default knee_cosmic selection plus the small-model layer cap can select only the final layers (on Qwen2.5-1.5B it chose 23–27 and barely moved refusal; see issue #533). If that happens, pin a window explicitly with --layers (for example --layers 12-16 on a 28-layer model). --min-layer-fraction is a depth floor and --max-layer-fraction caps the count, so neither expresses a middle window, and middle60 is capped afterwards.
  • Comparing settings: choose layers or methods on the protocol's tune split (pass it to verify-edit with --heldout and a spec whose heldout.source is file), never on the final test set. Confirm the chosen setting once on held-out data afterwards.
  • verify-checkpoint: must exit 0 (exit 3 means the saved files don't reproduce the edit). A structural-only save never passes.

L5: Edited-vs-stock verification

obliteratus verify-edit --stock <stock-dir> --edited runs/<model>-basic \
  --spec runs/spec.json --spec-sha256 <digest> \
  --extraction-prompts runs/extraction-pairs.json --device cuda --dtype bfloat16 \
  --vllm-command "env VLLM_USE_FLASHINFER_SAMPLER=0 vllm serve {model} --host 127.0.0.1 --port {port} --served-model-name {served_name} --dtype bfloat16 --gpu-memory-utilization 0.80 --max-model-len 4096 --enforce-eager" \
  --output runs/<model>-basic/verify-edit.json

The exit codes mean:

  • 0: pass.
  • 1: a required endpoint failed.
  • 3: incomplete. A required endpoint is untested, for example because the matric-eval vLLM path didn't run. Fix it before renting.
  • 2: a usage, spec, digest or overlap error.

This step is also the first real check of matric-eval over vLLM; its own evidence covers only the Ollama smoke path. Install vLLM in its own environment, since it pins its own torch build. VLLM_USE_FLASHINFER_SAMPLER=0 avoids FlashInfer's startup kernel compilation, which fails when the system nvcc or host compiler doesn't match vLLM's CUDA build (seen with nvcc 12.4 and GCC 15 against a CUDA 13 vLLM). Leave GPU memory headroom for desktop processes. Stop if capability loss exceeds the margin for both methods.

Before any capability check, update matric-eval to its latest main (uv sync in its checkout) and run matric-eval audit-benchmarks --live --output-format json --output <file>. Proceed only when the audit reports no errors, and record the matric-eval commit with the run.

L6: 8B bridge

Repeat L3–L5 on meta-llama/Llama-3.1-8B-Instruct. Use --quantization 4bit only if bf16 doesn't fit, and expect the provisional quantized tolerances in verify-checkpoint. verify-edit has no quantization flag and loads in the requested dtype, so L5 still needs enough memory for that unquantized load (or suitable larger hardware). Record the decode throughput: it calibrates the rented window.

Per-model recipes

No single recipe transfers across models: on the first local run, the Qwen3.8-27B E03 recipe removed held-out refusal on Llama-3.1-8B but failed on Qwen2.5-1.5B, and pinned layers that worked on one model did nothing on the other. Treat each model (or confirmed model family) as needing its own recipe (MODEL_RECIPES.md):

  1. Calibrate that model's margins: obliteratus verify-edit --calibrate measures the stock noise floor and suggests thresholds; review, adopt and freeze the spec by digest.
  2. Search on the tune split only: obliteratus recipe search <grid.json> runs a preregistered, digest-locked candidate grid and writes a candidate recipe.
  3. Confirm once on the final test split: obliteratus recipe confirm accepts the recipe or keeps it a candidate; the test set is not reused.
  4. Apply it with obliterate --recipe. A family recipe needs confirmed members of two different sizes (obliteratus recipe promote).

Rented window (one H200 141 GB)

Rent only after L1–L6 pass. Use the cheapest available single-H200 quote, then pass the real rate and the time already used on the box. Repeat campaign setup on the rental host and set campaign_python to its setup venv interpreter.

"$campaign_python" scripts/qwen38_a100_campaign.py --root /mnt/qwen38-campaign --stages all \
  --pain-pin /mnt/pain-axis-pin \
  --budget-usd 250 --usd-per-gpu-hour <rate> --hard-stop-hours 34 --reserve-hours 2 \
  --elapsed-offset-hours <hours-since-instance-start>
  • Stage order: stages run in priority order: preflight, fetch, stock evaluation, E03 edit, reruns, report, then the optional load-path, pain-axis and multistep stages.
  • The stop is enforced:
    • a stage that won't fit before the deadline minus the reserve is refused;
    • at the deadline, the running stage's process group is stopped and recorded as stopped_by_budget, keeping its evidence;
    • a budget stop exits 75, and --resume continues in a later window (pass the cumulative --elapsed-offset-hours).
  • Reload check: the campaign's own reload gate covers the rented checkpoint, because the campaign edits through its own stages rather than obliterate --record-reference.
  • Capability check: run verify-edit stock vs E03 on the box if time remains. Otherwise copy the checkpoint out and run it later on suitable hardware.

Stop and tear down if bring-up and fetch take more than 3 GPU-hours, the stock evaluation fails, or the E03 edit fails its quality gate. Always copy out the campaign root, including receipts, the budget session JSON and reports, before tearing down.

What a credible first result is

A Qwen3.8-27B abliterated checkpoint that meets all of these:

  • refusal removed on held-out prompts;
  • collateral, KL and capability within the frozen margins;
  • reload from disk reproduces the edited behaviour;
  • the #333 load-path parity holds.

Results from fixture or dry-run stages are software checks only and never count as model evidence.