Steering Large Language Model Activations in Sparse Spaces

Reza Bayat, Ali Rahimi-Kalahroudi, Mohammad Pezeshki, Sarath Chandar, Pascal Vincent

TL;DR

Activation steering is a powerful, training-free method to control Large Language Model (LLM) behavior, but doing so in dense activation spaces often leads to messy, unintended side effects due to feature entanglement. This paper introduces Sparse Activation Steering (SAS), a framework that leverages Sparse Autoencoders (SAEs) to isolate and manipulate behavior-specific features within a clean, interpretable sparse space. Tested on Gemma-2 models, SAS allows for precise, modular behavioral control—and even improves performance on standard benchmarks like TruthfulQA—without permanently altering model weights.

What Problem Does This Paper Address?

As LLMs are deployed in increasingly diverse contexts, controlling their behavior at test time remains a critical challenge. For instance, while creative writing benefits from a bit of "hallucination," factual question-answering demands strict grounding.

An emerging solution is activation steering, which injects steering vectors directly into the model's internal layers during inference to nudge its outputs toward a desired behavior. However, standard steering operates in dense activation spaces, which suffer from superposition—a phenomenon where the model packs more features than it has dimensions, entangling unrelated concepts. This makes fine-grained control difficult and unpredictable.

While Sparse Autoencoders (SAEs) can disentangle dense activations into a sparse, highly interpretable "monosemantic" space, prior attempts to simply project dense steering vectors into sparse spaces have failed. This is because dense steering vectors lie outside the distribution the SAE was trained on and contain negative values that the non-negative sparse space cannot process.

Methods

The authors introduce Sparse Activation Steering (SAS), a method that extracts and applies steering vectors directly within the SAE's sparse latent space.

The SAS pipeline consists of two main phases:

1. Vector Generation

  • Contrastive Prompt-Pairing: The process begins by feeding the model pairs of prompts that differ only in their completion tokens to represent opposite sides of a behavior (e.g., a prompt ending in a token that triggers a refusal vs. one that complies).
  • Sparse Feature Extraction: Internal activations are passed through an SAE encoder to map them into the sparse space.
  • Filtering & Isolation: Features that are inactive or rarely active are filtered out using a frequency threshold ($\tau$). Crucially, features shared between the positive and negative completions are removed, isolating the features uniquely responsible for the targeted behavior.
  • Subtraction: The final SAS vector is constructed by subtracting the negative mean sparse vector from the positive mean sparse vector.
Figure 1: Sparse Activation Steering (SAS) Vector Generation. The process of generating SAS vectors consists of six steps: (1) Construct a contrastive pair of prompts, where one completion exhibits the desired behavior (positive) and the other its opposite (negative). (2) Extract sparse representations of activations from a selected model layer using a Sparse Autoencoder (SAE) encoder 𝑓(𝑎). (3) Filter out inactive features using an activation frequency threshold 𝜏. (4) Remove shared features between the positive and negative representations to isolate behavior-specific components. (5) Compute mean activation vectors from the sparse matrices of positive and negative completions. (6) Construct the final SAS vector by subtracting the negative mean vector from the positive mean vector. The resulting vector reinforces the intended behavior through its “positive components” while suppressing the model’s existing tendencies that contradict the target behavior through its “negative components” during inference. See the algorithm in Appendix C.

2. Steering During Inference

During text generation, the scaled SAS vector ($\lambda \cdot v$) is added to the model's sparse representation. The authors introduce two key technical adjustments to ensure stability:

  1. Re-applying Non-linearity: They pass the steered sparse vector through the SAE's activation function ($\sigma$) again to preserve the non-negative structure of the sparse space.
  2. Delta ($\Delta$) Correction: They calculate a correction term ($\Delta = a - \hat{a}$) representing the SAE's reconstruction loss and add it back to the dense activation, preventing performance fluctuations in early layers.
