Abliteration HandbookField guide
Technique atlas

Layer-selective abliteration

Refusal signal is not uniform across depth. Middle layers usually dominate; early layers carry syntax; late layers align to surface refusal tokens ("I cannot…").

2 min read 5 examples Source-linked

In this chapter
On this page Interactive companion
Personal reading progress

0/9 sections reviewed

View original Markdown
Interactive companion

Plan a selective edit

Use the visual controls alongside the complete source chapter.

Refusal signal is not uniform across depth. Middle layers usually dominate; early layers carry syntax; late layers align to surface refusal tokens ("I cannot…").


Observation (empirical)#

Depth regionTypical role
0–25%Token/pos encoding, weak refusal
25–75%Refusal circuit — highest silhouette
75–100%Output logits, template phrases

Heretic searches this automatically via depth kernel — see kernel-shaping-depth-profile.md.


Manual strategy (llm-abliteration / research)#

Step 1 — Measure per-layer signal#

bash
pip install "heretic-llm[research]==1.4.0"
heretic <model> --print-residual-geometry
MetricInterpretation
Silhouette per layerHigher = better harmful/harmless separation
S(g,r) cosineProjected direction quality
PaCMAP clustersVisual check for outliers

Step 2 — Pick band#

Example
layers: start = L_peak - 4
        end   = L_peak + 4
Model depthStarting band (rule of thumb)
32 layers (Llama 8B)14–22
36 layers (Qwen3 4B)16–24
48 layers (Gemma 3 12B)22–34
80 layers (70B class)40–60

Always re-tune — architecture and chat template shift the peak.

Step 3 — Ablate and eval#

yaml
# llm-abliteration config.yaml
layers:
  start: 16
  end: 24
modules:
  - mlp.down_proj
  - self_attn.o_proj
strength: 1.0

Automated strategy (Heretic)#

Optuna searches:

  • Which layers receive non-zero kernel weight
  • max_weight_position — normalized depth of peak
  • min_weight_distance — kernel width
  • max_weight / min_weight — amplitude bounds

You do not need manual layer lists for production — use n_trials ≥ 120 and good eval sets.


ErisForge — quick prototyping#

When geometry is already known and you want a single-pass layer-band ablation without Optuna:

StepTool
1Heretic --print-residual-geometry or analyze.py → L_peak
2ErisForge AblationDecoderLayer on [L_peak-4, L_peak+4]
3ExpressionRefusalScorer quick check
4Handbook eval gates
bash
git clone https://github.com/Tsadoq/ErisForge.git && cd ErisForge && pip install -e .

ErisForge averaged -0.28 pp GSM8K on the arXiv:2512.13655 subset — lower model compatibility than Heretic; always re-eval on your checkpoint.

→ extended-abliteration-toolkit.md · ../instructions/advanced-abliteration-workflow.md Track K · mean-difference-direction.md


MLP vs attention#

TargetEffect
mlp.down_projPrimary refusal removal (Arditi recipe)
self_attn.o_projComplementary — sometimes reduces over-refusal
Both (Heretic default)Best general results

Manual research: ablate MLP-only first; add o_proj if harmful refusals persist.

→ ../methods/mlp-down-proj-abliteration.md · ../methods/attention-o-proj-abliteration.md


Partial strength per layer#

Instead of binary on/off:

Example
W'_ℓ = W_ℓ - α_ℓ · proj_{r_ℓ}(W_ℓ),   α_ℓ ∈ [0, 1]

Heretic kernel encodes continuous α_ℓ. Manual: partial-strength-abliteration.md.


MoE caveat#

Each expert has its own down_proj at every layer — layer band must apply to all experts in that band.

→ moe-hybrid-abliteration.md


Failure modes#

SymptomLayer diagnosis
Grammar breaksPeak too early — shift band later
Harmful still refusedBand too narrow or too late
Benign over-refusalBand too wide or amplitude too high
Code quality dropLikely layers 20–28 on 32L — reduce max_weight

Trace this chapter to its source.

The complete Markdown remains the editable source. This page adds navigation, typography, and a visual companion.

techniques/layer-selective-abliteration.md
Inspect the source fingerprintSHA-256 21ffdf1b9a274182847b13add6fc16d99dba375156a221d8f0882cb0ba2561f6Source commit 6fba7436a5914cad7c8f0835a14b480a29dac263