arXiv:2611.12777cs.LGNov 2026

Manuscript Offprint

arXiv:2611.12777

Anchor Behavior, Not Parameters: Rehearsal-Free Continual Learning with a Single Shared Prompt

Duy-Cuong Bui, Trung-Anh Dang, Vincent Nguyen, Duc V. Le, Ngoc-Son Vu

Abstract

Prompt-based continual learning adapts a frozen pretrained vision transformer by tuning a small set of prompt tokens. Recently, one-prompt methods which share one single prompt across all tasks make this paradigm maximally parameter efficient. The open question is how a shared prompt can keep the knowledge of old classes while being updated for new ones. Existing methods protect old knowledge in parameter space, where they freeze task-specific prompts, expand new components, or sparsely gate which tokens receive gradients. However, this method sacrifices plasticity, yet the drift it still permits in shared tokens can corrupt the prompt's function on past classes. What must be preserved is the prompt's behavior. We propose TEA-Prompt, which couples (i) a token evaluation module that assigns each prompt token a continuous, input-conditional relevance score injected into the attention logits, softly specializing tokens across tasks without discarding any of them, and (ii) an attention-behavior anchoring loss that constrains each token's attention output around class-specific query regions using only compact Gaussian query statistics without stored old images, weighted by the token's past relevance. Anchoring the attention value allows the parameters to continue updating freely, as long as their interaction remains unchanged. TEA-Prompt achieves state-of-the-art accuracy with markedly lower forgetting on CIFAR-100, ImageNet-R, and CUB-200 with only 0.38M parameters. Code is publicly available at https://github.com/cuongalcvp/TEA-Prompt.git

1. Introduction

Continual learning (CL) requires a model to learn new knowledge from a stream of tasks without catastrophically forgetting [9, 10, 30, 36]. With large pre-trained vision

transformers [11], prompt-based CL has become a leading rehearsal-free paradigm where the backbone is frozen to protect its general representations, and the adaptation is limited to a small set of learnable tokens [39, 44, 45].

Within this paradigm, most methods allocate task-specific prompts or expand prompt components as tasks arrive [16, 20, 39, 41, 44], so prompt memory and selection cost grow linearly with the number of tasks. The opposite design, a single prompt shared across all tasks [19, 23], keeps parameters and compute constant regardless of the task count. It also highlights the main difficulty: When a shared prompt adapts to new tasks, what prevents it from forgetting old knowledge?

Examining existing methods reveals a common pattern: they act in parameter space. (i) Isolation and freezing: task-specific prompts are frozen once their task ends [41, 42, 44], and expansion-based methods freeze previous components while training new ones [39]. (ii) Selection sparsity: only retrieved prompts are updated in pool-based methods [45], and sparse Top-K gating over a decomposed shared prompt lets only the selected components receive gradients, complemented by a prototype loss on prompt keys [23]. Across these two families, the implicit assumption is the same: old knowledge is safe if and only if old parameters stay (nearly) where they were.

We argue this assumption is flawed on both sides. Firstly, it is too strong: Freezing and expansion tie stability to capacity, and sparse gating leaves unselected tokens idle. All paying in plasticity or parameters. Secondly, it is too weak: What an old class actually needs is that the prompt keeps producing the same attention contribution for its inputs. In classical CL, this is precisely the argument for regularizing in function space rather than weight space [4, 40], and attention-level preservation has proven effective for fully trainable ViTs [32]. Prompt-based CL, however, still lacks a function-space preservation mechanism. Even though, with a frozen backbone, the only source of attention drift is the prompt itself, making its behavior both necessary and sufficient object to protect.

In this paper, we propose TEA-Prompt, which protects the shared prompt's behavior rather than its parameters, through two coupled components. First, a token evaluation module treats the shared prompt as a set of key-value token pairs and assigns each token a continuous, input-conditional relevance score, computed from the correlation between the input query and the token's key and passed through a sigmoid-based evaluation function. Injected as a penalty into the attention logits, the score lets relevant tokens dominate adaptation for the current input while attenuating the rest, inducing a soft, task-conditional specialization of tokens. Second, an attention-behavior anchoring loss stores compact class-wise Gaussian statistics of reduced queries. When learning new tasks, it samples queries from these distributions and penalizes deviations of each token's attention output from its previous behavior. Crucially, the two components are coupled: the deviation of each token is weighted by its past relevance score, so preservation concentrates exactly on the tokens that mattered for old classes, while low-relevance tokens are free to adapt aggressively.

The main contributions of our work are as follows:

• We recast anti-forgetting in shared-prompt CL as behavior preservation instead of parameter preservation, and instantiate it with a class-conditional, data-free attention anchoring loss using compact Gaussian query statistics and the previous prompt tokens.

• We introduce a token evaluation module that assigns continuous, input-conditional relevance to each prompt token, softly specializing tokens across tasks to reduce cross-task interference; its stored past scores direct the anchoring loss toward the tokens where preservation matters.

• Extensive experiments on CIFAR-100, ImageNet-R, and CUB-200, including self-supervised backbones, show state-of-the-art accuracy and the lowest forgetting among shared-prompt methods at efficient parameter and compute cost.

References (48)