Gated Integration of Low-Rank Adaptation for Continual Learning of Large Language Models

Yan-Shuo Liang, Jiarui Chen, Wu-Jun Li

Introduction

Large Language Models (LLMs) are typically fine-tuned on static datasets. However, real-world applications often require models to learn from a continuous stream of data. This sequential learning process frequently triggers "catastrophic forgetting," where the acquisition of new task knowledge overwrites the weights essential for previously learned tasks. While Parameter-Efficient Fine-Tuning (PEFT) techniques like Low-Rank Adaptation (LoRA) reduce the number of trainable parameters, they do not inherently solve the forgetting problem in a continual learning (CL) setting.

The Problem: Forced Integration in Continual Learning

Existing CL strategies for LoRA often involve adding a new LoRA "branch" for each sequential task. The primary failure point occurs during inference, particularly when task identities are unknown (Task-Agnostic Inference). Most methods simply sum the outputs of all LoRA branches. This "forced integration" allows parameters optimized for a new task to corrupt the outputs of older tasks, leading to a significant drop in performance across the model's historical knowledge base. The core challenge lies in developing a mechanism that integrates multiple LoRA branches such that they only activate when relevant to the specific input.

The GainLoRA Framework

To address these challenges, we introduce GainLoRA (Gated Integration of LoRA), a novel architecture designed to protect prior knowledge while enabling sequential task acquisition. GainLoRA is built upon three foundational pillars:

1. Expandable LoRA Architecture

For every new task $t$ in a sequence, GainLoRA initializes a new pair of low-rank matrices ($A_t, B_t$). This ensures that the capacity for learning new information is preserved without directly modifying the weights of previous tasks.

2. Input-Dependent Gating Modules

Rather than treating all LoRA branches equally, GainLoRA employs independent gating modules $g_i(x)$ for each branch. The final output is calculated as a weighted sum of the LoRA outputs, where the coefficients are dynamically determined by the input $x$. This input-awareness allows the model to "route" information to the most relevant LoRA branch, effectively filtering out interference from irrelevant task parameters.

3. Orthogonal Constraints: The "Shield"

A critical innovation in GainLoRA is the protection of the gating mechanism itself. If the gates are allowed to change arbitrarily, they might begin to misroute inputs for old tasks. GainLoRA applies two specific constraints:

  • Initialization Constraints: New gates are initialized to output zero for any input residing in the subspace of previous tasks.
  • Updating Constraints: Utilizing Gradient Projection Memory (GPM), the model ensures that updates to the gating module during training are orthogonal to the features of previous tasks. This effectively "freezes" the gate's behavior on historical data while maintaining the plasticity needed for new tasks.

Experimental Evaluation

GainLoRA was evaluated across several diverse benchmarks, including SuperNI (15 NLP tasks), Long Sequence (15 classification tasks), and the TRACE Benchmark for general instruction-following retention. Testing spanned multiple model architectures, including T5 (Large and XL), Llama-2 (7B and 13B), and Llama-3 (8B).

Key Results

The experimental results demonstrate that GainLoRA significantly outperforms existing state-of-the-art (SOTA) methods:

  • Superior Performance: On the SuperNI benchmark, GainLoRA achieved an Average Performance (AP) of 47.84, substantially higher than O-LoRA (26.37) and InfLoRA (39.78).
  • Drastic Reduction in Forgetting: The Forgetting (FT) rate on SuperNI Order 1 was reduced to 2.26, compared to 41.93 for the IncLoRA baseline.
  • Efficiency and Scalability: GainLoRA maintains its performance advantages as model size increases (e.g., Llama-2-13B). Furthermore, the computational overhead is minimal, adding less than 0.5% to the total parameter count.

Discussion and Limitations

GainLoRA represents a significant step forward in making LLMs truly sequential learners. By focusing on the integration of parameters rather than just the weights themselves, it provides a robust defense against catastrophic forgetting.

However, some limitations remain. As the number of tasks grows, the orthogonal constraints may become increasingly restrictive, potentially limiting the model's ability to learn highly distinct new tasks—a classic plasticity-stability trade-off. Additionally, because the gating is dynamic and input-dependent, LoRA branches cannot be merged into the base model weights during inference, which may result in a slight latency increase in high-throughput environments. Future work will explore scenarios with significant task overlap and methods to optimize inference speed.

Summary updated

BibTeX
@inproceedings{liang2025gated,
  author = {Yan-Shuo Liang and Jiarui Chen and Wu-Jun Li},
  title = {{Gated Integration of Low-Rank Adaptation for Continual Learning of Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=lVV7F0piDK},
}
Figure