Source-linked AI summary

Continual Learning via Sparse Memory Finetuning

Jessy Lin, Luke Zettlemoyer, Gargi Ghosh, Wen-Tau Yih, Aram Markosyan, Vincent-Pierre Berges, Barlas Oğuz

arXiv:2510.15103v1cs.CLcs.AI

TL;DR

Continual learning is hindered by forgetting when models update shared parameters with new information. This paper introduces sparse memory finetuning, which selects memory slots by relative access frequency. On TriviaQA facts, it reports much smaller NaturalQuestions performance loss than full finetuning or LoRA at the same new-knowledge acquisition level.

  • Problem

    Updating shared model parameters with new information can erase previously acquired capabilities, making continual learning difficult.

    Source: §1 · p. 1
  • Method

    Sparse memory finetuning uses TF-IDF to select memory slots highly accessed on new-data batches relative to background data and updates those slots.

    Source: §1 · p. 1, §4 · p. 4
  • Results

    NaturalQuestions performance drops 89% with full finetuning, 71% with LoRA, and 11% with sparse memory finetuning while acquiring the same level of new knowledge.

    Source: §1 · p. 2
  • Takeaways & Limitations

    Sparse memory finetuning achieves a Pareto better learning–forgetting trade-off than full finetuning and LoRA on factual question-answering tasks.

    Source: §7 · p. 10

    The results still need to be scaled to more complex tasks beyond fact learning and to larger models.

    Source: §7 · p. 10

Abstract

from arXiv · show

Modern language models are powerful, but typically static after deployment. A major obstacle to building models that continually learn over time is catastrophic forgetting, where updating on new data erases previously acquired capabilities. Motivated by the intuition that mitigating forgetting is challenging because trainable parameters are shared across all tasks, we investigate whether sparse parameter updates can enable learning without catastrophic forgetting. We introduce sparse memory finetuning, leveraging memory layer models (Berges et al., 2024), which are sparsely updated by design. By updating only the memory slots that are highly activated by a new piece of knowledge relative to usage on pretraining data, we reduce interference between new knowledge and the model's existing capabilities. We evaluate learning and forgetting compared to full finetuning and parameter-efficient finetuning with LoRA on two question answering tasks. We find that sparse memory finetuning learns new knowledge while exhibiting substantially less forgetting: while NaturalQuestions F1 drops by 89% after full finetuning on new facts and 71% with LoRA, sparse memory finetuning yields only an 11% drop with the same level of new knowledge acquisition. Our results suggest sparsity in memory layers offers a promising path toward continual learning in large language models.

1 Introduction

Continual learning requires models to accumulate knowledge, but updates can cause catastrophic forgetting, and replay becomes difficult to scale. Sparse memory finetuning updates selected memory slots; on TriviaQA facts, it acquires new knowledge while retaining more NaturalQuestions performance than full finetuning or LoRA.

1 Introduction

  • Continual learning aims to let models accumulate knowledge and skills, but updating on new information can erase previously acquired capabilities.Replay can alleviate forgetting, but the authors describe it as data-inefficient and increasingly difficult to scale.Source: §1 · p. 1
  • Sparse memory finetuning updates memory slots more frequently accessed on a new-data batch than on background data, aiming to limit interference with existing knowledge.The method uses TF-IDF ranking to select slots for updating.Source: §1 · p. 1
  • The evaluation tests learning and forgetting on streams of facts and documents while assessing whether pretraining capabilities degrade.The supplied result reports the TriviaQA-fact setting.Source: §1 · pp. 1–2
  • NaturalQuestions performance drops 89% with full finetuning, 71% with LoRA, and 11% with sparse memory finetuning while acquiring the same level of new knowledge.The comparison is for training on a stream of TriviaQA facts.Source: §1 · p. 2

2 Related Work

Prior approaches address forgetting through regularization, added task-specific capacity, or replay, each with trade-offs. This work instead builds on sparsely indexed memory layers to update selected parameters while retaining a large memory pool.

