Files
OBLITERATUS/docs/verification-diagnostics.md
Joseph Magly 46d6dc69aa feat(verify): fail VERIFY when an edit increases refusal
On Llama-3.1-8B a basic all-layer edit raised refusal from 88.7% to 99.3%
and benign over-refusal by 84.5 points, and the built-in VERIFY did not
fail it; only the separate verify-edit did.

The stock baseline now measures refusal on a bounded deterministic
sample of the evaluation harmful and harmless prompts
(refusal_baseline_size, default 32; 0 disables). VERIFY measures the
edited model on the same sample with the same generation settings and
rejects the run with PipelineQualityRejectedError when either rate rises
by more than max_refusal_increase (default 0.05; None measures without
rejecting). A baseline skipped for admission or memory records its
reason and never rejects. Both options are appended to the constructor
signature, and the refusal golden configs gain them.

The beam-output qualification test now disables the gate, so it keeps
asserting its original scoring and post-verify probe behaviour; the
gate itself is covered by tests/test_refusal_increase_gate.py.

Refs #537
2026-11-19 11:40:18 -05:00

4.2 KiB

Verification diagnostics

on_checkpoint_shard(path, name) receives each verified native-export shard after tensor release. Callback errors stop export. A configured callback requires a native export plan; its staging paths can disappear on rollback or promotion.

The verify stage records measurements. Its done status does not establish benchmark retention or quality acceptance. Existing hard perplexity and generation guardrails still apply.

kl_budget_status is within_budget, exceeded, or unavailable. Equality is within budget; missing, failed, or nonfinite measurements are unavailable. kl_budget_enforced=false records an advisory comparison that does not block export. When use_kl_optimization=true, correction measures the candidate after weight edits, including the output head. Exact rollback candidates comprise the weakest third of selected layers and the output head. Snapshot admission includes both. Temporary scoring restores the modified candidate even when measurement fails; failed restoration invalidates the model. Accepted restorations remain in kl_restored_groups, including when the remaining candidate exceeds budget. Final verification enforces the budget after all edits and installed hooks. Missing evidence or excess final KL fails before export. kl_budget_enforced=true records this requirement. The informed pipeline retains one pristine baseline through intermediate checks and releases it after final enforcement or failure. perplexity_increase is the candidate-to-pristine ratio, not a percentage. Reference and verification perplexity weight each loss by its shifted, unmasked causal target count. A sample without scored targets contributes no loss. Verification fails if no reference targets can be scored.

Before EXCISE, the pipeline samples up to refusal_baseline_size evaluation prompts in total (default 32). It spreads the sample across the harmful and harmless splits, favoring the harmless split when an odd slot is available. A size of 0 disables the comparison. VERIFY runs the same prompts with the same greedy generation settings. Both runs exclude invalid completions from their refusal-rate denominators.

VERIFY logs the stock and edited rates for each split and records baseline_refusal_rate, baseline_harmless_refusal_rate, sampled_refusal_rate, harmless_refusal_rate, refusal_increase, and harmless_refusal_increase. Either increase above max_refusal_increase (default 0.05, or five percentage points) fails VERIFY before export. Set the threshold to None to keep the measurements with enforcement disabled. A memory admission denial or OOM records a skip reason and leaves the gate unenforced. A split without valid stock or edited completions cannot trigger the gate.

Multi-direction norm preservation restores each recognized fused expert matrix once after the complete subspace projection, using the existing amplification cap. Dense and fused matrices follow the same requested norm policy.

Spectral collection uses a balanced per-class count:

min(max(20, ceil(max(30, ceil(sqrt(hidden_width))) / 2)),
    available_harmful, available_harmless)

Admission and collection use the same count and batch limits. Width 5120 requests 36 samples per class, 72 total. Small models retain the 20-per-class target. Collection is bounded by available evaluation prompts and does not retry automatically. The observed signal can require more samples than this initial dimensionality floor. Insufficient samples, invalid noise estimates, or failed layers remain inconclusive. spectral_samples_used, spectral_samples_required, and spectral_layers_completed/spectral_layers_expected expose evidence coverage. A measured RED layer remains RED even when another layer lacks evidence; missing layers cannot yield an overall GREEN result.

The spectral statistic measures a rank-one difference between two class means. It does not assess distributed signals, nonlinear behavior, or general safety. Its confidence field is an uncalibrated heuristic. The legacy certificate names and YELLOW enum remain compatible; the current estimator does not produce YELLOW. GREEN means only that the class-mean statistic did not exceed its heuristic threshold.