arXiv(opens in a new tab)cs.LGAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.23782

GAP-Prompt: Gated Adaptive Prompting for Efficient Continual Learning

Trung-Anh Dang, Duy-Cuong Bui, Ngoc-Son Vu, Christel Vrain, Vincent Nguyen

Trung-Anh Dang

LIFO UR 4022

Université d'Orléans, INSA CVL, Orléans, 45067, France

trung-anh.dang@univ-orleans.fr

Duy-Cuong Bui

ETIS

CY Cergy Paris University, ENSEA, CNRS, Cergy, 95000, France

duy-cuong.bui@ensea.fr

Ngoc-Son Vu

LIST3N

Université de Technologie de Troyes, Troyes, 10010, France

son.vu@utt.fr

Christel Vrain

LIFO UR 4022

Université d'Orléans, INSA CVL, Orléans, 45067, France

christel.vrain@univ-orleans.fr

Vincent Nguyen

LIFO UR 4022

Université d'Orléans, INSA CVL, Orléans, 45067, France

vincent.nguyen@univ-orleans.fr

Abstract

Continual learning faces the persistent challenge of catastrophic forgetting, where sequential task updates degrade previously acquired knowledge. While prompt-based methods integrated with pre-trained models offer a compelling solution by freezing the backbone, they often rely on static, task-level prompting strategies that overlook fine-grained intra-task diversity. In this paper, we propose Gated Adaptive Prompting (GAP-Prompt), a novel method that introduces instance-level adaptability to the prompting process. GAP-Prompt consists of three synergistic modules: (1) instance-conditioned gating, which dynamically determines optimal prompt injection layers for each individual image; (2) dynamic knowledge fusion, which performs instance-aware aggregation of current and historical prompts, enabling knowledge integration across tasks; and (3) shared prompt distillation, which anchors foundational knowledge in early shared layers to mitigate forgetting. Extensive evaluations on CIFAR-100, ImageNet-R, and CUB-200 benchmarks demonstrate that GAP-Prompt consistently achieves state-of-the-art performance. Notably, on the fine-grained CUB-200 dataset, GAP-Prompt reaches 87.29% accuracy, approaching the joint training upper bound (88.00%) and outperforming existing methods by a significant margin.

1 Introduction

Continual learning (CL) seeks to develop autonomous systems capable of acquiring knowledge from a sequential stream of tasks, mimicking the lifelong learning process of biological systems. However, standard neural networks struggle with catastrophic forgetting (McCloskey & Cohen, 1989; Robins, 1995), where the weight updates required for new tasks disrupt previously learned knowledge. Traditional mitigation strategies, such as regularization-based methods (Zenke et al., 2017a; Fini et al., 2022; Jung et al., 2020) and experience replay (Buzzega et al., 2020; Madaan et al., 2022; Cha et al., 2021), often encounter a fundamental trade-off between memory efficiency, data privacy, and computational overhead as the number of tasks increases.

Recently, the paradigm of prompt-based CL has emerged as a compelling solution, particularly when integrated with large-scale pre-trained models like the Vision Transformer (ViT) (Dosovitskiy et al., 2020). Building on visual prompt tuning (Jia et al., 2022), prompt-based CL keeps the backbone model's weights frozen to preserve foundational knowledge. Instead, it optimizes a small set of task-specific parameters known as prompts. These prompts serve as dynamic instructions that guide the pre-trained model to adapt to novel tasks without altering its core parameters (Wang et al., 2022b;a; Smith et al., 2023). Consequently, this approach significantly alleviates catastrophic forgetting while ensuring high scalability in complex, real-world learning environments. Existing prompt-based CL methods typically adopt one of two strategies for managing prompts across tasks. Some approaches rely on a shared prompt pool (Wang et al., 2022b; Smith et al., 2023) that is reused across tasks, which can lead to interference as new tasks overwrite previously useful prompts. In contrast, other methods learn task-specific prompts independently (Wang et al., 2022a; 2023a), limiting effective knowledge reuse from previously learned prompts. These limitations highlight the need for mechanisms that can dynamically combine useful prompt knowledge across tasks.

