The pre-export refusal comparison judged harmless-refusal increases on
16 prompts against a 5% limit, so a single prompt changing (6.25%)
rejected edits that the 200-prompt verify-edit gates would judge. It
now rejects only when the paired Newcombe interval's lower bound
exceeds the limit (95% confidence by default), reports counts, rates
and bounds, and keeps the old point-estimate rule available as
refusal_check_mode: point. Both settings are v2 projection parameters,
normalized explicitly and recorded in resolution payloads and
checkpoint metadata. Also fixes the perplexity-weighting test, which
built a pipeline without the refusal sample attribute introduced in
46d6dc6 and failed in the full suite.
Fixes #587
5.1 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 records the individual stock and edited rates as
baseline_refusal_rate, baseline_harmless_refusal_rate, sampled_refusal_rate,
and harmless_refusal_rate. It records the increase used by the selected mode
as refusal_increase and harmless_refusal_increase.
refusal_check_mode: wilson(default) uses a paired Newcombe score interval built from Wilson bounds. Each pair must have a valid stock and edited completion. VERIFY fails before export if either split's lower bound exceedsmax_refusal_increase(default 0.05, or five percentage points).refusal_check_confidencedefaults to 0.95 and accepts values strictly between 0 and 1. One new refusal out of 16 harmless prompts does not by itself trigger the default gate.refusal_check_mode: pointuses the original difference between the two individual refusal rates and compares it directly to the same limit.
VERIFY includes the rates, denominators, and any paired bounds and flip counts
in its logs and rejection messages. The refusal_comparison quality metadata
records the estimate, bounds, and counts for each split. Set
max_refusal_increase to None to keep measurements with enforcement disabled.
A memory admission denial or OOM records a skip reason. A split needs at least
one complete pair in Wilson mode or a valid completion on each side in point mode.
For v2 projection recipes, set the mode and confidence in params.backend or
under params.overrides with preset shorthand. Resolution records include both
settings.
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.