arXiv(opens in a new tab)cs.LGSep 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2609.06986

Continual Learning Mechanisms Compose for Long-Horizon Memorization

Zheyuan Zhang, Alvin Zhang, Daniel Khashabi, Tianmin Shu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Zheyuan Zhang*, Alvin Zhang*, Daniel Khashabi†, Tianmin Shu†

Johns Hopkins University

compose-cl.github.io

Abstract. Language models may need to internalize information that arrives over time and retain it through many subsequent updates. To study this challenge, we introduce long-horizon memorization, a setting in which a model learns 100 query-answer tasks through continual supervised fine-tuning without retaining earlier training examples or receiving task identifiers at inference. Sequential updates cause catastrophic forgetting, and no single continual learning mechanism we evaluate maintains strong retention at this horizon. We hypothesize that mechanisms addressing complementary sources of forgetting will be more effective when composed. We organize these compositions along two design dimensions. Data, function, and weight anchors specify what prior information each update should preserve, while low-rank allocation rules determine where successive updates are retained. To test this hypothesis systematically, we construct three distinct 100-task memorization datasets. We introduce task-level successive halving to search the combinatorial design space and use a factorial experiment to measure individual and interaction effects. Our best method combines all three anchors with merged LoRA, ranks among the top 3 methods in all datasets, and raises average final retention from 1.2% under naive sequential fine-tuning to 34.9%, a 28-fold improvement. The data anchor and merged LoRA provide the largest average gains and interact super-additively on all three datasets. Together, these results show that composing complementary mechanisms substantially improves long-horizon memorization beyond what any individual mechanism achieves.

1. Introduction

Consider a language model that learns new information over time by updating its parameters. For these parameters to serve as memory, the model must remember what it has learned even after many more updates. We call this setting long-horizon memorization. Prompting and retrieval can provide new information at inference time [Brown et al., 2020, Lewis et al., 2020], but the information remains outside the model's parameters and must be supplied again. We instead ask whether repeated updates can build and preserve this memory within the model itself.

We study this problem through continual supervised fine-tuning (SFT) in the domain-incremental setting [Van de Ven and Tolias, 2019]. Each task contains a set of query-answer pairs. The model learns 100 tasks in sequence without retaining raw examples from earlier tasks, and it receives no

  • Equal contribution. † Equal advising.

Figure

••• Naive fine-tuning -- Best single mechanism ••• All mechanisms combined — Dataset-specific best composition

Figure 1: Memory lifetime under the best single mechanism and composed continual learning methods. Lines show three-seed means with min-max bands. Half-life counts tasks until retention halves. Combining multiple anchors with merged LoRA substantially reduces catastrophic forgetting and extends memory lifetime beyond the best single mechanism.

task identifier at inference. The goal is to learn each new task while retaining associations learned from previous tasks. This is difficult because updates for new tasks can overwrite previously stored knowledge, causing catastrophic forgetting [McCloskey and Cohen, 1989, French, 1999].

Prior work shows that mixing rehearsal with knowledge distillation has strong performance [Buzzega et al., 2020], but it does not systematically study the broader space of mechanism compositions. We therefore hypothesize that mechanisms addressing complementary sources of forgetting will retain associations more effectively when composed. To test this hypothesis, we organize compositions along two design dimensions: anchors and low-rank allocation rules. Anchors specify what prior information an update should preserve. We study data, function, and weight anchors, instantiated by generative replay [Shin et al., 2017], self-distillation [Li and Hoiem, 2017], and importance-based regularization [Kirkpatrick et al., 2017, Zenke et al., 2017], respectively. Low-rank allocation rules determine where successive LoRA updates are retained across tasks [Hu et al., 2022]. We study shared LoRA, which reuses the same adapter across tasks, and merged LoRA, which folds each update into the model before initializing a new adapter.

Testing this hypothesis requires datasets that isolate long-horizon memorization and a method to compare many compositions. Existing public benchmarks for continual language learning primarily measure transfer or performance across heterogeneous downstream tasks or changing corpora [Zhang et al., 2023, Wang et al., 2023b, Jang et al., 2022]. Sequential model-editing benchmarks instead study targeted edits rather than task-wise SFT [Hartvigsen et al., 2023, Li and Chu, 2024]. To address the lack of an appropriate evaluation pipeline, we construct three datasets, each containing 100 tasks, spanning arbitrary symbol associations, LLM-generated fictional facts, and natural questions filtered from public QA datasets. We introduce task-level successive halving to obtain preliminary evidence across many candidate compositions, then use a factorial experiment to measure individual and interaction effects.