Figure

(a) Static gating

(b) Task-Conditioned Gating

Figure

(c) Instance-Conditioned Gating (Ours)

Figure 1: Conceptual comparison of different prompt gating mechanisms, i.e., determining where prompts are injected into multi-head self-attention (MSA) layers, used in existing prompt-based CL methods. (a) Static gating prepends prompts to a fixed, pre-defined subset of layers for all tasks and instances. (b) Task-conditioned gating learns a specific layer-wise topology per task but remains fixed for all instances within that task. (c) Instance-conditioned gating (ours) dynamically computes soft gate values for prompts at each layer for every input image via a learnable task-specific gating module. The varying intensity of each position illustrates our model's ability to adaptively weight layer-wise prompts based on the fine-grained visual context of each instance.

A recent study analyzing the internal representations of ViT (Raghu et al., 2021) suggests that lower layers encode generic, low-level visual features associated with local attention patterns that are largely task-agnostic and transferable across tasks, while higher layers capture higher-level semantic concepts. This hierarchical distinction implies that uniformly injecting prompts across all layers, as done in OVOR (Huang et al., 2024), or in a fixed subset of early layers as in L2P (Wang et al., 2022b) and CODA-Prompt (Smith et al., 2023), may be suboptimal. Indeed, DualPrompt empirically demonstrates that separating general and expert prompt locations improves performance. CODA-Prompt further improves prompt capacity through input-conditioned composition of decomposed prompt components, but follows a similar predefined prompt-insertion strategy. From a topology perspective, these methods still adopt a static prompting topology or static gating (see Figure 1a), where prompts are injected into every layer or a fixed subset of blocks. Such designs apply the same prompt activation pattern to all samples, leading to uniform computational and parameter usage regardless of task difficulty or input complexity. RainbowPrompt (Hong et al., 2025) partially relaxes this limitation by introducing task-conditioned probabilistic gates that learn where to insert prompts across layers for each task (Figure 1b). This task-level topology improves over manually predefined prompt locations and complements its diversity-enhanced prompt evolution mechanism. However, its gating mechanism remains task-conditioned, the learned topology is shared across all inputs within a task, ignoring instance-level variations that may require adaptation at different depths.

Motivated by this observation, we introduce an input-conditioned prompt gating mechanism (see Figure 1c) that enables more precise layer-wise prompt activation for each individual input. This mechanism establishes an instance-specific topology that dynamically adjusts to the visual characteristics of each image. Inputs requiring fine-grained visual details may trigger prompts in the early layers with greater emphasis to refine low-level features, whereas images that align well with the frozen backbone may rely more on prompts in higher layers to facilitate label mapping. Furthermore, the gated prompts from previous tasks are dynam-ically aggregated with the current task prompt, enabling effective knowledge reuse across tasks through a dynamic knowledge fusion process. We hypothesize that this instance-conditioned prompting topology improves (1) the model's ability to capture fine-grained intra-task variations, and (2) long-term knowledge retention by selectively engaging only relevant historical prompt knowledge for each input. Besides improving instance-level adaptability, this design is also prompt-efficient: it avoids dense component-based composition and additional prompt-evolving transformation modules, relying instead on compact task-specific prompts and lightweight gating modules.

The main contributions of our work are as follows:

  • We propose a novel prompt-based CL method, gated adaptive prompting (GAP-Prompt), which introduces input-conditioned gates to modulate layer-wise prompt activation for each instance. Moreover, by progressively integrating prompts from previous tasks with the current task prompt, GAP-Prompt forms an instance-specific prompting topology that enables adaptive knowledge reuse across tasks.

  • Our method achieves state-of-the-art (SoTA) results across multiple CL benchmarks, consistently improving accuracy while mitigating forgetting and maintaining stable performance under diverse task variations.