Applying sparse autoencoders to unlearn knowledge in language models

Eoin Farrell, Yeu-Tong Lau, Arthur Conmy

TL;DR

This paper explores whether Sparse Autoencoders (SAEs) can be used to cleanly and interpretably remove hazardous knowledge (such as bioweapons information) from large language models. The authors find that while clamping specific biology-related SAE features to negative values can successfully induce unlearning, doing so at scale currently introduces more collateral damage to unrelated knowledge than existing fine-tuning methods.

What Problem Does This Paper Address?

As language models grow more capable, they risk memorizing dangerous, toxic, or malicious information—such as advanced bioweapons protocols—that developers want to remove before deployment. Current unlearning techniques rely heavily on fine-tuning methods like Representation Misdirection for Unlearning (RMU). While effective, fine-tuning acts as an opaque "black box," shifting weights without providing clear insight into how the knowledge was removed or guaranteeing that it won't superficially resurface under adversarial prompting.

The authors investigate whether SAEs can provide a more transparent, interpretable mechanism for unlearning by targeting specific, human-understandable concepts directly within the model's internal activations.

Methods

Instead of modifying the model's weights, the authors perform inference-time interventions on internal activations using SAEs.

Standard ablation (simply setting a feature's activation to zero) proved ineffective for unlearning. Instead, the authors introduce a negative clamping technique: if a targeted feature activates ($f > 0$), they force its activation to a fixed negative value ($-c$).

Figure 1: An outline of how we use SAE features to intervene in the model. Selected feature activations fi are set to a negative value −c when fi > 0.

To find which features to target, they test two selection methods:

  1. Sparsity-based selection: Comparing feature firing rates on a "forget" dataset versus a "retain" dataset to isolate features unique to the hazardous domain.
  2. Feature Attribution: Using backpropagation gradients to identify which features most strongly influence the model's ability to output the correct answer for the targeted domain.

Datasets

The authors evaluated their approach on gemma-2b-it and gemma-2-2b-it using the following datasets:

  • WMDP-bio: The biology subset of the Weapons of Mass Destruction Proxy dataset, containing 1,273 multiple-choice questions on biosecurity, genetics, and virology. To ensure the model actually possessed the knowledge being tested, they only evaluated unlearning on questions the base model answered correctly across all 24 possible choice permutations.
  • OpenWebText: A general text corpus used to measure general language degradation (cross-entropy loss added over 50k tokens).
  • MMLU (Subset): Questions covering US history, geography, computer science, and human aging used to quantify collateral damage to unrelated knowledge.

Key Insights and Ideas

  • Zero ablation is not enough: Simply turning off a feature ($f=0$) does not make the model forget a concept; it merely reduces its confidence. To break the association and force unlearning, the activation must be actively driven into a negative regime.
  • Monosemantic features act as precise levers: The authors identified highly specific features—such as Feature #9163, which fires on concepts like "natural selection," "mutation," and "selective pressure"—that can be manipulated to alter the model's behavior on specific biology questions.
  • The Decoder Vector Matters (Sometimes): For gemma-2-2b-it, replacing the targeted SAE decoder vector with a random vector significantly degraded unlearning performance and increased general loss, proving that the specific targeted direction is critical. Interestingly, this directionality was less critical for the older gemma-2b-it model, suggesting that unlearning dynamics shift across model generations.

Key Results

  • Single-Feature Intervention: In a case study targeting a specific biology question, clamping Feature #9163 to values between -18 and -20 successfully drove the correct answer probability from >0.99 down to near zero, shifting the model's choice to an incorrect option while keeping general OpenWebText loss low.
Figure 4: Probabilities of answering A, B, C or D for question #841 (with correct answer A) as a function of the clamped activation value of feature #9163. Loss added is calculated over 50k tokens of OpenWebText. Question #841 is presented in Figure 3.
  • Multi-Feature Scaling: When scaling up to unlearn broader topics, intervening on 10 features was the sweet spot; targeting 20 or 50 features introduced significantly more general loss.
  • SAEs vs. Fine-Tuning (RMU): Compared to the fine-tuning baseline (RMU), SAE-based unlearning achieved similar levels of unlearning on WMDP-bio and actually showed lower loss added on general text (OpenWebText). However, it caused higher collateral damage on unrelated MMLU questions, meaning it inadvertently harmed unrelated capabilities more than RMU.
Unlearning performance comparison (MMLU accuracy vs WMDP-Bio accuracy) between SAEs and RMU.

Limitations and Future Work

The primary limitation of this method is that it is an activation-only patch. Because the underlying weights remain completely unchanged, the dangerous knowledge is still technically present in the model and could potentially be recovered or bypassed. Additionally, scaling the intervention to multiple features currently introduces too much collateral damage to unrelated tasks compared to fine-tuning.

The authors suggest three key directions for future research:

  1. Examining how SAE quality and dictionary width impact unlearning (e.g., wider SAEs might yield cleaner, more isolated features).
  2. Developing methods to translate these activation-level SAE interventions directly into permanent weight modifications.
  3. Investigating how downstream layers react to these negative clamping interventions to better understand the downstream mechanics of unlearning.

Summary updated

BibTeX
@inproceedings{farrell2024applying,
  author = {Eoin Farrell and Yeu-Tong Lau and Arthur Conmy},
  title = {{Applying sparse autoencoders to unlearn knowledge in language models}},
  booktitle = {SafeGenAi @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=i4z0HrBiIA},
}
Figure