Steering Language Model Refusal with Sparse Autoencoders

Kyle O'Brien, David Majercak, Xavier Fernandes, Richard G. Edgar, Blake Bullwinkel, Jingya Chen, Harsha Nori, Dean Carignan, Eric Horvitz, Forough Poursabzi-Sangdeh

TL;DR

This paper explores a novel method for making language models safer by "steering" their internal activations at inference time, rather than retraining them. While this approach effectively increases refusal rates for unsafe prompts, it surprisingly leads to a significant degradation in performance on unrelated tasks, highlighting a deep entanglement between safety features and general model capabilities.

What Problem Does This Paper Address?

Deploying large language models (LLMs) responsibly hinges on their ability to refuse harmful or unsafe prompts while still performing well on legitimate tasks. Traditional methods like fine-tuning often struggle to generalize to novel or adversarial prompts. This paper investigates an alternative: steering LLM behavior during inference by manipulating specific internal features identified by Sparse Autoencoders (SAEs). The core challenge is to enhance safety without sacrificing the model's overall utility and performance.

Methods

The authors employ Sparse Autoencoders (SAEs) to identify "features" within the LLM's internal activations that correlate with refusal behavior. An SAE is trained to reconstruct the LLM's activations, and its learned features are hypothesized to represent specific concepts or behaviors. The key technique is feature steering: once a feature associated with refusal is identified, its activation value is manually "clamped" to a higher value during inference. This amplified feature is then fed back into the model, nudging it towards refusal. The authors explore different SAE architectures and layers, ultimately focusing on features identified in the residual stream of Phi-3 Mini. They also compare this to baseline methods like system prompting and attention steering.

Datasets

  • Training Data for SAEs: A diverse mix of open-source datasets including Fineweb, ToxiGEN, LMSYS-Chat, Wild Chat, Wild Jailbreak, and Wild Guard training data.
  • Evaluation Benchmarks:
    • Safety: Wild Guard (single-turn unsafe/safe prompts), XSTest (single-turn unsafe/safe prompts), Crescendo (multi-turn adversarial attacks across various harmful topics), PAIR attacks.
  • Performance: MMLU (multi-task language understanding), TruthfulQA (measuring factual accuracy and avoiding misconceptions), GSM8K (grade-school math problems).

Key Insights and Ideas

  • Refusal Features are Deeply Entangled: The most striking finding is that features mediating refusal are not isolated. Amplifying them to improve safety systematically degrades performance on unrelated tasks, even those that seem entirely benign. This suggests a fundamental lack of modularity in how LLMs represent concepts.
  • SAE Steering is a Flexible Intervention: Unlike fine-tuning, SAE steering can be applied at inference time, offering a dynamic way to adjust model behavior without retraining.
  • Trade-offs are Inevitable (for now): While SAE steering can significantly improve refusal rates, it comes at a clear cost to general capabilities. Finding the right "clamp value" is crucial for balancing safety and performance.
  • Multiple Features Mediate Refusal: The research indicates that refusal behavior isn't controlled by a single feature, but rather by a combination, complicating targeted interventions.

Key Results

  • Improved Safety: Amplifying identified refusal features (specifically Feature 22373) on Phi-3 Mini significantly increased refusal rates for unsafe prompts across single-turn benchmarks (e.g., +32.32% on Wild Guard with clamp 10) and improved robustness against multi-turn jailbreak attacks (e.g., Crescendo Attack Success Rate reduced by up to 23.34% compared to no steering).
  • Performance Degradation: This safety improvement came at a cost. For example, accuracy on MMLU dropped by up to 27.30% when steering Feature 22373. Over-refusal on safe prompts also increased significantly.
  • Generalization: The identified refusal features showed some generalization across different harms and even across models (tested with Llama-3.1 8B Instruct).
  • Conditional Steering Shows Promise: Applying steering only when a prompt is classified as unsafe (conditional steering) significantly mitigated performance regressions while still improving safety, suggesting a more practical deployment strategy.

Limitations and Future Work

  • Lack of Modularity: The authors acknowledge that the observed performance regressions suggest a lack of modularity in LLM features, meaning interventions on one feature can have widespread unintended consequences.
  • Hyperparameter Tuning: The search space for SAE configurations and clamp values is vast and underexplored.
  • Feature Interpretation: While features are identified, their precise semantic meaning and how they interact remain unclear.
  • Future Directions: The authors suggest exploring larger SAEs for finer-grained features, deeper mechanistic explanations for performance regressions, and more sophisticated conditional steering strategies that combine safety classifiers with feature steering. They also highlight the need to understand how amplified features interact with naturally activated features.

Summary updated

BibTeX
@inproceedings{obrien2025steering,
  author = {Kyle O'Brien and David Majercak and Xavier Fernandes and Richard G. Edgar and Blake Bullwinkel and Jingya Chen and Harsha Nori and Dean Carignan and Eric Horvitz and Forough Poursabzi-Sangdeh},
  title = {{Steering Language Model Refusal with Sparse Autoencoders}},
  booktitle = {R2-FM @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=PMK1jdGQoc},
}
Figure