Abliteration HandbookField guide
Technique atlas

Mean-difference refusal direction (DIM / Arditi)

Refusal is associated with a shift in average activation. Estimate that shift per layer.

1 min read 1 examples Source-linked

In this chapter
On this page Interactive companion
Personal reading progress

0/5 sections reviewed

View original Markdown
Interactive companion

Explore the geometry

Use the visual controls alongside the complete source chapter.

Idea#

Refusal is associated with a shift in average activation. Estimate that shift per layer.

Procedure#

  1. Collect two prompt sets of equal size (N ≥ 64 recommended):
    • Set A — prompts that elicit refusals on the base model
    • Set B — unmatched harmless prompts that get compliance (alpaca-style; not topic-matched pairs)
  2. Run forward pass; hook residual at layer ℓ (post-block or post-MLP — pick one)
  3. For each prompt, take hidden state vector h at chosen token position
  4. Compute:
Example
μ_A^ℓ = mean of h for Set A
μ_B^ℓ = mean of h for Set B
r_ℓ    = (μ_A^ℓ - μ_B^ℓ) / ||μ_A^ℓ - μ_B^ℓ||
  1. Store {r_ℓ} for all layers you intend to modify

Dataset tips#

  • Default: unmatched harmful vs alpaca-style harmless (Petrov 2026, arXiv:2603.22061: topic-matched pairs can cancel r)
  • Topic-matched pairs ("Write a story about X" vs "Write explicit content about X") are an experiment, not the baseline
  • Avoid duplicate near-copies — biases mean

Outputs#

  • directions.pt or JSON: {layer_idx: [d_model floats]}
  • Metadata: model revision, hook point, token index strategy

ErisForge ExpressionRefusalScorer#

ErisForge implements the same mean-difference intuition with a built-in scorer — useful for quick layer-band experiments without writing custom hooks:

  1. Collect harmful/harmless sets (unmatched by default; or use upstream examples).
  2. Compute per-layer separation signal.
  3. Apply AblationDecoderLayer on the peak band only.

Pairs with layer-selective-abliteration.md and extended-abliteration-toolkit.md.

For deeper mechanistic control (caching, temp hooks), use FailSpy/abliterator → beyond-single-direction.md.

Trace this chapter to its source.

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

techniques/mean-difference-direction.md
Inspect the source fingerprintSHA-256 c52de82480ca495851fb6b8270515da328219ffd105ba44cac32122bd2cfa941Source commit 6fba7436a5914cad7c8f0835a14b480a29dac263