Skip to main content
Ablation studies are the core diagnostic tool in OBLITERATUS: systematically knock out one model component at a time, measure what breaks, and build a complete map of where specific behaviors live inside the transformer. Apply → evaluate → restore → repeat — for every layer, every attention head, every FFN block, and every embedding dimension range. The result is not a single number, but a ranked map: which components are load-bearing, which are redundant, and — when compared between a base model and its RLHF-tuned counterpart — which specific components encode the refusal behavior you want to locate or remove.

The four strategies

layer_removal

Zeros all parameters in one complete transformer layer. Measures how much overall capability depends on that layer.

head_pruning

Zeros the Q/K/V and output projection weights for one attention head. Locates which heads are part of behavioral circuits.

ffn_ablation

Zeros all weights in the MLP/FFN block of one layer. Identifies where factual knowledge is stored.

embedding_ablation

Zeros a contiguous range of embedding dimensions. Analyzes the structure of the representation space.

Strategy details

What it does: Sets all parameters (weights and biases) of a complete transformer layer to zero. The layer remains in the computation graph but becomes effectively a pass-through — input residual flows straight through unchanged.This is a “soft” removal. The layer is not physically deleted from the module list, so the forward pass still executes the same number of operations. For each ablation, the model is evaluated, then the original weights are restored before the next layer is tested.Enumeration: One AblationSpec per layer, named layer_0, layer_1, … layer_N-1.Use case: Identify which layers matter most to overall model capability. Layers that cause a large perplexity increase when removed are load-bearing; layers with minimal impact may be candidates for model compression or may be the location of behaviorally-specific circuits (e.g., refusal).What to look for: Plot perplexity delta per layer — early and late layers typically matter more than middle layers. When comparing a base vs. instruct model, layers where the delta diverges between the two are where alignment fine-tuning was most active.
What it does: Zeros the Q/K/V projection weights and the corresponding output projection slice for a single attention head, leaving all other heads in the same layer intact.Handles both fused attention layouts (GPT-2’s c_attn Conv1D, where Q/K/V are packed into a single weight matrix) and separate projection layouts (LLaMA, Mistral, Falcon’s q_proj/k_proj/v_proj/o_proj). The correct approach is auto-detected from the model architecture.Enumeration: One AblationSpec per (layer, head) pair, named layer_0_head_0, layer_0_head_1, … layer_N-1_head_H-1. Total specs = num_layers × num_heads.Use case: Locate behavioral circuits. Mechanistic interpretability research (Arditi et al., 2024) has shown that refusal behaviors in instruct-tuned models are often mediated by a small number of attention heads. Pruning every head individually lets you rank them by importance and identify the specific heads in the refusal circuit.What to look for: Most heads are redundant — their removal has near-zero impact. A small number (sometimes a single head) will cause a sharp perplexity spike when ablated. Cross-reference with the jailbreak or guardrail presets using a safety-probing dataset to find heads that specifically mediate refusal vs. general capability.
What it does: Zeros all parameters in the MLP/FFN sub-block of a specific transformer layer. The attention sub-block in that layer is left intact.Enumeration: One AblationSpec per layer, named ffn_layer_0, ffn_layer_1, … ffn_layer_N-1.Use case: Find where factual knowledge is stored. The “key-value memory” hypothesis (Geva et al.) treats FFN weight matrices as associative memories — each FFN block stores factual associations that are retrieved during the forward pass. Ablating FFN blocks is the most direct way to probe where specific knowledge (or specific trained behaviors) is concentrated.What to look for: Combine with a domain-specific evaluation dataset (not just wikitext perplexity) to find which FFN layers encode the knowledge domain you care about. For refusal research, compare the FFN impact profile of a base model vs. its RLHF fine-tune — the layers that diverge most are where alignment training injected refusal knowledge.
What it does: Zeros a contiguous chunk of dimensions in the token embedding matrix. The chunk width is controlled by chunk_size. For a model with hidden dimension d_model, the default chunk size is max(1, d_model // 16), producing 16 chunks of roughly equal width.Enumeration: One AblationSpec per chunk, named embed_dims_0_48, embed_dims_48_96, etc. (using chunk_size=48 as an example). Total specs = ceil(d_model / chunk_size).Key parameter — chunk_size:
  • Smaller values (e.g., 16) → more granular analysis, more ablations, slower
  • Larger values (e.g., 64) → coarser analysis, fewer ablations, faster
  • The jailbreak preset uses chunk_size: 16 for maximum resolution
  • The full preset uses chunk_size: 48
  • The guardrail preset uses chunk_size: 24
Use case: Analyze the structure of the representation space. Token embeddings are the model’s first interface with the input — the dimensions that matter most here reveal what the model uses to distinguish token types, topics, and tones. For refusal research, dimensions that spike in impact when ablated on safety prompts (but not neutral prompts) are part of the refusal-relevant embedding subspace.

How strategies work: enumerate → apply → restore

Every strategy follows the same three-step loop:
The model is never permanently modified during a study. Each ablation is applied, measured, and reverted. The original weights are saved before the first ablation and restored after each one.

YAML configuration

Strategies are declared in the strategies list of a study YAML. Each entry specifies the strategy name and optional params:
A complete study config with all four strategies:
The examples/ directory ships with ready-to-run YAML files: gpt2_layer_ablation.yaml, gpt2_head_ablation.yaml, and full_study.yaml. These are good starting points for adapting to your own model.

Python: strategy registry

Strategies are registered via the @register_strategy decorator and looked up at runtime through STRATEGY_REGISTRY:
To apply and restore manually:
Or use the built-in iterate helper, which applies + restores around each spec automatically:

CLI


Output: results.json

Every run writes results.json (plus results.csv and plots) to the configured output_dir. The JSON schema:
Each entry in results contains: The to_dataframe() method on AblationReport automatically computes {metric}_delta and {metric}_pct_change columns against the baseline for downstream analysis.
Results are also saved as results.csv (one row per ablation) and rendered as two plots: impact.png (bar chart of metric delta per component) and heatmap.png (pct_change heatmap across all strategies and metrics).