Figure 1: Sparse Activation Steering (SAS) Vector Generation. The process of generating SAS vectors consists of six steps: (1) Construct a contrastive pair of prompts, where one completion exhibits the desired behavior (positive) and the other its opposite (negative). (2) Extract sparse representations of activations from a selected model layer using a Sparse Autoencoder (SAE) encoder 𝑓(𝑎). (3) Filter out inactive features using an activation frequency threshold 𝜏. (4) Remove shared features between the positive and negative representations to isolate behavior-specific components. (5) Compute mean activation vectors from the sparse matrices of positive and negative completions. (6) Construct the final SAS vector by subtracting the negative mean vector from the positive mean vector. The resulting vector reinforces the intended behavior through its “positive components” while suppressing the model’s existing tendencies that contradict the target behavior through its “negative components” during inference. See the algorithm in Appendix C.

Datasets

The framework was evaluated using:

  • Behavioral Datasets: Sourced from Panickssery et al. (2023), covering seven distinct behaviors: refusal, sycophancy, hallucination, corrigibility, AI coordination, survival instinct, and myopic reward.
  • Open-Ended Generation: Evaluated using held-out questions, with responses scored from 0 to 9 by GPT-4o acting as a judge.
  • Feature Compositionality Task: A custom-modified version of the Myopic dataset that incorporates gendered personas (Alice and Bob) to test multi-variable steering.
  • Standard Benchmarks: MMLU (Massive Multitask Language Understanding) and TruthfulQA to evaluate general capabilities and truthfulness under steering.

Key Insights and Ideas

  • Direct Sparse Steering Solves Distribution Shift: By generating the steering vectors directly from the sparse representations of contrastive prompts, SAS completely bypasses the distribution-shift and negative-projection issues that break dense-to-sparse vector translation.
  • Scaling SAEs Drives Monosemanticity: As the dictionary size of the SAE scales up (from 16K to 1M features), the resulting SAS vectors become significantly sparser. This indicates that larger SAEs successfully isolate cleaner, more specific behavioral concepts.
  • Modular Feature Compositionality: Because the sparse space cleanly separates concepts, users can combine independent steering vectors. For example, you can simultaneously steer the model to avoid immediate rewards (non-myopic) while biasing its preference toward a specific gendered persona by simply adding the respective sparse features together.
  • Cross-Behavior Overlaps: Analyzing the sparse vectors reveals fascinating semantic correlations. For instance, the positive direction of "refusal" shares a significant number of active features with the negative direction of "hallucination," providing mechanistic proof that teaching a model when to refuse naturally helps suppress fabrications.

Key Results

Experiments were conducted on Gemma-2 (2B and 9B) models using pre-trained JumpReLU SAEs from Gemma Scope.

  • Effective Behavioral Modulation: SAS successfully steers model behavior in both multiple-choice and open-ended generation tasks. As the steering multiplier ($\lambda$) increases, the target behavior becomes progressively more dominant.
Impact of steering strength on behavioral alignment across layers.
  • Preserved (or Improved) Benchmark Performance: Unlike dense steering methods that often degrade general model capabilities, moderate SAS steering ($\lambda = \pm1$ or $\pm2$) maintains stable performance on MMLU. Remarkably, steering the model away from hallucination actually improves its absolute accuracy on the TruthfulQA benchmark.
Performance on MMLU and TruthfulQA under different steering strengths.

Limitations and Future Work

  • Base vs. Instruction-Tuned Mismatch: The SAEs used in this study were trained on base Gemma-2 models but applied to instruction-tuned variants. While the features transferred effectively, training SAEs directly on instruction-tuned models could further reduce reconstruction errors.
  • Hyperparameter Coupling: Sparser vectors extracted from larger SAEs require higher steering strengths ($\lambda$) to achieve the same behavioral shift, meaning optimal steering parameters must be tuned relative to the SAE dictionary size.
  • Future Direction: The authors point toward conditional steering—dynamically adjusting the sparse steering vectors based on the input context to enable more flexible, context-aware safety and style alignment.

Summary updated

BibTeX
@inproceedings{bayat2025steering,
  author = {Reza Bayat and Ali Rahimi-Kalahroudi and Mohammad Pezeshki and Sarath Chandar and Pascal Vincent},
  title = {{Steering Large Language Model Activations in Sparse Spaces}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=VGw1viYliK},
}
Figure