Our experiments support the composition hypothesis. Figure 1 shows that combining multiple anchors with merged LoRA extends memory lifetime beyond individual mechanisms across all three datasets.

After 100 tasks, naive sequential fine-tuning achieves 1.2% average final retention, measured as accuracy over all learned tasks after the last update, while the best individual mechanism reaches 8.1%. Our best method combines all three anchors with merged LoRA, which is the only composition in the main factorial that ranks consistently among the top 3 methods in all datasets and achieves 34.9% average final retention, a 28-fold improvement over naive sequential fine-tuning. The factorial analysis identifies the data anchor and merged LoRA as the largest sources of improvement and finds a super-additive interaction between them on all three datasets.

Our contributions are fourfold. First, we formulate long-horizon continual memorization as a distinct continual learning problem for language models. Second, we organize the design space of mechanism compositions around anchors and low-rank allocation rules. Third, we introduce three 100-task memorization datasets, task-level successive halving, and a factorial evaluation of mechanism combinations. Finally, we show that composing all three anchors with merged LoRA substantially improves retention and ranks among the top 3 methods in all datasets.

References (100)

  • Memory aware synapses: Learning what (not) to forget
  • Semantic parsing on freebase from question-answer pairs
  • Language models are few-shot learners
  • Dark experience for general continual learning: a strong, simple baseline
  • Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge
  • Training Verifiers to Solve Math Word Problems
  • A continual learning survey: Defying forgetting in classification tasks
  • Imagenet: A large-scale hierarchical image database
  • Model editing at scale leads to gradual and catastrophic forgetting
  • Aging with grace: Lifelong model editing with discrete key-value adaptors
  • Measuring Mathematical Problem Solving With the MATH Dataset
  • LoRA: Low-rank adaptation of large language models
  • Simple and scalable strategies to continually pre-train large language models (opens arXiv in a new tab)
  • Non-stochastic best arm identification and hyperparameter optimization
  • Temporalwiki: A lifelong benchmark for training and evaluating ever-evolving language models
  • Lifelong pretraining: Continually adapting language models to emerging corpora
  • Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension
  • Continual pre-training of language models (opens arXiv in a new tab)
  • Overcoming catastrophic forgetting in neural networks
  • Learning multiple layers of features from tiny images
  • The mnist database of handwritten digits, 1998
  • Latent retrieval for weakly supervised open domain question answering
  • Retrieval-augmented generation for knowledge-intensive nlp tasks
  • Can we continually edit language models? on the knowledge attenuation in sequential model editing
  • Learning without forgetting
  • Relora: High-rank training through low-rank updates
  • Inflora: Interference-free low-rank adaptation for continual learning
  • When not to trust language models: Investigating effectiveness of parametric and non-parametric memories
  • Packnet: Adding multiple tasks to a single network by iterative pruning (opens arXiv in a new tab)
  • Catastrophic interference in connectionist networks: The sequential learning problem
  • Rethinking momentum knowledge distillation in online continual learning (opens arXiv in a new tab)
  • Can a suit of armor conduct electricity? a new dataset for open book question answering
  • Medmcqa: A large-scale multi-subject multi-choice dataset for medical domain question answering
  • Elle: Efficient lifelong pre-training for emerging data
  • Squad: 100,000+ questions for machine comprehension of text
  • Representation projection invariance mitigates representation collapse
  • icarl: Incremental classifier and representation learning
  • Experience replay for continual learning
  • Progressive Neural Networks
  • Progress & compress: A scalable framework for continual learning
  • Fine-tuned language models are continual learners
  • Freda Shi, Mirac Suzgun, Markus Freitag, Xuezhi Wang, Suraj Srivats, Soroush Vosoughi, Hyung Won Chung, Yi Tay, Sebastian Ruder, Denny Zhou, et al. Language models are multilingual chain-of-thought reasoners. arXiv preprint arXiv:2210.03057, 2022. (opens arXiv in a new tab)
  • Continual learning with deep generative replay
  • Lamol: Language modeling for lifelong language learning (opens arXiv in a new tab)
  • Three scenarios for continual learning (opens arXiv in a new tab)
  • A comprehensive survey of continual learning: Theory, method and application
  • Orthogonal subspace learning for language model continual learning
  • Trace: A comprehensive benchmark for continual learning in large language models (opens arXiv in a new tab)
  • Crowdsourcing multiple choice science questions
  • Continual learning with low rank adaptation (opens arXiv in a new tab)
  • Language models meet world models: Embodied experiences enhance language models
  • Qwen3 Technical Report
  • Continual learning through synaptic intelligence
  • Unraveling lora interference: Orthogonal subspaces for robust model merging
  • Agentodyssey: Open-ended long-horizon text game generation for test-time continual learning agents (opens arXiv in a new tab)
  • Citb: A benchmark for continual instruction tuning
  • Our function anchor instead matches the previous model's output distributions on current-task data
  • Linear in tasks
  • A training example is a token sequence $z = (z_1, \ldots, z_L)$ containing the question, the literal answer delimiter, and the boxed answer
  • Equation 1 is the expectation of this minibatch loss under data shuffling, so the current-task objective covers the complete sequence
  • We use Kaiming initialization for $A_j$ and initialize $B_j=0$, so a fresh adapter initially leaves the model function unchanged
  • An anchor indicator equals one only when the configuration uses that anchor and the anchor has state from an earlier task
  • Equation 13 reduces to ordinary SFT when the data anchor is off or when $t=1$
  • We create a shuffled replay iterator at the start of each epoch and create another one whenever it is exhausted, so every current minibatch receives a replay partner
  • When the input and output embeddings are not tied, we initialize the corresponding output embedding by the same rule
  • We use nucleus sampling with top-$p=0.9$ and generation temperature $\tau_{G}$
  • Random sampling provides variation across generations
  • Define the replay mask
  • At each generated-token position, the sampled continuation supplies a common prefix to the teacher and student, and $q_{m,\ell}^{D}$ is the teacher's next-token distribution
  • Increasing w increases the replay contribution and decreases the current task contribution by the same amount
  • LAMOL uses one autoregressive language model to solve tasks and generate pseudo-samples
  • For a current minibatch $\mathcal{B}$, let $n$ index a sequence $z_n=(z_{n,1},\ldots,z_{n,L_n})$, and let $\ell=1,\ldots,L_{n-1}$ index the prefix that predicts $z_{n,\ell+1}$
  • Using the sequence mask $m_{n,\ell+1}$ from Equation 11, we average the forward KL over every nonpadding target position across the full vocabulary:
  • The teacher therefore is the model trained on task $t-1$
  • Equation 25 uses only sequences from the current task and generates no additional inputs
  • Synaptic Intelligence (SI) estimates this importance from the optimization path during training
  • Section B.5.4 explains the consequences of attaching each importance value to a named LoRA coordinate
  • Let $K_t$ be the number of optimizer steps on task $t$, and let $\vartheta_{t,k,i}$ be coordinate $i$ immediately before step $k$
  • Thus $\omega_{t,i}$ gives a first order estimate of how much coordinate i contributed to reducing the fit loss along the optimization path
  • The constant $\xi > 0$ keeps the estimate stable when the total displacement is close to zero
  • SI therefore attributes the update to both sources
  • We use the online update from Schwarz et al. [2018]
  • This rescaling preserves the relative importance of coordinates within each task while keeping all task Fishers on the raw scale established by the first task
  • SI records information during ordinary training and requires no additional data pass
  • updated anchor state
  • Shared LoRA keeps the same A and B matrices across tasks, so Equations 31 and 35 compare each entry with its earlier value
  • Suppose an invertible map $\vartheta_{old} = f_t(\vartheta_{new})$ relates the two representations
  • This transformation is exact when $f_{t}$ is linear and describes the local behavior near the reference when $f_{t}$ is nonlinear
  • Let $Opt_{t}$ denote all AdamW updates performed on task t, including the task-specific learning-rate schedule and every active term in Equation 14
  • For each later task, it sets $(A_{t,j}^{(0)}, B_{t,j}^{(0)}) = (A_{t-1,j}^{\star}, B_{t-1,j}^{\star})$
  • ReLoRA schedules several restarts during pretraining and partially resets the optimizer state
  • Task t uses a rank-r LoRA:
  • Because the new LoRA update is initialized to zero, $B_{t+1,j}A_{t+1,j}=0$, task $t+1$ starts from the function represented by the merged weight $W_{t,j}$
  • Our implementation follows the released two-pair structure: one concatenated pair stores completed tasks, while one fixed-rank pair learns the current task
  • The accumulated LoRAs remain frozen
  • Our implementation adds $\mathcal{R}_\perp^t$ and $\mathcal{R}_2^t$ without dividing them by the gradient-accumulation factor, following the released code
  • The model after task $t$ therefore represents
  • This procedure assumes access to training data from all tasks
  • Before task t, the method stacks the feature vectors from completed tasks:
  • Let $\widehat{A}_{t,j}$ denote the ordinary Kaiming initialization drawn when the implementation attaches the fresh adapter

Couldn't load all references. Reload the page to try again.