1 Commits
Author SHA1 Message Date
Joseph Magly be6093dcb8 fix(abliterate): scale-aware layer selection with recorded diagnostics
Automatic layer selection ranked layers by raw activation-strength
scores, and the small-model cap kept the strongest N of the knee and
COSMIC union, so COSMIC's mid-network candidates could all be dropped.
On Qwen2.5-1.5B the default selected only layers 23-27.

- Rank candidates by strength normalized to each layer's activation
  scale (selection is invariant to per-layer rescaling); raw strengths,
  used for KL rollback ordering, and directions are unchanged.
- When the small-model cap applies, reserve a quota for COSMIC-only
  candidates instead of truncating purely by strength.
- Share one selection routine between both distillation paths.
- Record selection diagnostics (raw and normalized scores, knee and
  COSMIC candidates, caps applied, final layers) and effective direction
  counts and per-layer ranks in metadata; n_directions stays the
  requested value.

Fixes #533
2026-11-19 11:19:20 -05:00