Abliteration HandbookField guide
Methods

MLP down_proj abliteration

Most common permanent recipe for decoder-only LLMs (Llama, Mistral, Qwen architectures).

1 min read 3 examples Source-linked

In this chapter
On this page Interactive companion
Personal reading progress

0/4 sections reviewed

View original Markdown
Interactive companion

Explore the chapter map

Use the visual controls alongside the complete source chapter.

Most common permanent recipe for decoder-only LLMs (Llama, Mistral, Qwen architectures).

Target module#

Per transformer block:

Example
block.mlp.down_proj   # Linear: intermediate_size → hidden_size

The down projection writes directly into the residual stream — removing refusal write directions here is effective.

Math#

Given unit vector r ∈ ℝ^{d_model} and weight matrix W ∈ ℝ^{d_model × d_intermediate}:

Example
P_⊥ = I - r rᵀ
W' = P_⊥ @ W

Some recipes transpose depending on nn.Linear layout — verify dimensions in your framework.

Pseudocode#

python
import torch

def ablate_down_proj(W, r, alpha=1.0):
    # W shape: [d_out, d_in] = [hidden, intermediate] in PyTorch Linear
    r = r / r.norm()
    # Remove rows' component along r (output space of down_proj)
    proj = torch.outer(r, r)  # [hidden, hidden]
    return W - alpha * (proj @ W)

Apply per selected layer; save state_dict.

Validation#

  • W' shape unchanged
  • Forward pass on dummy input — no NaNs
  • Compare logits drift on benign prompt (should be small pre-abliteration)

Trace this chapter to its source.

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

methods/mlp-down-proj-abliteration.md
Inspect the source fingerprintSHA-256 8003d77ffb86681bfee9af625cd1d2d643ae8b9d10824f8ef14e8b230d958184Source commit 6fba7436a5914cad7c8f0835a14b480a29dac263