Mitigating Memorization in LLMs using Activation Steering

Manan Suri, Nishit Anand, Amisha BhaskararXiv 2025

TL;DR

This paper demonstrates that activation steering using Sparse Autoencoder (SAE) features can effectively suppress verbatim data memorization in Large Language Models (LLMs) without requiring expensive retraining or permanent weight edits. By applying moderate steering strengths to the later layers of a model during inference, researchers can disrupt memorized data pathways while keeping the model's core linguistic and reasoning capabilities intact.

What Problem Does This Paper Address?

When LLMs are trained on massive web-scale datasets, they don't just learn abstract patterns—they often memorize exact sequences of text verbatim. This tendency to memorize poses severe risks, including privacy leaks of sensitive user data and the unauthorized regurgitation of copyrighted content.

Existing solutions generally fall into two camps, both with major drawbacks:

  1. Training-time interventions: Methods like data deduplication or Differentially Private (DP) training are computationally expensive and can significantly degrade the model's overall utility.
  2. Inference-time interventions: Techniques like output filtering (e.g., using Bloom filters) can block specific phrases but are easily bypassed by slight paraphrasing and can disrupt natural text generation.

The authors tackle a compelling alternative question: Can we dynamically steer the model's internal activations during the forward pass to avoid memorized states, without permanently altering the model's weights or breaking its general capabilities?

Methods

The authors leverage Activation Steering combined with Sparse Autoencoders (SAEs). SAEs are trained on the hidden states of an LLM to disentangle complex, dense activations into millions of sparse, interpretable latent features.

During the model's forward pass, the authors intervene at a specific layer by adding a scaled steering vector derived from an SAE feature index. The mathematical formulation is straightforward:

$$a_{\text{steered}} = a + \alpha \cdot \beta \cdot v_i$$

Where:

  • $a$ is the original activation vector.
  • $v_i$ is the decoded SAE steering vector.
  • $\alpha$ is a normalization scaling factor based on maximum observed activations.
  • $\beta$ is the steering strength coefficient.

To ensure their findings were robust and free from confirmation bias, the authors conducted a large-scale grid search on the Gemma-2-9B-IT model. Instead of hand-picking features, they randomly sampled from the 131k available SAE features per layer across different layers (9, 20, and 31) and varied the steering strength ($\beta$) from -100 to 100.

Datasets

The methodology was evaluated across three distinct types of benchmarks:

  • Memorization Benchmark: A newly curated dataset consisting of 40 famous novels sampled from the top 1000 on GoodReads (e.g., Harry Potter, Pride and Prejudice, 1984). The evaluation measured the model's ability to complete the exact opening lines of these books when prompted.
  • Linguistic Modeling: 50 samples from the Microsoft Research Paraphrase Corpus (MRPC) were used to evaluate whether the steered models could still generate coherent, grammatically correct paraphrases.
  • General Performance: Standard benchmarks including BIG-Bench Hard (BBH) tasks (Boolean Expressions, Date Understanding, Logical Deduction, Snarks) and BoolQ to ensure general reasoning skills were preserved.

Key Insights and Ideas

  • Any Perturbation Acts as a Regularizer: Surprisingly, the authors found that mitigating memorization doesn't require finding a specific "memorization neuron." Instead, applying any sufficiently strong random feature steering ($|\beta| > 50$) acts as a global regularizer—similar to dropout or weight decay—shifting the activation distribution just enough to break verbatim recall pathways.
  • The Layer Hierarchy Rule: Earlier layers in an LLM (like Layer 9) are primarily responsible for low-level syntax and grammar. Steering these layers aggressively destroys the model's basic fluency, resulting in gibberish. Conversely, later layers (like Layer 31) capture abstract semantics and are highly resilient to steering, making them the optimal target for memorization mitigation.
  • The "Semantic Footprint" Trade-off: While random steering successfully blocks memorization, some features carry a high semantic footprint that inadvertently forces the model into bizarre stylistic shifts (e.g., suddenly writing exclusively in "Shakespeare mode" or "Cat mode"). This highlights the necessity of using auto-interpretability tools (like GPT-4o-mini) to filter out high-footprint features in practical deployments.

Key Results

  • Parabolic Memorization Drop: Verbatim recall—measured by Average Normalized Longest Common Subsequence (ANLCS)—drops sharply in a clean parabolic trajectory as steering strength increases beyond $|\beta| > 50$.
Figure 1: Evaluation of memorization, as a performance of ANLCS vs Steering Strength; for the default models, the strength represents the strength of steering in the parallel steered run, and is used as a variable to show spread of performance, but is not related to the actual performance.
  • Preserving Fluency in Later Layers: Steering at Layer 31 successfully mitigated memorization while maintaining a BERTScore of 50.29 and a METEOR score of 21.93 on paraphrasing tasks. In contrast, steering at Layer 9 caused scores to plummet to 42.18 and 13.94, respectively.
Language Modeling Results
  • Minimal Impact on Reasoning: On complex reasoning tasks from BBH (such as Boolean Expressions and Logical Deduction), interventions at Layer 20 and Layer 31 maintained performance remarkably close to the unsteered baseline, even at high steering strengths.

Limitations and Future Work

While promising, the authors note several limitations in this initial exploration:

  • The evaluation was restricted to a single model family (Gemma).
  • The curated memorization benchmark is relatively small (40 books) and focuses strictly on literary text. A more comprehensive evaluation across diverse datasets (like medical records or source code) is required.
  • Future work should focus on developing adaptive and dynamic steering mechanisms that can automatically modulate steering vectors based on the input context, minimizing unintended stylistic side effects while maximizing privacy protection.

Summary updated

BibTeX
@misc{suri2025mitigating,
  author = {Manan Suri and Nishit Anand and Amisha Bhaskar},
  title = {{Mitigating Memorization in LLMs using Activation Steering}},
  year = {2025},
  eprint = {2503.06040},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.06040},
}
Figure