2 Related Work

  • Regularization methods constrain updates, while Elastic Weight Consolidation protects parameters deemed important to prior tasks using Fisher information.The cited regularizers include dropout, weight decay, and KL penalties.Source: §2 · p. 2
  • Expansion methods add task-specific parameters, but their limited added capacity can constrain new learning; LoRA may forget less while learning less.The passage cites adapter, LoRA, and MoE expansions and reports the LoRA comparison through Biderman et al. (2024).Source: §2 · p. 2
  • Replay can reduce forgetting by rehearsing prior data, but growing corpora make it data-inefficient and complicate preserving both pretraining knowledge and instruction following.The passage cites replay-based methods including Robins (1995), Lesort et al. (2022), Scialom et al. (2022), and Chen et al. (2025).Source: §2 · p. 2
  • Prior work suggests a small parameter subset can drive task performance, and grafting found that as little as 0.01% of parameters may be responsible for it [Panigrahi et al., 2023].The cited work also found that these parameters can be isolated to enable continual learning with less forgetting.Source: §2 · p. 2
  • The paper uses memory layers to combine a large indexed memory pool with sparse updates intended to avoid interfering with parameters for other knowledge.The passage describes memory layers as sparsely indexed by design.Source: §2 · p. 2

3 Background

Memory layers replace transformer feedforward layers with a lookup over trainable keys and values, activating a small part of a large memory pool. Sparse memory finetuning selects batch-relevant slots relative to background accesses.

3 Background

  • A memory layer replaces a transformer feedforward layer with a lookup: each token's projected query identifies the top 32 keys, and gated weighted values form the output.The architecture is described as a memory lookup in place of one FFN.Source: §3 · p. 2, Figure 1 · p. 3
  • Sparse memory finetuning ranks memory-index counts on a batch against accesses in a background corpus, then trains the top t indices with high batch use and relatively infrequent background use.The rest of the memory pool and model remain frozen.Source: Figure 2 · p. 3
  • The memory pool contains keys and values, with learned projections and top-k key selection; product keys split keys in two for efficient lookup across many indices.Memory sizes are typically 1M–100M keys for billion-parameter base models.Source: §3 · p. 3
  • Unlike attention, memory-layer keys and values are trainable parameters, and each token activates only a tiny subset of total memory parameters.The passage gives an example activation range of 0.03%–0.0002% of total memory parameters.Source: §3 · p. 3

4 Sparse Memory Finetuning

Sparse memory finetuning selects memory slots that are especially active on the current batch relative to background usage, then updates only the selected values. Background access counts come from sampled DCLM batches, and the selection can change on each forward pass.

4 Sparse Memory Finetuning

  • The selection targets slots especially accessed for a particular input relative to other inputs, using TF-IDF to rank their batch-specific importance.The authors note that future work could explore other scoring functions or sequence-level rather than batch-level selection.Source: §4 · p. 4
  • The method counts memory accesses on each batch and ranks slots with TF-IDF against a background corpus, updating only the top t slots.For the main experiments, background accesses come from 1,000 random DCLM batches; ranking batches assumes no task boundaries.Source: §4 · p. 4
  • Only selected memory values receive gradients; all accessed indices still contribute to the forward-pass output.The trainable set is dynamic on each forward pass, while other memory parameters are frozen.Source: §4 · p. 4
  • Although each forward pass typically accesses 10^3 to 10^6 indices, t can be set much lower without reducing learning performance.The access count depends on k, memory heads, batch size, and sequence length.Source: §4 · p. 4

5 Experiments

Experiments compare sparse memory finetuning with full finetuning and LoRA on sequential fact learning and document-stream QA, tracking target learning and held-out retention.

5 Experiments

  • Experiments use a 1.3B base model; sparse memory finetuning uses SGD, while baselines use AdamW with λ = 0.1.Source: §5 · pp. 4–5

