Files
OBLITERATUS/docs/UI_READINESS.md
Joseph Magly 002e6e56e1 feat: complete local readiness across UI, MCP and memory admission
Integrate bounded admission, UI ownership and controls, opt-in durable MCP execution, rank-local TP2 groundwork, regression hardening and operator guides. Physical larger-memory and two-host qualification remain separate.
2026-10-20 17:58:20 -04:00

273 lines
28 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Local UI controls and feature scope
Use **Obliterate** for preset-driven editing and **Concept Lab** when you need to
inspect validation, compare reversible interventions, or preserve another
direction. Start with a small dense model and the preset defaults. Selecting a
larger model or more directions is not evidence that your hardware can run it.
## Choosing controls
| Control | Default and selection guidance |
| --- | --- |
| Model | Use a local checkpoint or a permitted Hub model. Gated models require access and a token. Native FP32 needs about four bytes per parameter before activations and temporary copies. |
| Method / technique toggles | Start with Advanced and its defaults. Changing the method resets advanced settings. Refusal-specific informed/Qwen presets do not apply to other concept packs. |
| Prompt volume / dataset / custom prompts | Refusal only: start with 33 for a quick check, then increase for a less noisy direction estimate. Custom prompts override the dataset. Concept packs use their complete corpus and reject these overrides. |
| Quantization / dtype | Auto retains memory-driven quantization and existing dtype selection. Native weights give the clearest weight-edit semantics. BF16 needs supported hardware. Quantized loading does not qualify every edit or export backend. |
| Directions / extraction method | One direction is the simplest experiment; SVD can estimate several. More directions can remove more neighboring behavior. `fisher_lda` is the Fisher direction; `leace_exact` is a different estimator. Neither selector alone requests mean-centered affine erasure. |
| Regularization / norm preservation | Regularization 0 gives full requested removal; 1 retains weights. Norm preservation controls matrix magnitude after editing, not preservation of a named behavior. Keep preset values until comparing an explicit hypothesis. |
| Refinement / reflection / advanced surgery | Additional passes take more time; aggressive reflection and combined surgery can damage coherence. These controls implement distinct methods and are not interchangeable strength sliders. Compare generations and verification, not just refusal rate. |
| Verify sample size | Larger samples reduce sampling uncertainty at extra generation cost. A low refusal rate is an observed heuristic metric, not a safety or quality certificate. |
| Per-Expert Directions | Relevant to supported MoE architectures. Expert-local estimates need routed activation coverage; shared experts/attention retain shared geometry. A checkbox does not establish support for every MoE layout. |
Concept Lab uses **CPU / FP32**, including extraction, preview and evaluation.
Choose a small dense model and allow ample host RAM: the weights are only the
baseline, and evaluation/repair may keep writer snapshots. This tab is not a
72B multi-GPU workflow. Non-refusal dense-model restrictions still apply.
The built-in refusal corpus has 842 pairs. The UI resolves both `512 (large)`
and `842 (built-in max)` explicitly; selecting the maximum requests the full
built-in corpus rather than falling back to the fast sample. Larger datasets
and `all` need more probing time and activation storage.
1. **Define / Extract / Validate**: use seed 42 for repeatable sampling. The pack
defines its extraction corpus and recipe. The gate measures whether the
extracted direction discriminates the declared concept; a failed gate needs
an explicit override reason before applying it.
2. **Mode**: `project` installs reversible activation removal; `steer` adds a
direction during inference; `orthogonalize` edits supported residual writers;
`lora` expresses supported weight changes as a reversible adapter. Weight
edits are independent of token-position selection.
3. **Layers / positions**: start with `intervention` and `all_tokens`. Other
selectors are `extraction`, `all`, and `band(a,b)`. `final_token` scopes hook
intervention positions; it does not limit permanent weight changes.
4. **Coefficient / steering scale**: projection defaults to +1 removal; steering
defaults to −1 away from the concept, with positive doses moving toward it.
`recipe` keeps the pack's scale; `residual_norm` multiplies a unit direction by
activation norm; `raw` adds the unit direction directly; `vector` adds the
unnormalized stored vector. Magnitudes across these scales are not comparable.
Start with a small dose and compare against zero. Select `recipe` when using
another mode.
5. **Rank-k / reference**: leave rank-k off and reference `zero` for the original
single-direction edit. Rank-k removes the saved independent subspace and needs
that artifact geometry. `mean` uses saved control means for affine removal;
it supports project/orthogonalize, not steering or LoRA. Unsupported writer
bias/post-norm layouts fail explicitly; use inference-time project when
permanent affine surgery is unsupported. LoRA permits zero-origin subspaces.
6. **Preserve directions**: blank retains the pack recipe. Enter one local
direction safetensors path or `refusal` per line to replace those defaults.
Refusal is extracted on the pristine loaded model, adding probe work. The edit
is restricted to the protected span's orthogonal complement. Full overlap
produces an identity edit, not successful erasure. Protection is geometric;
evaluate behavioral preservation separately. Expert-local directions cannot
be combined with preservation, rank-k or affine geometry in the core API.
7. **Input embeddings / tied policy**: leave off initially. Supported weight
modes can also remove the initial residual direction. Tied embeddings require
`edit_both` (also changes the output head) or `untie` (keeps the output head and
needs additional weight storage).
8. **Evaluate / Repair / Export**: preview text is anecdotal. The steering dose
ladder uses the selected scale and reports refusal/invalid-output observations
on the preview prompt. The collateral battery is separate. Its sample size
defaults to 320 and completion limit to 48; smaller samples can be
inconclusive. Repair is a bounded candidate ladder, not guaranteed recovery.
Evaluate before exporting; explicit reasons are required for failed gates or
collateral exceptions. Retaining the original after incomplete repair is an
operator choice, not a successful repair result.
Ordinary repair captures the selected layer selector, rank-k basis and affine
reference along with the pristine writers. Its LoRA restoration stays in that
eraser's kernel and leaves edited affine biases in place. Retained-fraction and
rollback candidates deliberately trade removal strength against coherence, so
an accepted repair can reduce the original edit's strength. Compare the final
mechanistic/evaluation evidence; a repair result does not certify complete
erasure. Protected-direction repair separately replays its recorded intervention
with the protected span.
Memory admission warnings describe unavailable or uncertain memory evidence.
They do not change a concept validation verdict or prove benchmark correctness.
Strict admission can refuse unqualified Concept Lab workspaces. Closing a
session removes its temporary artifacts; download needed exports first.
## Advanced control reference
The defaults below are the initial **Advanced** preset, as resolved by
`app._get_preset_defaults` from `obliteratus.abliterate.METHODS`. Selecting another
method replaces them. Informed uses its own analysis-driven settings; the Qwen
promotion presets use immutable experiment settings and ignore mutable advanced
overrides. Sliders for an optional technique do not enable that
technique; keep the associated toggle off unless intentionally testing it.
More probing, passes, search trials and retained activations increase runtime
and workspace beyond baseline model storage.
| Advanced control | Initial default | Purpose, choice and limits |
| --- | --- | --- |
| Directions | 4 (range 1–8) | Number of extraction directions. Start with the preset; extra directions may remove neighboring information and need enough contrast examples. |
| Direction Method | `svd` | `diff_means` gives a simple mean contrast; `svd` supports multiple directions; `fisher_lda` and `leace_exact` use covariance information. `leace` is a deprecated alias for Fisher LDA, not exact LEACE. |
| Regularization | 0.3 (0–1) | Retained weight fraction: lower removes more; 1 leaves weights unchanged. Sweep this instead of guessing a strong value. |
| Refinement Passes | 2 (1–5) | Repeat the preset's refinement procedure. More passes cost time and may increase collateral effects. |
| Reflection Strength | 2.0 (0.5–3) | Inversion multiplier when inversion is enabled; 2 reflects the component. It does not enable Invert Refusal. |
| Embed Regularization | 0.5 (0–1) | Moderates embedding projection when enabled; larger values preserve more. Editing embeddings can affect every input, not only tested prompts. |
| Steering Strength | 0.3 (0–1) | Magnitude for the legacy Activation Steering technique. This differs from Concept Lab's signed coefficient and explicit scale. |
| Transplant Blend | 0.3 (0–0.5) | Capability-to-safety-expert blend when Expert Transplant is enabled. Requires a supported MoE layout; it has no dense-model interpretation. |
| Spectral Bands | 3 (2–8) | DCT band count for Spectral Cascade. More bands change decomposition granularity and add work. |
| Spectral Threshold | 0.05 (0.01–0.2) | Energy stopping threshold for enabled cascade; compare measured results when changing it. |
| Verify Sample Size | 30 (10–200) | Refusal verification generations. Increasing it costs generation time; this is separate from the Concept Lab collateral sample size. |
| Layer Selection | `all` | `all` covers every decoder layer; `all_except_first` skips the first; `middle60` restricts the middle band. `top_k`, `knee`, and `knee_cosmic` use measured direction structure. A selective edit need not eliminate the concept at unedited layers. |
| Winsorize Percentile | 1.0 (0–1) | Tail parameter for activation clamping when enabled; 1 disables clamping, 0.01 corresponds to the 99th percentile. Leave at preset unless studying outliers. |
| KL Budget | 0.5 (0–2) | Divergence budget for enabled KL optimization in supporting methods. It is not a universal capability guarantee. |
| Bayesian Trials | 50 (10–200) | Optuna TPE trial count for supporting optimized/Heretic search. More trials perform more candidate evaluations and can be expensive. |
| SAE Features (slider) | 64 (16–256) | Feature count for enabled SAE targeting in supporting methods. Distinct from the SAE Features checkbox. |
| Technique toggle | Initial default | Purpose and selection limits |
| --- | --- | --- |
| Norm Preserve | On | Rescales edited matrix norms. Preserves magnitude, not a named behavior. |
| Project Biases | On | Includes supported bias tensors in projection. Architecture support still applies. |
| Chat Template | On | Formats contrast prompts with the tokenizer's conversation template. Prefer for instruct checkpoints with a valid template. |
| Whitened SVD | Off | Changes extraction using whitened activation geometry. Compare against ordinary SVD; covariance estimation needs representative data. |
| Iterative Refinement | Off | Re-probes edited activations during refinement rather than only reusing the original estimate. Adds forward passes. |
| Jailbreak Contrast | Off | Uses jailbreak contrast in supported refusal extraction/refinement. Refusal-specific; do not assume it targets another pack's concept. |
| Layer-Adaptive Strength | On | Changes projection strength by layer evidence. Keep on for the Advanced preset; inspect results before overriding uniformly. |
| Safety Neuron Masking | Off | Restricts supporting surgery to selected neuron components. It is an estimated mask, not proof that remaining neurons are unaffected. |
| Per-Expert Directions | Off | Extracts local directions for supported routed experts; needs activation coverage per expert. Shared modules still use shared directions. |
| Attention Head Surgery | Off | Targets selected attention heads in supporting methods; may change attention-dependent capabilities. |
| SAE Features (checkbox) | Off | Enables the supporting SAE feature technique; its feature count is the separate slider. |
| Invert Refusal | Off | Enables inversion rather than ordinary component removal; Reflection Strength sets its magnitude. |
| Project Embeddings | Off | Also changes input embeddings in supporting methods. Broader input effects warrant separate evaluation. |
| Activation Steering | Off | Installs the legacy runtime steering technique. The hooks must remain installed to affect generation; it is not an equivalent standalone weight export. |
| Expert Transplant | Off | Enables supported MoE expert capability blending. Unsupported layouts cannot be made compatible by changing the blend. |
| Wasserstein-Optimal Dirs | Off | Requests the supporting Wasserstein direction refinement. This is not supported for non-refusal concepts. |
| Spectral Cascade | Off | Enables frequency-selective DCT surgery controlled by Bands and Threshold. |
| Winsorize Activations | Off | Clamps activation outliers before extraction; Percentile sets the tail cutoff. |
| KL Optimization | Off | Searches projection strengths under the configured KL budget in supporting methods; adds evaluations. |
| Float Layer Interpolation | Off | Interpolates adjacent layer directions for supporting Heretic-style search. Does not add physical model layers. |
| RDO Refinement | Off | Uses gradient-based direction refinement; costs additional computation and memory. |
| CoT-Aware | Off | Residualizes estimated reasoning-critical directions. Geometric protection is not a guarantee of preserved reasoning accuracy. |
## Chat, comparison and evaluation controls
| Control / tab | Default | How to choose and interpret it |
| --- | --- | --- |
| Cached Models (Chat and A/B) | Session-dependent list | Loads a saved session checkpoint into the shared slot. Select the intended model explicitly before comparing it. A retained checkpoint can be reloaded after evaluation unloads chat. |
| System Prompt | Chat requests direct uncensored answers; A/B requests helpful direct answers | Edit to match your experiment. Both A/B sides receive the same A/B system text. Changing system prompts confounds comparisons across runs. |
| Temperature | 0.7 (0–1.5), both tabs | Lower reduces sampling variability; zero requests greedy behavior. Higher values can reveal diverse output but increase noise in comparisons. |
| Top P | 0.9 (0–1), both tabs | Sampling nucleus mass. Keep fixed when comparing methods; it primarily matters during sampling. |
| Max Tokens | Chat 512 (32–4096); A/B 256 (32–2048) | Completion limit, not an input context limit. Increase for longer answers within model/device capacity; more tokens increase runtime and KV cache. Truncated answers are not complete evaluations. |
| Repetition Penalty / Rep Penalty | 1.0 (1–2) | 1 disables the penalty. Increase modestly for looping output; it changes token probabilities and can distort language. |
| Context Length | 2048 (128–32768), both tabs | Maximum input tokens. Increase for longer conversations only within the checkpoint's supported context and available memory. The slider maximum is not a model capability claim. |
| A/B Your Message / Send | Same user text to original and edited | The original is loaded for the message then freed. Two stochastic responses do not isolate the causal effect of editing; repeat with fixed decoding. Pair residency may require substantial host RAM. |
| Multi-Method Target Model | Qwen2.5-0.5B Instruct | One model, several independently run methods. Use a small checkpoint first to estimate runtime. |
| Methods to Compare | basic, advanced, spectral_cascade, surgical | Compare an explicit hypothesis; additional methods require additional load/edit/evaluate work. Scores apply to this dataset and configuration. |
| Multi-Model Models to Test | Qwen2.5-0.5B and 3B Instruct | Runs the selected method across selected models. Models have different capacities and tokenizers; raw metrics do not automatically establish a fair ranking. |
| Multi-Model Abliteration Method | surgical | Keep one method fixed for the cross-model comparison. Changing method and model together prevents attributing a difference to either. |
| Benchmark / sweep Prompt Volume | 33 (fast) | Small initial signal for runtime checks; increase for direction estimation after inspecting coherence. Dataset choices must remain fixed for meaningful comparisons. |
| Benchmark / sweep Dataset Source | Built-in | Selects contrast data; external sources may need network access and additional permissions. This does not turn measured prompts into an independent generalization test. |
| Benchmark / sweep Quantization and Compute dtype | Auto | Follow the same loading choices as Obliterate. Hold precision fixed when attributing differences to method strength. |
| Benchmark Load Result into Chat | Available completed results | Loads a chosen saved output; completion of a run is not evidence it is the best model. Review its metrics and invalid-output counts first. |
| Benchmark CSV / visualization | Generated after completed results | Retains descriptive metrics and comparisons. Keep logs/configuration with exports; charts do not remove uncertainty or missing measurements. |
| Quick Presets | GPT-OSS 20B Shootout, MoE Cross-Architecture, Speed vs Quality buttons | Runs the named configured comparison using the dataset/volume selectors. A GPU name in a preset hint is not a fit guarantee; admission and the actual allocation still apply. Larger presets can substantially increase probing/search cost; read the log for the work performed. |
| Sweep Model / Method | Qwen2.5-0.5B Instruct / Advanced | Explores regularization for one method/model pair. It does not sweep every advanced parameter. |
| Sweep Points | 6 (3–15) | Number of regularization values from 0 (full requested removal) through 1 (retain weights). More gives finer sampling at greater runtime. The plotted tradeoff is observed, not an automatically certified optimum. |
| Tourney Target Model | Qwen3-4B | Holds model identity fixed while comparing methods over successive rounds. Budget for repeated loads and edits. |
| Methods to Compete | All listed methods | Select at least three. Elimination can discard methods after reduced-prompt screening; a champion is relative to these competitors and the heuristic score. |
| Tourney Dataset Source / Quantization | Built-in / `none` | Keep dataset fixed; choose `4bit` or `8bit` only with compatible runtime support. Quantized tournament results do not certify native-weight behavior. |
The GPU refresh selector only changes telemetry polling; it does not reserve GPU
memory or increase the allocation. Export/download and Hub publication use the
selected completed model; publication requires the repository/token permissions.
Gate publication acknowledgement, collateral-failure reason, and incomplete
repair acknowledgement record explicit choices, not improved measurements.
Optional pre-push refinement edits the model again: its enable checkbox defaults
off, regularization to 0.1 and extra passes to 0 (skip). Choose 1–3 passes to
request additional work. This refusal-only pipeline reloads FP16 weights with
automatic placement and uses up to 33 paired dataset prompts. Custom prompt
sessions fall back to the built-in dataset. Concept checkpoints targeting another
behavior are blocked from Quick Refiner; disable refinement to upload them or
use Concept Lab's evaluate/repair workflow. Allow room for weights, activations
and temporary edit copies; this action does not retain the original checkpoint
as a separately selectable baseline.
Refinement owns the model slot and can be cancelled cooperatively; publication
starts automatically after refinement and cleanup succeed. Evaluate a separate
run first if you need to inspect its changes before publishing. Uploading a completed artifact
without refinement does not require a model slot.
## Placement and lifecycle guarantees (#289–#293)
Automatic placement passes the **same bounded `max_memory` mapping** to model
loading and its load-admission check. The mapping includes per-device headroom
and host offload limits; an explicit utilization/ceiling request cannot take the
unbounded quantized-fit shortcut. Explicit CPU and single-device paths retain
their device policy. Multi-device/offload placement is budgeted per device:
free space on another GPU does not excuse one device exceeding its limit.
Admission still distinguishes estimated/unknown demands from measured runtime
capacity. See [phase admission](phase-memory-admission.md) for policy and bypass
semantics and [capacity planning](capacity-planning.md) for config-only plans.
A/B accounts for the original and edited resident pair together. Failure to load
the original does not release the edited model's lease; after freeing the
original the lease is resized to the remaining edited model. A dispatched model
keeps its placement rather than being moved as though every weight were resident
on one device. Chat and A/B generation must cooperatively stop and the generation
thread must join before tensors are reclaimed. Closing a stream requests
cancellation at a generation/pipeline boundary; an active kernel can delay that
boundary, and the slot remains occupied until it is safe to free resources.
One A/B claim covers both generations and the transition between them, including
deferred cleanup; another model operation cannot enter between the two phases.
Fallback re-abliteration observes cooperative cancellation as well. Successful
CPU-offload reload backing directories belong to the active session: unload
removes only owned backing after the model is no longer live. Failed/replaced
loads clean their own resources; active offload backing is not a stale-cache
candidate. This is separate from the saved reloadable checkpoint's lifetime.
Benchmark, multi-model benchmark, strength sweep and tournament hold the same
exclusive model slot used by chat, load and edit. Starting evaluation frees the
resident chat tensors under that ownership; other slot users wait or receive a
busy response until completion/cancellation cleanup. Memory warnings appear in
the relevant run log and retain their qualification/bypass meaning. They are
not successful capacity checks, model quality scores, or new concept-gate
PASS/FAIL outcomes. The operator-UI conditional gate selects marked app lifecycle
tests as well as its dedicated conditional test file.
Tournament worker processes share cancellation and progress through the Space's
filesystem. The UI retains their session directory until remote execution has
joined. Separate hosts require a shared filesystem; a local thread event cannot
be serialized for remote dispatch. The Python runner rejects that unsupported
combination with guidance to use `TourneyCancellation`. CPU serialization tests
do not qualify hosted ZeroGPU hardware or large-model execution.
## Concrete parity inventory
This inventory distinguishes controls available in this checkout from core or
research entry points that need a separate operator workflow.
| Capability | UI coverage | Remaining scope and exact entry point |
| --- | --- | --- |
| Capacity planning / 72B placement | Guarded model loads use runtime admission and bounded automatic placement. | No config-only plan editor/viewer or qualified 72B run launcher. `obliteratus.capacity_planning.meta_inventory`, `Workload`, `plan_capacity`, `maybe_plan`; see [capacity planning](capacity-planning.md). Explicit per-device budgets, phase/export/snapshot evidence and measured runner qualification are needed; aggregate VRAM is insufficient. |
| Concept packs | Obliterate selection with enforced gate; Concept Lab define/extract/validate/evaluate/export. | Import/authoring and advanced extraction recipes remain pack/CLI work: `ConceptRegistry`, `ConceptPack.to_target`, `obliteratus.concepts.cli`. Local pack paths use verified local/cache inputs. |
| Raw steering | Concept Lab exposes recipe/residual_norm/raw/vector and preserves scale in dose evaluation. | Importing an arbitrary portable direction directly instead of extracting a pack is not a UI workflow. `ConceptDirection.load`, `apply_concept_intervention(..., scale=...)`. |
| Preservation | Concept Lab accepts refusal and direction paths; pack defaults are honored. | No separate repair-only protection selector or cached refusal shortcut: `AbliterationPipeline(preserve=..., refusal_direction=..., repair_preserve=...)`; `load_preserved_directions`. |
| Rank-k / affine | Concept Lab exposes saved subspace removal and zero/mean reference, with compatibility checks. UI rank-k requires a saved basis at every selected layer's resolved extraction source, and refuses missing bases before capture. | No manual mean/provenance tensor editor, embedding geometry selector, or partial-row projection control: `apply_concept_intervention(subspace=..., reference=..., reference_means=..., reference_provenance=..., embedding_geometry_layer=..., projection_row_fraction=...)`. Mean reference requires valid saved means; input-embedding projection supports zero reference only. The lower-level core API has a rank-one fallback; the explicit UI rank-k selector does not silently use it. Inspect recorded rank before claiming multi-direction erasure. |
| Recovery | Concept Lab's existing evaluate/repair ladder and export acknowledgement. | General LoRA/QLoRA recovery training, corpus building, distillation, adapter reload and paired recovery assessment remain separate: `obliteratus.recover.recover`, `RecoveryConfig`, `build_recovery_dataset`, `build_self_distillation`, `assess_recovery`. They need pinned data/provenance, training device checks and baseline retention; see [recovery](recovery.md). The Qwen tune-only preset is not this trainer. |
| Per-expert MoE | Obliterate has per-expert extraction toggle and core architecture checks. | No expert coverage inspector or router-edit selector in Concept Lab: `AbliterationPipeline(per_expert_directions=..., project_router=...)`; `apply_concept_intervention(project_router=...)`. Shared rank-k/affine geometry cannot substitute for missing expert geometry. |
| Multi-step editing | One extracted direction and at most one intervention per Concept Lab session. | `scripts/multistep_edit_order.py` (`arm_steps`, `main`) is a research comparison harness that reloads pristine models and compares edit orders; it is not a reusable UI sequencing executor. A product workflow needs per-step provenance, baseline/evaluation ownership, rollback and cancellation. |
| GSQ | No GSQ execution control; ordinary UI quantization is a different workflow. | `obliteratus.gsq.workflow.render_gsq_config`, `run_quantization`, `validate_checkpoint`, `assemble_checkpoint` manage a pinned external checkout/interpreter and a single-GPU run. This needs separate process/resource ownership, artifact validation and cancellation before safe UI integration; see [GSQ](gsq-quantization.md). |
CPU regression checks validate wiring, option propagation and compatibility with
fixtures and mocks. They do not certify GPU runtime capacity or model efficacy.
## Local single-GPU checks
The development CUDA gate passed 25 tests on an RTX 4090, including ten generated
tiny-model UI cases: uninterrupted A/B ownership, resident and mixed CPU/disk
offload, abandoned generation, original-reference release, stale restoration,
bounded loading, zero-ceiling rejection and offload-storage lifetime. Admission
and tensor placement were observed through real loads and CUDA forward calls;
the default local lifecycle publisher ran without an external broker.
The callback tests execute the actual function body without Spaces decorators
or browser/Gradio transport. The separate CPU operator-UI gate passed 57 cases.
These observations do not qualify a broker grant, hosted ZeroGPU, multiple GPUs,
large-model pair capacity, quantized UI chat or model efficacy. CUDA recovery
checks additionally require real completed optimizer updates and nonzero finite
adapters; see [recovery](recovery.md). For the distinction between execution and
quality, see the [hardened-model pilots](HARDENED_MODEL_PILOTS.md).