SAE-FD: Sparse Autoencoder Feature Distillation for Continual Learning of Large Language Models

Mingxu Zhang, Yuhan Li, Lujundong Li, Dazhong Shen, Hui Xiong, Ying SunarXiv 2026

TL;DR

SAE-FD (Sparse Autoencoder Feature Distillation) mitigates catastrophic forgetting in Large Language Models (LLMs) by regularizing model updates within a sparse, disentangled feature space. By anchoring representations using a pre-trained Sparse Autoencoder (SAE), it selectively protects old knowledge with minimal interference to new task learning, achieving state-of-the-art continual learning performance across multiple model architectures.

What Problem Does This Paper Address?

When large language models are sequentially trained on new tasks, they suffer from catastrophic forgetting—the learning process for the new task overwrites and degrades the model's performance on previously learned tasks.

Existing solutions try to prevent this by adding regularization penalties in the model's weight, gradient, or output spaces. However, all these methods operate in dense representation spaces. Due to a phenomenon known as feature superposition, neural networks compress more concepts than they have dimensions by overlapping them in dense spaces. Because these features are entangled, traditional regularization acts like a blunt instrument: trying to protect an old concept inadvertently blocks the model from adapting to a new one.

Methods

The authors introduce SAE-FD, a three-stage pipeline that shifts regularization from entangled dense spaces to a decoupled, sparse feature space where concepts are cleanly separated.

  1. Stage 1: SAE Training: Before continual learning begins, a Gated Sparse Autoencoder (SAE) is trained on diverse text activations from the base LLM. The SAE learns to decompose dense activations into a massive, sparse, overcomplete feature space ($D \gg d$). Once trained, this SAE is frozen.
  2. Stage 2: Task Training and Anchor Capture: The LLM is fine-tuned on a task using LoRA. After training, the model processes a small set of "anchor samples," and their per-token internal activations are mapped through the SAE and saved as a compact snapshot of the learned task.
  3. Stage 3: Sparse-Aware Feature Distillation: When training on subsequent tasks, the model minimizes a combined loss function: $\mathcal{L} = \mathcal{L}_{\text{task}} + \lambda \cdot \mathcal{L}_{\text{FD}}$.

The distillation loss ($\mathcal{L}_{\text{FD}}$) uniquely leverages the sparse SAE space using two terms:

  • Cosine Direction Loss: Prevents the global orientation of the feature representations from drifting.
  • Active Magnitude Loss: Applies Mean Squared Error (MSE) only to the specific features that were actively used by the anchor tasks, leaving inactive features entirely free to be recruited by new tasks.

An Adaptive $\lambda$ Mechanism dynamically adjusts the regularization strength during training. It injects strong anti-forgetting protection at the start of a new task (when the risk of forgetting is highest) and relaxes as the model stabilizes.

Figure 1: Overview of SAE-FD. Stage 1: A Gated SAE is trained to decompose dense activations into sparse features. Stage 2: After each task’s training, per-token MLP activations on anchor samples are captured and stored. Stage 3: Stored anchor activations and recomputed current activations are encoded through the frozen SAE, and the sparse-aware distillation loss combines cosine direction preservation with active-feature magnitude matching, weighted by an adaptive λ.

Datasets

  • SAE Training Data: Activations collected from a blend of classification datasets (AG News, Amazon, Yelp, DBpedia, Yahoo), question answering (BoolQ, ARC), and knowledge benchmarks (MMLU).
  • TRACE Benchmark: A rigorous continual learning benchmark consisting of 8 highly diverse, sequential tasks ranging from stance detection and financial sentiment to code completion and German text simplification.
  • Standard CL Benchmark: A 4-task text classification dataset used to evaluate performance across randomized task orderings.

Key Insights and Ideas

  • Disentanglement Enables Targeted Protection: The core "aha moment" is that mechanistic interpretability tools (like SAEs) can double as excellent regularizers. By projecting activations into a sparse space, you can put a "shield" exclusively over the features used by old tasks without locking down the rest of the network's capacity.
  • Direction and Magnitude are Complementary: Ablation experiments revealed that optimizing for feature direction alone lacks scale control, while optimizing for magnitude alone allows the global representation space to rotate. Both are required to fully arrest representation drift.
  • Dynamic Penalties Balance Plasticity and Stability: Forcing a fixed regularization weight ($\lambda$) fails because task losses fluctuate wildly during training. Automatically scaling $\lambda$ based on the ratio of task-to-distillation loss allows the model to learn quickly without losing its grip on the past.

Key Results

  • Near-Zero Forgetting: On the TRACE benchmark with LLaMA-2-7B-Chat, SAE-FD achieved an Average Accuracy (AA) of 52.70% with a Backward Transfer (BWT) of just -0.46% (where 0% means absolutely no forgetting).
  • Outperforming Strong Baselines: It surpassed GORP, the strongest published regularization baseline, by +2.3% AA while reducing forgetting by 34%. It also significantly beat traditional methods like EWC and O-LoRA.
  • Cross-Architecture Generalization: The method delivered consistent improvements across three distinct model families—LLaMA-2-7B, Vicuna-7B, and Mistral-7B—proving that the sparse feature anchoring principle is universally applicable.

Limitations and Future Work

  • One-Time Overhead: SAE-FD requires training a dedicated SAE for each base model architecture before deployment, which introduces an upfront computational cost.
  • Linear Storage Growth: The anchor buffer stores float16 activations, consuming roughly 0.8 GB per task. For exceptionally long task sequences, this linear growth could become a bottleneck, necessitating future work into anchor compression strategies.
  • Future Directions: The authors propose extending this technique to multi-layer SAE features and leveraging the semantic interpretability of SAE features to design task-aware regularization strategies.

Summary updated

Abstract

Continual learning enables large language models to adapt to evolving tasks without retraining from scratch, yet catastrophic forgetting remains a central obstacle. Among continual learning methods, regularization-based approaches are widely used to constrain model updates and reduce forgetting, operating in weight space, gradient space, or output space. However, these dense representation spaces suffer from feature superposition, where multiple concepts are encoded in overlapping dimensions, making it difficult to selectively protect previously learned knowledge without impeding new-task learning. To address this issue, we propose \method (Sparse Autoencoder Feature Distillation), which anchors model representations in the sparse feature space of a pre-trained Sparse Autoencoder, where dense activations are decomposed into a sparse overcomplete basis that reduces representational entanglement, enabling more targeted regularization with less interference to new-task learning. Experiments on two continual learning benchmarks across three model architectures show that \method consistently outperforms existing regularization-based methods, achieving up to 52.70% average accuracy with only -0.46 backward transfer.
BibTeX
@misc{zhang2026sae,
  author = {Mingxu Zhang and Yuhan Li and Lujundong Li and Dazhong Shen and Hui Xiong and Ying Sun},
  title = {{SAE-FD: Sparse Autoencoder Feature Distillation for Continual Learning of Large Language Models}},
  year = {2026},
  eprint = {2605.25525},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.25525},
}
Figure