5.1 Fact Learning

  • The fact-learning setting sequences 1,000 TriviaQA questions rephrased as statements, with paraphrases filling each batch and padding indices masked.The reported setting uses top t = 500 memory slots.Source: §5.1 · p. 5
  • Lower learning rates preserve held-out performance in fact learning while still matching or exceeding the target performance of baselines.Held-out performance is measured by NaturalQuestions F1 and HellaSwag accuracy.Source: §5.1 · p. 5

5 Experiments

  • Across fact and document streams, sparse memory finetuning learns more while forgetting less on facts, and matches baseline target performance with less held-out degradation on documents.Source: §5.1 · p. 5, Figure 4 · p. 6, §5.2 · p. 6

5.2 Document QA

  • The document-task setting splits Wikipedia documents cited for questions into 1,824 chunks, roughly paragraphs, and processes one chunk at a time with an immediate gradient step rather than shuffling chunks iid.It uses top t = 10000, given the higher information content in each batch.Source: §5.2 · p. 6

6 Analysis

Across hyperparameter sweeps, sparse memory finetuning learns more while forgetting less than the alternatives. Analysis further examines ranking choices, background corpora, and how selected memory indices relate to factual content.

Pareto Frontier of Learning and Forgetting

  • Sparse memory finetuning Pareto-dominates the alternatives, learning more while forgetting less across the swept hyperparameters.Figure 5 compares target TriviaQA and held-out HellaSwag performance; point size represents trainable parameters per batch.Source: §6 · p. 6, Figure 5 · p. 7

Naive Memory Finetuning

  • TF-IDF ranking preserves held-out performance better than TF-only ranking at comparable learning, especially when fewer indices are trainable.With TF-only ranking, retaining target performance requires t > 500 for this task, while held-out forgetting is greater; the ranking gap widens at t = 50.Source: §6 · pp. 6–7, Figure 6 · p. 8

Background Indices

  • Using TriviaQA accesses as the background leads to worse forgetting, while NaturalQuestions and DCLM backgrounds yield similar learning and forgetting.Full question-answering preservation might require upweighting indices used by any NaturalQuestions question.Source: §6 · p. 7, Figure 7 · p. 8

Understanding Memory Accesses

  • Core-set indices shared across paraphrases and the answering question typically number 100–500, and trainable accesses generally align with them across sequences.The reported alignment often occurs at entity boundaries; the analysis asks whether TF-IDF can identify these indices without access to test-question indices.Source: §6 · pp. 8–9, Table 1 · p. 9

7 Conclusion

The conclusion presents sparse memory updates as promising for continual learning, reporting a better learning–forgetting tradeoff than full finetuning and LoRA on factual question answering. It identifies broader tasks and larger models as future tests.

7 Conclusion

  • Sparse memory finetuning achieves a Pareto-better learning–forgetting tradeoff than full finetuning and LoRA on factual question answering tasks.The method selectively updates relevant memory slots using TF-IDF ranking.Source: §7 · p. 10
  • The experiments focus on factual learning, for which retrieval-augmented generation is a natural present-day solution.The conclusion distinguishes this focus from broader continual-learning goals.Source: §7 · p. 10
  • Scaling to more complex tasks and larger models remains future work; parameter selection could also use input-dependent t or other ranking criteria.The paper presents sparse updates beyond memory layers as a promising principle, while its reported results focus on memory layers.Source: §7 · p. 10

A Baseline Results with SGD

The SGD baseline results show a learning–forgetting tradeoff: sparse memory finetuning retains the listed benchmark scores, while AdamW baselines learn more but forget more on held-out tasks.

A Baseline Results with SGD

  • TQA 1K F1 > 0.7, NQ F1 < 0.15, and GSM8K NLL < 1.5 for sparse memory finetuning with SGD.These are the reported comparisons to Figure 3.Source: Table 2 · p. 13
  • AdamW baselines achieve TQA 1K F1 > 0.7 but forget much more on held-out tasks than the SGD baselines.Source: Table 2 · p. 13
  • The SGD baselines forget less than AdamW baselines but do not learn as much on fact learning.Source: Table 2 · p. 13
Loading 2510.15103v1…