CLAP4CLIP: Continual Learning with Probabilistic Finetuning for Vision-Language Models

Authors: saurav  jha
dong  gong
lina  yao
Venue: NeurIPS_cc_2024_Conference
Published: 2024-05-14 13:35:30

Abstract: Continual learning (CL) aims to help deep neural networks to learn new knowledge while retaining what has been learned. Owing to their powerful generalizability,  pre-trained vision-language models such as Contrastive Language-Image Pre-training (CLIP)  have lately gained traction as practical CL candidates. However, the domain mismatch between the pre-training and the downstream CL tasks calls for finetuning of the CLIP on the latter. The deterministic nature of the existing finetuning methods makes them overlook the many possible interactions across the modalities and deems them unsafe for high-risk tasks requiring reliable uncertainty estimation. To address these, our work proposes **C**ontinual **L**e**A**rning with **P**robabilistic finetuning (CLAP) - a probabilistic modeling framework over visual-guided text features per task, thus providing more calibrated CL finetuning. Unlike recent data-hungry anti-forgetting CL techniques, CLAP alleviates forgetting by exploiting the rich pre-trained knowledge of CLIP for weight initialization and distribution regularization of task-specific parameters. Cooperating with the diverse range of existing prompting methods, CLAP can surpass the predominant deterministic finetuning approaches for CL with CLIP. We conclude with out-of-the-box applications of superior uncertainty estimation abilities of CLAP including novel data detection and exemplar selection within the existing CL setups. Our code is available at https://github.com/srvCodes/clap4clip.

Main paper: 
 introduction: 
 Learning in the real world involves dealing with the ever-changing distributions of task streams and their data [2, 3, 4] . Given the constraints on resources and privacy, there is also no guarantee for re-training a network on all previously seen data [5] . Continual learning (CL) aims to learn from such data/task stream without catastrophic forgetting [6, 2] of past data/tasks. A challenging CL setup is the class-incremental learning setting, where new classes emerge with new tasks, and at test time, a model must infer from all seen classes without known task IDs [7, 8] .Recent years have seen pre-trained multi-modal foundation models excel on several domains [1, 9, 10] . One such example for the vision-language (VL) domain is the CLIP [1] model that comes with strong zero-shot generalizability acquired by learning to match large-scale image-text pairs in a contrastive manner [11] . However, to adapt well to downstream tasks, CLIP must be finetuned on the task-specific data [12, 13] . Considering both the need for continually finetuning pre-trained models on streaming tasks and their perks over training from scratch [14] , our work studies CL with CLIP.An issue with the existing deterministic approaches to finetuning [13, 12] is that these overlook the uncertainties arising from many possible interactions between the visual and textual cues of downstream tasks. For instance, on the textual side, while a good generic hand-crafted prompt for images is "A photo of a {class}", there can be instances where further tailored prompts help We identify four such suitable design choices for probabilistic modelling. Choice #1 [17] performs variational modelling by imposing prior on the prompt space which makes it prompt-type dependent while also interfering with the in-domain knowledge learning capability of the prompts -a criterion crucial in the deployment of CL models. Choice #2 (see Sec. 3.2.1) instead imposes a prior on the outputs of the text encoder. While this makes it prompt-type agnostic (as the text features can now be derived from arbitrary prompt types), not taking the visual information into account nevertheless leads to the loss of information about cross-modal interactions between the visual and textual cuesa property essential for preventing cross-modal deviation of finetuned features in CL (see Sec. 3.2.2). Choice #3 (Ours) leverages the best of both worlds by modelling the distribution of visual-guided text features. To further refine the learned distributions of CL tasks, we finally introduce lightweight task-specific adapter modules in choice #4 that make the cross-task centroids more distinct while preserving the aforesaid properties (see Sec. 3.2.3).improve the image-to-text coherence. Similarly, on the visual side, images from the same class can have diverse range of backgrounds, poses, orientations, etc. Overlooking the uncertainties in imagetext matching can thus cause overfitting on downstream tasks and forgetting of the generalizable knowledge [15] . For CL, where we seek to adapt CLIP on a stream of tasks, this can further lead to the cross-modal features increasingly deviating from each other to the point of catastrophic forgetting (see Fig. 3b ). While existing methods [16, 17] model such uncertainties through probabilistic finetuning, these remain subpar at CL given: (a) their inaptness to leverage existing prompt-based approaches [16] , (b) their excessive trading of in-domain performance for generalization [17] .Lastly, like other autonomous real-world agents, CL models deployed in mission-critical settings (healthcare, transport, etc.) can benefit from uncertainty awareness by calibrating their predictions to reliably assess their confidences [18, 8] . Hence, to enhance the usage of the pre-trained CLIP for real-world CL tasks, we design a finetuning approach with the following three properties (see Fig. 1 ): A) probabilistic modeling of cross-modal task cues for better generalization; B) compatibility with prompt-based finetuning methods [14, 12, 19, 20] to exploit their finegrained in-domain task knowledge; C) leveraging the rich pre-trained knowledge of CLIP to further counter forgetting.To this end, we design a principled Variational Inference (VI) framework that learns the functional space of task-specific posterior distributions based on text features that are aligned with their visual counterpart (property #A). To refine these variational task posteriors, we draw our motivation from Bayesian mixture-of-experts ensembles [21, 22] , and employ lightweight task-specific adapter modules that model task-specific distributions. Our final prediction is thus a mixture of logits derived from individual task adapter modules. To further counter the forgetting in these modules, we diverge from the recent trend of internet data-hungry CL techniques [23, 24] . Instead, we exploit the readily available pre-trained language knowledge of CLIP for weight initialization and task distribution regularization (property #C). Finally, by modelling the distribution of the text feature space, our probabilistic finetuning method boasts a rich modular nature as the features can be derived from arbitrary prompt types (property #B). In particular, we show that our framework can inherit the in-domain knowledge of hand-crafted [1] , uni-modal [12] , multi-modal [20] , or instance-conditioned [19] prompts. We backronymize our finetuning approach as CLAP -Continual LeArning with Probabilistic finetuning -for the pre-trained CLIP model. Our experiments across several settings show that CLAP4CLIP enhances prompt-based finetuning for CLIP, and surpasses the predominant deterministic finetuning methods in terms of in-domain performance, output calibration, and generalization to unseen CL tasks, all while sharing a similar resource overhead. We study some out-of-the-box perks of CLAP's probabilistic nature by leveraging its uncertainty estimation capabilities on a proposed post-hoc novel data detection setup and on exemplar selection for CL. 
related work: 
 Continual Learning (CL). The existing CL literature is predominated by three categories of methods: (a) Regularization-based methods [6, 25, 26] alleviate forgetting by punishing changes to the parameters that are important to previous tasks; (b) Architecture-based approaches learn parameters that are specialized for individual tasks either by network expansion [27] or by sub-network composition [28, 29] ; (c) Rehearsal-based approaches [30, 5] rely on storing a fraction of the past task experiences in a memory to train with the current task. Each category has its own flaw -methods in (a) struggle to discriminate inter-task classes [31] ; those in (b) often require task oracle during inference; those in (c) are sensitive to the memory sizes besides being prone to overfitting on the memory samples [32] . Hence, practical CL calls for combining these. Our work leverages (a) via function-space regularization (Sec. 3.4), (b) via task-specific modules (Sec. 3.2.3), and (c) via herding-based replay (see App. A.1.1).Vision-Language Models (VLMs) finetuning. The powerful generalizability of pre-trained VLMs [9, 33] like the CLIP [1] has enabled their zero-shot applications to a range of downstream tasks, including CL [14] . In practice, their performance on downstream out-of-domain data remains rather weak [34, 35] . For such cases, finetuning on task-specific data is a natural choice. Instead of performing extensive full finetuning on all parameters, some parameter-efficient finetuning (PEFT) methods learn a lightweight feature adapter module for textual and/or visual paths [13, 36] . Another line of PEFT methods learns soft prompts which are a few continuous tokens serving as inputs to the frozen visual and/or textual encoder(s) to capture task-specific information [12, 37, 20] . Existing works on CL with pre-trained CLIP have leveraged either [19, 38] or both [39] of these methods. However, such finetuning methods remain deterministic in nature. This imposes an explicit constraint on the modeling of the possible ways in which the visual and the textual semantics interact.To address the aforesaid flaw, one could turn to adapt the existing probabilistic finetuning approaches to capture the cross-modal interactions in CL tasks. For instance, [16] learn the distribution of hand-crafted prompts while [17] propose variational prompt tuning (VPT) conditioned on the input images. Yet these methods are limited in their efficacy. [16] is incompatible with conditional prompt learning [37] , which is an extensively studied PEFT field. VPT [17] trades in-domain performance excessively in favor of generalizability -a trait detrimental in the deployment of CL models. Our work aims to bridge these gaps for probabilistic finetuning all while adapting it for CL.Question: Does the paper discuss the limitations of the work performed by the authors?Answer: [Yes]Justification: We detail the limitations of our work in App. E. This includes parameter overhead and design choices.Guidelines:• The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper. • The authors are encouraged to create a separate "Limitations" section in their paper.• The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be. • The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated. • The authors should reflect on the factors that influence the performance of the approach.For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon. • The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size. • If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness. • While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations. 
preliminaries: 
 Continual Learning (CL). Class-incremental CL [7] aims to learn from a sequence of T tasks[(C 1 , D 1 ), (C 2 , D 2 ), ..., (C T , D T )]. Each task t ∈ [1, T ] has its training data D t = {(x 1 , y 1 ), (x 2 , y 2 ), ..., (x k t , y k t )}, where x and y are the input images and labels, respectively from the set of classes C t = {c t 1 , c t 2 , ..., c t n t }. Following [40, 41] , we assume any two task-specific sets of classes to be disjoint: C i ∩C j = ∅. A neural network with parameters ϕ is then trained on task t using D t to minimize the cross-entropy loss over C t . At test time, the model is evaluated on all seen classes C = t i=1 C i , where the past task predictions are prone to forgetting. As a solution, rehearsal-based methods [42, 43] replay past task samples from a memory M during training. Following [30] , we use herding [44] to maintain M (see App. A.1.1 for details).CLIP with prompt. CLIP comprises an image encoder f (x) acting on an image x ∈ R 3×H×W of height H and width W , and a text encoder g(t(p)) acting on a word embedding vector t ∈ R (L×e) derived from a text prompt p ∈ R ((L-1)×e) . Here, L is the text length, and e is the text embedding dimension. The encoders's outputs are used in the prediction of the class y i as:EQUATION)where τ is a learnable temperature parameter, ⟨•, •⟩ is the cosine similarity, and the c-th class text feature t c = [p, e c ] is the result of adding a class-specific word embedding e c to the prompt p. The The task distribution samples are then fused with the original task features prior to deriving the task logits y t . All task logits are concatenated to produce the final prediction y 1:t . features g(t c ) for all classes are used as the weights of a linear classifier. In CL, g(t c ) would thus encode the features for classes c ∈ C seen until task t. Eq. ( 1) forms a contrastive training criterion for the text and visual modalities, whose rich representation allows pre-trained CLIP to be used for zero-shot classification through hard prompt templates, i.e., p c = "A photo of a {c th class}".CLIP finetuning with learnable soft prompts. To improve the CLIP performance on a downstream task t, soft prompts use a set of learnable vector tokens p = {p 1 , p 2 , ..., p L }. CoOp [12] shares p with all classes of a task. MaPLe [20] learns multi-modal prompts by employing two such token sets p f and p g until the J-th layers of the vision and the text encoders of CLIP, respectively. AttriCLIP [19] selects a subset of prompts conditioned on the input: {{p j } 1≤j≤L |x k }. Learning p (with frozen CLIP weights) thusly helps encode task/modality/instance-conditioned context for a given task.CLIP finetuning with adapters. Adapter-based methods like CLIP-Adapter [13] learn lightweight modules over text and/or visual features of the frozen CLIP model. With a text adapter A t , the updated text features from Eq. ( 1) can be rewritten (with a slight abuse of notation) as:EQUATIONwhere α and β control the strength of the residual connection between the adapted and the pretrained models' features, e.g., β = 1 -α in [13] .Overview. We develop our CLIP-based probabilistic finetuning model using a Bayesian VI framework (see Fig. 2 ). Sec. 3.2.1 starts by making the case that, unlike previous VI-based finetuning approaches, the feature embedding space of the text encoder output is a superior choice for defining our functional space priors on. While linear adapter layers are often employed for obtaining the mapping from such a pre-defined feature-space prior to the function outputs [45, 17] , we show in Sec. 3.2.2 that CL finetuning with generic adapter leads to the issue of cross-modal deviation. In Sec. 3.2.3, we then propose refining our variational distribution on function space using an ensemble of task-specific adapters that are built on top of cross-modal aligned text features.We are interested in modeling the stochastic processes that generate the labels y for the inputs x of a CL task t. To this end, we assume a prior distribution p χ over the text feature of the c-th class: p χ (t c (p)). We can then draw M number of latent variables z = {z m ∼ p χ } M m=1 to represent the c-th class text feature t c (p) as a linear combination of the text encoder feature g(t c (p)) and z: where Eq. (3b) replaces g(t i ) in Eq. ( 1) by t c (p). Eq. (3b) thus results into M number of predictions whose distribution gives us the model's epistemic uncertainty about the correct prediction. To deal with the intractability of the marginal likelihood, we optimize for the evidence lower bound (ELBO) using a variational posterior q ϕ that approximates the prior p χ based on the KL-divergence loss D KL :EQUATIONEQUATIONEQUATIONBy assuming p χ to be the (static) standard Gaussian N (0, I) and q ϕ to be the (learnable) Gaussian N (µ(t c ), σ(t c )), whose mean µ and standard deviation σ are parameterized by linear adapter layers, we can ensure that the random variable z remains differentiable by reparameterization trick [45] . Accordingly, we refer to the parameters [µ; σ] together as probabilistic adapter from here onward.Imposing the prior over the text feature offers us further advantages over that in the prompt embedding space as done by VPT [17] (also see App. Fig. 1 for an illustration). First, Eq. (3b) is prompt-type agnostic as the text features g(t) could be derived from any existing soft [37, 19, 20] or hard [14, 13] prompts. 2 Second, by leaving the prompt embedding space intact and injecting stochasticity into the feature space, we can better learn the task-specific knowledge known to be encoded by the prompt embeddings [46] . This can help bypass the loss of in-domain performance. In CL, the latter property is crucial for our model to perform well on all previously seen tasks. Third, as the latent variable z is now directly used to infer the logits, it naturally favors generalization by influencing the predictions. On the contrary, the effect of the prompt space prior on the predictions is indirect as it is mediated by the representations of the entire text encoder layers. This can make the influence of the prior harder to control and can hinder the aforesaid interpretability in the model's predictions.Efficient continual finetuning with a probabilistic adapter. Finetuning adapters for CL is not straightforward. Namely, we have the overhead of searching for task-specific residual ratio α (see Eq. ( 2)) which is sensitive to the training setup including dataset and prompt-type [13, 36] . This has particularly worse implications for a probabilistic adapter like ours, where a larger α can inject enough noise to corrupt the pre-trained representations to the point of catastrophic forgetting (see Fig. 3a ). For efficient learning of our adapter, we thus seek to retain no additional overhead of hyperparameter search for the residual ratio. Subsequently, we use α = β = 1 through our work.To perform CL with variational modelling in the text feature space, we first take a step back to investigate how CL in general affects the cross-modal deviation [47] between the learned text and the frozen visual features of finetuning methods. To this end, we consider two basic CL models: the CoOp [12] and the CoOp with a CLIP-Adapter [13] . Then, for the base task (t = 1) test samples of CIFAR100, we compute the average of the Rotation Angle Matrix (RAM) [47] using the CL models' frozen visual f (x) and learnable textual g(t c (p)) features at each incremental test step. Fig. 3b shows the deviation of the learned textual features from their (frozen) visual counterparts for the CoOp. This implies that the cross-modal retrieval performance of CLIP finetuned with learnable prompts deteriorates with incremental training. Moreover, as a generic adapter (CoOp + Adapter) does not remedy the cross-modal deviation, this sets a direct hindrance in employing our probabilistic adapter to learn the variational distribution q ϕ .Variational modeling on visual-guided text features. For variational modeling of text features t c (p) that remain aligned with the visual features during continual finetuning, we propose enriching the text features with the visual context through an explicit attention mechanism (see App. A.3 for further justification on this design choice). To this end, we treat the text features as queries Q and the visual features as keys K and values V , and adopt a standard transformer-styled decoder block [48] as a task-shared Visual-guided attention (VGA) module. The VGA module performs text-to-text self-attention followed by text-to-visual cross-attention. To eliminate the influence of the text features from multiple CL tasks, a naive strategy is to perform specialized VGA forward passes with task-specific queries [27] . We seek to replace several such costly VGA passes with a single pass.To do so, we exploit the global nature of our visual context and mask out (set to -∞) all inter-task connections in the queries using a target mask. This ensures that only the task-specific text features undergo self-attention while the entire query still attends to the visual context:EQUATIONwhere tk c is the task-specific visual-guided text feature which is fused with the residual task-specific text encoder feature g(t t c ) to derive the task embedding tt c . We note that in a non-CL setup, [49] employ the VGA module using the per-pixel spatial features (obtained before global average-pooling) instead of the globally pooled visual features of the ViT [50] . Our choice for the latter favors the efficiency of our framework for large CL datasets where attending to per-pixel spatial features can incur much higher latency (see App. A.4 for a comparison).By exploring diverse modes in function space, ensembles of neural networks can better approximate the variational posterior [51, 22] . Motivated by this, we replace our task-shared adapter q ϕ with task-specific adapters {q i ϕ } t i=1 that parameterize the t-th task-specific posterior N (µ t , σ t ) over the task embeddings tt c :EQUATIONwhere z t m are the task-specific MC samples. Task-specific adapters thus serve as mixture-of-experts ensemble where each expert is trained on task-specific embeddings tt c and the logits computed using each expert is combined to derive the final prediction ŷ1:t (see Algo 1). The experts learn posteriors that are more discriminative across tasks. This is depicted in Fig. 4 using the cosine distance between the embeddings of the class-specific samples drawn from the posteriors. With task-specific adapters (right), the cross-task class centroids are more separable.To prevent interference from current task training data, we freeze the past task encoders during each incremental training step (t > 1). Moreover, to reduce the forgetting in past task adapters, we follow other parameter-isolation techniques [27, 42, 52] to finetune on a classbalanced dataset of new data and rehearsal data M at the end of each incremental training step (t > 1). We refer to this as memory consolidation training (see App. A.2). We also provide an overview of a test-time forward pass of our framework in App. A.5.Algorithm overview. App. algo. 1 outlines the pseudo-code of a forward pass of CLAP at t-th task test step. Here, a test image is to be classified into one of the classes {1, ..., |C t |}. Our method executes the computationally heavy VGA layers only once. The task-specific VGA outputs are passed to their respective adapters. By limiting the quadratic complexity of the VGA pass, our method induces minimal time overhead. By only expanding the linear adapters per task, our memory overhead is negligible compared to the large backbone of the pre-trained CLIP model (ablation Fig. 5 ).Like other finetuning methods, our probabilistic adapters are likely to trade the generalizability of text features for downstream task performances [12, 37] . On the contrary, the pre-trained CLIP text encoder with hand-crafted prompts [53] has strong generalizability because of its rich pre-trained language information. We propose to leverage this pre-trained language knowledge to help guide the incremental finetuning in CLAP. In the following, we assume {t h,l y ∈ R d } L l=1 to be the features corresponding to the L hand-crafted textual prompts for the class y ∈ C t .The functional spaces of the past task distributions are prone to forgetting in CL. Though replay helps alleviate the forgetting up to a certain degree, repeated training on the memory samples can lead to overfitting on these [32, 54] . To address this, previous works [8, 55] exploit functional priors for regularizing the visual space alongside memory replay. Here, we propose to regularize the past task distributions in the textual space by using the hand-crafted prompt-based features {t h,l y } L l=1 to distill the past task latent samplesz i = {z i m } M m=1 t-1 i=1 .Namely, the probability of the sample set z t belonging to a class y ∈ C t is:EQUATION)The resulting language-aware distillation loss is thus the sum of cross-entropy between the true label distribution y c and the predicted probability distribution P KD across all the past-task classes:EQUATIONwhere L KD serves as a data-free (i.e., no training samples required) text-to-text distribution regularizer that encourages the latent variable outputs from past-task adapters to stay close to the text features from the hand-crafted prompts. L KD is applied only during the memory consolidation training, that is, when the past-task adapters are trainable. Lastly, as L KD acts on the functional space of past tasks, this sets apart our setting from the non-CL setup of [56] where the language-aware distillation loss regularizes the vector embedding space.Stability gap [57] in CL refers to the temporary yet substantial forgetting of past task knowledge in the initial phases of updating a network's weights to learn an incremental task. An informed weight initialization can help bridge this gap over random initialization by stabilizing the learning for new task components [58] . We thus leverage the t-th task text features {t h,l y } L l=1 to initialize the weights w µ t , w σ t ∈ R d×d of our t-th task's linear adapter layer. Let s µ , s σ ∈ R |C t |×d be the mean and the std. dev. of the L text features. We initialize w µ t and w σ t as:EQUATIONApproximate ELBO. Building upon Eq. ( 4), we now learn the task-specific adapters q t ϕ to approximate the intractable t ∈ [1, T ] task-specific posteriors. The ELBO (see App. F for derivation) is:EQUATION)Overall objective. Denoting the loss weights by λ and γ, our total loss term can be given as L = L CE -λD KL + γL KD , where the cross-entropy L CE and the prior-matching D KL terms act on the outputs of all task encoders while the distribution regularization term L KD acts only on the past task encoders. λ is set to 0.001. As the past task encoders are trainable only during the memory consolidation training stage, λ for these is set to 0 during training. γ is set to 15.Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof? • The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them. • The full details can be provided either with the code, in appendix, or as supplemental material. 
experiments: 
 Datasets. We evaluate our method on CIFAR100 [3, 30] , ImageNet100 [41, 43] , ImageNet-R [59] , CUB200 [60] , and VTAB [60] . CIFAR100 [61] and ImageNet100 [62] setups split their respective original datasets into 10 tasks with 10 classes each. ImageNet-R [63] and CUB200 split 200 classes [39] . See App. Table 12 for statistical significance of these results using std. dev. scores.Method CIFAR100 ImageNet100 ImageNet-R CUB200 VTAB Avg ↑ Last ↑ Avg ↑ Last ↑ Avg ↑ Last ↑ Avg ↑ Last ↑ Avg ↑ Last ↑ Single-into 10 tasks with 20 classes each. VTAB has 5 tasks with 10 classes each [64] . While CIFAR100, ImageNet100, and CUB200 are robust settings for evaluating CL methods in the face of large forgetting, ImageNet-R and VTAB make challenging settings for CL methods using pre-trained models as these might include test images in their pre-training set (see App. A.1 for details).Baselines. We compare CLAP4CLIP against several baselines and state-of-the-art finetuning methods. These include: (a) CLIP-based methods -Continual-CLIP [14] , CoOp [12] , CLIP-Adapter [13] , AttriCLIP [19] , MaPLe [20] , and PROOF [39] , (b) vision-only methods -DualPrompt [59] L2P [65] , CODA-P [38] , (c) the baseline CIL method -iCaRL [30] . For a fair comparison, we adhere to the experimental protocols of PROOF [39] throughout. We adopt ViT-B/16 with the pre-trained weights of OpenAI [1] as our backbone unless otherwise specified. As the upper bounds on performance, we use the CLAP4CLIP with single and task-specific encoders, trained on all tasks jointly (JOINT).Variants. We integrate our method with four prompt-based approaches: Ours uses CLAP with handcrafted prompt templates, CoOp + Ours with soft prompts [12] , MaPLe + Ours uses multi-modal soft prompts [20] , and AttriCLIP + Ours uses CLAP4CLIP with instance-conditioned soft prompts [19] . Ours w/o Variational Inference (VI) is the deterministic variant of Ours depicted in App. Fig. 7 . We leave the details of the training and the hyperparameters of our models in App. A.2.Performance measures. To quantify CL performances, we report: (a) the final accuracy after the last incremental step (Last) and the average of the accuracies after each step (Avg) [30] , and (b) the backward transfer score (BwT) [66] to quantify forgetting. To assess the benefits of probabilistic modelling, we report: (a) the expected calibration error (ECE) [67] that measures the calibration in the model's predictions [68] , and (b) the (forward) transfer score [69] that quantifies the generalizability of CL models by measuring the extent of their zero-shot transfer ability after finetuning.Accuracy. We report performances in Table 1 on all five datasets. Our method consistently achieves the best results among all the methods compared. Notably, on CIFAR100 and ImageNet100, our variants using the hand-crafted and multi-modal prompts outperform the others. On the challenging ImageNet-R setup with significant intra-class diversity, our method can better leverage the instanceconditioned prompt knowledge of AttriCLIP [19] , which helps it outperform PROOF [39] by 1.46% in terms of average accuracy. On CUB200 and VTAB, sharing the prompt pool among all tasks gives CoOp [12] an edge over other baselines. Leveraging CoOp offers us the best results on these while surpassing PROOF, which also builds upon CoOp with task-specific soft prompts. We also observe that VPT [17] lags on all CL settings. Comparing the performance evolution of our variants against other baselines shows that our variants perform better throughout the incremental steps (App. Fig. 8 ).Forgetting. Table 13 shows that in general, plugging CLAP4CLIP with prompt-based finetuning methods helps improve the BwT scores of the latter. It is worth noting that on the cross-dataset setting of VTAB [64] , our variants are the only methods that effectively transfer the knowledge learned from incremental tasks to improve the performance on past tasks (i.e., BwT > 0). This indicates that our probabilistic modeling strategy does not only counter forgetting but can also help bring anti-forgetting properties onto existing finetuning methods.Calibration. App. Table 15 compares the ECE scores of our variants and their respective underlying deterministic baselines at the last test step. In general, our variants help enhance (decrease) the ECE scores of the underlying prompt-based methods. This implies that even in the face of forgetting in a CL setup, CLAP retains more reliability in assessing the confidence of its predictions.Generalization. App. Table 14 shows that our method consistently enhances the (forward) transfer scores of the underlying deterministic prompt-based methods. This means that CLAP can better transfer the learned knowledge from seen tasks to help solve future tasks.Resource-constrained CL. To study the robustness of CLAP towards memory and computeconstrained environments, we ablate its performance on replay-free [70] and computationallybudgeted [23] CL setups, respectively. Tables 16 and 17 show that for both these setups, leveraging the instance-conditioned and semantically diverse prompts of AttriCLIP provides an edge. Here, our variant leveraging AttriCLIP surpasses the replay-free SOTA, i.e., CODA-P [38] and the budgeted SOTA, i.e., AttriCLIP [19] . Further ablating the role of our proposed language-aware distribution regularization and weight initialization components for our AttriCLIP variant shows that the former component remains crucial for avoiding forgetting under resource-constrained settings.To simulate real-world settings with long sequence of tasks and large distribution shifts, the CDCL setting [19] trains a model sequentially on ImageNet100 and CIFAR100 (i.e., on 20 tasks), and evaluates it jointly on these. For a fair comparison with [19] , we adopt the ViT-L/14 as our CLIP backbone and set the train/test batch size to 32. All other settings remain the same as in Sec. 4.1. Table 2 reports the last task accuracy of different methods. While all our variants improve the CDCL performances of their respective baselines, combining ours with AttriCLIP [19] leads to the most gains. This further suggests that our framework can reliably leverage the diverse nature of learned prompts to inherit their setting-specific advantages.We provide a few ablations of the training pipeline for CLAP4CLIP below and leave more in App. C.Influence of components. We ablate the importance of different components of CLAP4CLIP in Table 3 . On top of the base CLIP model, we first train a probabilistic encoder. Adding the VGA module and the memory consolidation training stage helps us achieve more stable performances while countering forgetting. We then apply task-specific encoders which make the centroids of the class-specific latent variable more separable (see Fig. 4 ) thus improving the last task accuracy by 2.21%. Language-aware weight initialization and regularization help improve the last task accuracies by 0.78% and 0.23%, respectively. Weight initialization further helps us tackle the stability gap [57, 58] (see App. C.6 for more ablations on language-aware components).Probabilistic vs Deterministic inference. To understand our probabilistic inference modules further, we examine their performance against the deterministic variant of ours (Ours w/o VI). Table 1 shows that our probabilistic variant consistently outperforms its deterministic counterpart. This emphasizes the advantages of considering uncertainty in finetuning. We further introspect the effects of the number of layers for the VGA and task encoder modules in our framework in App. C.3.Time analyses. We compare the inference time per iteration for different methods. As shown in App. Parameter analyses. The additional parameters in CLAP4CLIP come from the shared VGA module and the task-specific encoders. For a ViT-B/16 backbone of output dimension, d = 512 on CI-FAR100, the VGA module contains 4,204,032 parameters. The mean and the std. dev. layers for 10 tasks have d × d parameters each, i.e., 524, 2880 parameters. Hence, the CLAP4CLIP has 9.5 million extra parameters, which is negligible compared to the pre-trained CLIP with ≈ 150 million parameters. We report the parameter counts in Fig. 5 . 
out-of-the-box utilities of probabilistic finetuning: 
 We study the out-of-the-box utilities of CLAP4CLIP's uncertainty quantification (UQ) capabilities.Our motivation for these is not to achieve state-of-the-art performance but to highlight the perks of probabilistic modeling in scenarios where the deterministic CL finetuning methods struggle. Post-hoc novel data detection (PhNDD). PhNDD uses a pre-trained classification model to identify novel data based on the output confidence [71, 72] . For CL, this can help discern the arrival of new tasks, expand the network, etc. To evaluate the PhNDD capabilities of models within a CL setup, we design a simple setting. Namely, at all but the last test step, we treat the test data from the past and the current tasks as seen while those from all future tasks as novel. We then use FPR95, AUROC [73] , and AUPR [74] scores as our performance metrics (see App. D.1) averaged over all but the last incremental test steps. To quantify the output confidence, we rely on the Energy score [75] given its aptness for pre-trained models. Exemplar selection. We employ the entropy (averaged over M predictions) of CLAP's softmax outputs as our exemplar selection criteria [2] . Table 20 shows the efficacy of entropybased rehearsal for our method, where other deterministic methods lag due to their inconsistent UQ capabilities. Next, we employ the energy [75] and the variance of the softmax outputs as our selection criterion and contrast these against other criteria proposed in [2] . Fig. 6 shows that variancebased exemplar selection outperforms random, and is only second to iCaRL [30] in terms of Last accuracy. We note that deterministic methods with pointwise predictions cannot use variance for exemplar selection. 
conclusion: 
 In this paper, we propose CLAP4CLIP, a probabilistic finetuning method for learning task-specific distributions over visual-guided textual features. Our model shares the visual-guided text alignment module across all tasks while adding lightweight task-specific encoders to learn fine-grained task distributions. Besides leading to little memory overhead, this architecture is compatible with several prompt-tuning-based methods thus helping us inherit their respective perks on different CL settings.Our experiments show the superior results of CLAP4CLIP across several datasets and settings. We conclude with two out-of-the-box utilities of our method wherein existing continual learning methods lag: post-hoc novel data detection and uncertainty-based exemplar selection. We discuss our limitations, potential future research directions, and the broader impact in App. sec. E. 
acknowledgement: 
 This work was partially supported by a Discovery Early Career Researcher Award Fellowship (DE230101591) awarded by the Australian Research Council (ARC) to Dong Gong. We are grateful to Daniel Marczak and M. Jehanzeb Mirza for their insights on the need for continual finetuning of the pre-trained CLIP model. Hand-crafted prompts 1 ): the taskspecific text features are fed to their respective task encoders, consisting of only the mean µ layer each. There is no sampling involved and the task mean outputs are fused directly with the original task features prior to deriving the task logits y t . All task logits are concatenated to produce the final prediction y 1:t .Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments? Answer: [Yes] Justification: We report the standard deviation scores for our main results in Table 12 .Guidelines:• The answer NA means that the paper does not include experiments.• The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper. • The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions). • The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)• The assumptions made should be given (e.g., Normally distributed errors).• It should be clear whether the error bar is the standard deviation or the standard error of the mean. • It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a 96% CI, if the hypothesis of Normality of errors is not verified. • For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates). • If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text. 
experiments compute resources: 
 Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?Answer: [Yes] Justification: We leave these details in App. A.2.Guidelines:• The answer NA means that the paper does not include experiments.• The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage. • The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute. • The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper). 
code of ethics: 
 Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines?Answer: [Yes] Justification: We have followed all the listed NeurIPS Code of Ethics.Guidelines:• The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.• If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics. • The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction). 
broader impacts: 
 Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?Answer: [Yes] Justification: We discuss these in App. E.1.Guidelines:• The answer NA means that there is no societal impact of the work performed.• If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact. • Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.• The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster. • The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology. • If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML). 
safeguards: 
 Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?Answer: [NA] Justification: To the best of our knowledge, the pretrained CLIP model does not have any such associated high risk.Guidelines:• The answer NA means that the paper poses no such risks.• Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters. • Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images. • We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.12. Licenses for existing assets Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?Answer: [Yes]Justification: We have provided citations wherever necessary.Guidelines:• The answer NA means that the paper does not use existing assets.• The authors should cite the original paper that produced the code package or dataset.• The authors should state which version of the asset is used and, if possible, include a URL. • The name of the license (e.g., CC-BY 4.0) should be included for each asset.• For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided. • If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset. • For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided. 
 
 Appendix: A. We evaluate our method on five datasets, the details of which are reported in Table 5 . Following [39] , we shuffle the order of training classes for all but the VTAB dataset with the random seed 1993. While the original VTAB [76] includes 19 evaluation tasks from three categories (natural, specialized, and structured) and their respective sub-domains, we rely on the five datasets cross-domain classincremental subset proposed in SimpleCIL [64] . The five datasets (used in the same streaming order) include Resisc45 [77] , DTD [78] , Pets [79] , EuroSAT [80] , and Flowers [81] . To make the classes emerge from domain to domain, we do not shuffle the class order for VTAB.Following [30, 41] , we employ the herding algorithm [44] to choose the exemplars for our main experiments. Following the previous works [82, 39] , we rely on two typical methods to populate the memory:1. For CIFAR100, ImageNet100, and VTAB, given their lesser number of classes, we employ the first policy, and keep a total of 2,000, 1,000, and 1,000 exemplars, respectively. This amounts to the respective sub-totals of 20 and 10 exemplars per class after the last incremental stage. We choose these sizes for a straightforward comparison with the existing works, i.e., PROOF [39] for CIFAR100 and AttriCLIP [19] for ImageNet100. For VTAB, the chosen memory size reflects the fact that we have only 1, 796 training instances in total (see Table 5 ). For ImageNet-R and CUB200 with 200 classes each, we adopt the second policy and store 20 exemplars per class.We train CLAP and its variants using SGD, with a batch size of 64, for 5 epochs, including Hyperparameter tuning. To the end goal of obtaining task-agnostic hyperparameters [83] , we tuned our hyperparameters using a validation set comprising 10% of the CIFAR-100 training dataset.Similar to [27] , performing the hyperparameter search only on the CIFAR100 setup helps us avoid optimizing for the number of tasks while generalizing across all our other setups. Table 6 shows the candidate values for the hyperparameter grid search and their best-chosen values. Tables 7, 8, 9, and 10 report the last task accuracy scores (Last) corresponding to the hyperparameter search for the number of training epochs, the number of finetuning epochs, the coefficient γ and the coefficient λ, respectively. Fig. 9 in the main paper reports the accuracy and the runtimes for the different numbers of MC samples M . We will release the full source code upon the acceptance of our paper. We opt for the probabilistic modeling of task-specific text feature space rather than the image feature space mainly in light of the practical constraints imposed by the class-incremental learning (CIL) setting. In CIL, at test time, we are not given the task labels for images. As such, if we were to use task-specific adapters to model task-specific visual features distribution (rather than task-specific text features distribution), then we must infer which images are to be routed to what adapter. Existing solutions [8] to task id inference would route the text-guided visual features to all available adapters and then infer the correct prediction based on the adapter's outputs. Such an exhaustive routing mechanism greatly increases the test-time computational burden. Instead, we exploit the multimodal nature of CLIP [1] to model the distribution of visual-guided text features. This helps us avoid test-time task id inference as now our visual features form a shared context to which all task-specific text features (which we can distinguish simply by their labels) can attend. By sampling from the distributions over such visual-guided task-specific text features, we compute their cosine similarities with the visual features to obtain our predictive logits.We compare the performance of VT-CLIP-styled VGA with Ours. To align the text features with the image features, the former uses per-pixel spatial features obtained from the ViT prior to global pooling while we use the globally pooled features. To complement the results in Table 1 , Fig. 8 compares the accuracy of different methods at each evaluation step across all datasets. Our major conclusions are briefed as follows. A) The base task performance of CLAP4CLIP (ours) is consistently higher than other methods including the state-of-the-art PROOF [39] . This suggests that our probabilistic finetuning framework is effective for general downstream tasks in a non-incremental setting. B) For the CL settings in Table 1 where either of the CLAP4CLIP variants achieve the best performances, their performance curves also consistently retain superior results across all evaluation steps. This validates the effectiveness of our method at tackling forgetting. C) Similar to [39] , we notice that CLAP4CLIP achieves a significant performance improvement over vision-only methods (L2P and DualPrompt). This indicates the merits of considering text and visual cues together for continual learning.ŷi ← ∅ // Null prediction set We vary the number of MC samples M from 1 to 50. In Fig. 9 , the accuracy is poorer in range [1, 10] , grows in range [10, 20] , and saturates thereafter. Hence, we set M to 20 for all our experiments.6 for m ← 1; m ≤ M ; m += 1 do 7 z i m ∼ N µ i , σ i //We ablate the task head predictions over the test set of each task on CIFAR100 (see App. C.2 for more details). Fig. 10a reports the accuracy of test set samples corresponding to the task encoder heads at the end of incremental training on the last task. Here, the first row is to be interpreted as follows: 77% of test samples belonging to test set of the first task (test set ID 1) were correctly allocated to task head 1, 1.4% of test samples belonging to test set of the first task (test set ID 1) were incorrectly allocated to task head 2, and so on. Visualizing the task head selection results for the last task evaluation helps us uncover the amount of forgetting among the individual task heads at the end of the incremental training. Here, at the first test step, we have only one task head and thus the task head selection accuracy is 100%. At the second test step, we have the test samples from two seen tasks as well as two available task heads. Out of all test samples of task 1, the reported 94.5% were correctly classified into the task head 1 while the rest 5.5% were incorrectly classified into the task head 2. Similarly, for test samples belonging to task 2, 3.1% were incorrectly classified into the task head 1 while the reported 96.9% were correctly classified into the task head 2, and so on. Hence, by studying the task head selection per incremental step, we can investigate the trend of forgetting among the individual task heads. To further investigate the effects of inference modules on performances, we vary the number of layers for the VGA module (sec. 3.2.2) and for the task-specific encoders (sec. 3.2.3). Fig. 11a reports the results of varying the number of Transformer Decoder layers [48] in the VGA module. As the number of layers grow, the average accuracy (Avg) increases while the last task accuracy (Last) decreases. This indicates that while a larger number of layers in the VGA module lead to an increase in the initial tasks' performances, these are amenable to larger forgetting on latter incremental steps.In Fig. 11b , we report the performances for varying number of MLP layers in the mean and the standard deviation heads of the task distribution encoders. Unlike the VGA module, here we observe a consistent trend of decreasing last and average task accuracy with the increase in the number of layers. This clearly indicates the superiority of using a single-layered task distribution encoder. To study the role of a more informed prior in our VI framework, we study three choices of priors to be used in the prior-matching term of eq. ( 10): (a) the static (standard normal) prior, (b) the language-aware prior using the distribution obtained from the task encoders using the hand-crafted prompts' features {t h,l y } L l=1 (sec 3.3), (c) the data-driven prior using a randomly chosen subset of a training minibatch as the context set to condition the prior on (see App. G for more details). App. Table 18 shows that while (b) and (c) slightly improve over (a) in terms of accuracies and forgetting, these come at the cost of poorer model calibration and longer runtime per iteration. C.5 Inference time for different finetuning methods.Table 19 investigates the inference time per iteration for different methods. Among the compared prompt-based methods, the inference time for AttriCLIP [19] is notably the highest. This is because it relies on selecting test instance-conditioned prompt tokens from a pool of prompt tokens. The instance-specific prompts are fed to the text encoder which further outputs an equivalent number of instance-specific text features to be used in the derivation of logits through eq. 1. These operations increase the inference time of AttriCLIP beyond our proposed variants of CLAP4CLIP with handcrafted prompts (Ours), class-conditioned prompts (CoOp + Ours), and multi-modal prompts (MaPLe + Ours) where the latter three outperform AttriCLIP significantly across all our settings.Method Inference time (s) Continual-CLIP [14] 0.017 CoOp [12] 0.018 MaPLe [20] 0.035 AttriCLIP [19] 0.257 CLIP-Adapter [13] 0 C.6 Influence of language-aware knowledge components on training dynamics.Continuing our ablations from sec. 4.2, here we visualize the effects of using language-aware pre-trained knowledge, i.e., weight initialization and task distribution regularization on the training dynamics of our model. For thorough analyses, we consider four variants of our model: (a) Ours uses both weight initialization and task distribution regularization, (b) Ours without weight initialization, (c) Ours without task distribution regularization, and (d) Ours without either of the language-aware components.Does language-aware weight initialization help alleviate stability gap [57] ? To answer this, we first investigate the evolution of the training loss during the initial training stages of each incremental task. Fig. 14 shows the loss L (Sec. 3.4) during the initial 100 training iterations of each task. We observe that our proposed weight initialization technique leads to lower training losses for the scenarios with or without task distribution regularization, i.e., in general, red values < green values and blue values < orange values. Following [58] , our observations support the hypothesis that larger loss values lead to the stability gap [57] for CL, and that an informed weight initialization method can help tackle it by reducing the initial training loss.To further verify the benefit of our proposed weight initialization strategy for reducing the stability gap, we ablate the accuracy evolution of the first task test samples during the early training stages of each task. Figures 12b and 12a contrast these for CIFAR100. In general, our proposed weight initialization strategy helps mitigate the drop in accuracy during the initial training phases. On average, the first task accuracy upon the first iteration of training across all tasks remains 78.12 without weight initialization and grows to 79.5 with weight initialization, i.e., a gain of 1.38 percentage points.How does language-aware knowledge help learning of task distributions in general? To understand the effect of language-aware knowledge on task distribution learning, we next investigate the evolution of the means and standard deviations learned by the past and the new task heads throughout the training iterations. To this end, Fig. 15 and Fig. 16 report the training iterations against the L2 norm of means and standard deviations for the past task heads (at each incremental training step) and the new task heads (at each training step). We observe two consistent trends regarding the evolution of distributions of the past and the new task heads. First, the proposed initialization of weights helps stabilize the learning of the means and standard deviations with (red against green) or without (blue against orange) regularizing the task distributions. Second, regularizing the task distributions increases the L2 norms of the learned mean and the standard deviation as these now have to encode more information to mimic the distributions of the hand-crafted text features. Our post-hoc novel data detection (PhNDD) setting aims to evaluate the continual learning methods at identifying novel data on the fly. To do so, we design an evaluation setup that uses no additional data resource other than that provided by the dataset-specific CL setting. Starting from the first test step, we treat the test data of the future tasks as novel while those of the seen tasks (including the most recently trained one) as seen. Since the last test step of a CL dataset has no future tasks, we exclude this step for our PhNDD evaluation, i.e., we carry our PhNDD evaluation of CL models starting from the first until the penultimate test step.Following other standard practices [75, 72] , we use the Energy scores [75] of the outputs for each test sample as a measure of the model's confidence score. The samples assigned with a confidence score below the pre-defined confidence threshold are classified as novel. By assuming the seen data as the positive class and the novel data as the negative class, we can obtain a series of true positives rate (TPR) and false positive rate (FPR) by varying the confidence thresholds. One of our PhNDD evaluation metrics -the FPR95 then measures the FPR when the TPR is 0.95. As such, a lower FPR95 score indicates better PhNDD performance. Our other two PhNDD performance metrics include the the area under receiver operating characteristic curve (AUROC [73] ) calculated based on FPR and TPR, and the precision-recall curve (AUPR [74] ). Higher values of AUROC and AUPR indicate better PhNDD performance.Table 4 reports the PhNDD metrics averaged over all the evaluated steps. Here, in Fig. 13 , we show the evolution of these metrics with each evaluation starting from the first test step until the penultimate test step of CIFAR100. We observe that the zero-shot Continual-CLIP [14] has the poorest PhNDD performances (highest FPR95, and least AUROC and AUPR scores) across all steps given that it has not been finetuned on the downstream CL tasks. Among the finetuned methods, the CoOp [12] exhibits the poorest performances across all tasks. Among the variants of our method, combining CoOp with ours (CoOp + Ours) achieves the best PhNDD performances across all tasks. Furthermore, the deterministic versions: Ours w/o VI and CoOp + Ours (w/o VI) remain sub-optimal to their respective probabilistic variants, i.e., Ours and CoOp + Ours. The latter results validate the added perks of our probabilistic modeling framework for post-hoc novel data detection. Few potential directions of research for CLAP4CLIP include the design of: (a) parameter-efficient adapters [85] for very large CL settings; (b) better regularization techniques to alleviate forgetting; and (c) more informed [86] yet computationally efficient priors for inference. Similarly, along the direction of alleviating forgetting and mitigating the stability gap [57, 58] , it would be interesting to see how class-specific prompts generated by pre-trained Large Language Models (LLMs) can be exploited to obtain task-relevant language-aware CLIP knowledge while preserving the zero-shot transfer ability of the learned prompts (see App. Table 21 for a preliminary investigation). Lastly, we consider applying CLAP4CLIP to more sophisticated Vision-Language tasks [87] as another possible direction for research. We elaborate further on each of these directions below.Parameter overhead. For each incoming task, CLAP4CLIP initializes a new head consisting of d × d parameters where d is the output dimension of the CLIP model's encoder. For a very large number of real-world CL tasks, the number of finetunable parameters for CLAP4CLIP may thus become comparable to or larger than that of the pre-trained CLIP model's ≈ 150 million parameters. For example, using a VIT-B/16 encoder with d = 512 brings an overhead of ≈ 525, 000 new parameters with each incoming task. After having seen ≈ 300 new tasks, the number of CLAP parameters to be finetuned thus amount to ≈ 158 million, which is larger than the frozen CLIP itself, and thus defeats the purpose of finetuning at the first place. One solid future direction to use CLAP4CLIP for very large real-world CL settings could thus be introducing more strict parameter-efficiency measures [88, 89] and/or learning probabilistic adapters with low-rank weights [85] .Design choices. Other future directions for improving CLAP4CLIP could include the use of better regularization techniques to further prevent forgetting (see Table 13 for the current forgetting in CLAP), and the search for more informed yet computationally efficient priors (see Table 18 for the computational overhead attached with more informed priors).LLM-generated class descriptions as language-aware knowledge. In Sec. 3.3, we proposed using the text features from hand-crafted prompts as language-aware CLIP knowledge to help alleviate forgetting. However, hand-crafted prompts require manual labelling of data which is not always practical. Hence, several recent works [90, 91, 92] have opted to mining Large Language Models (LLMs) for efficiently obtaining the class-specific descriptions. To study the feasibility of alleviating forgetting using such LLM-generated class descriptions, we leverage the diverse prompts from CuPL [91] obtained using the GPT-3 [93] model. Our preliminary investigation suggests that the hand-crafted prompts have an upper hand over GPT-3 based prompts for CLAP4CLIP performance (see Table 21 ). This could be because of the broad range of knowledge encoded in the GPT-generated prompts -which at times are irrelevant for the test images. Table 21 : Performance comparison on CIFAR100 using hand-crafted vs. LLM-generated prompts for encoding language-aware CLIP knowledge. The results reported are averages over 3 runs. Best results across the metrics are highlighted in bold.Based on the above finding, we suggest leveraging task-relevant LLM-generated descriptions as language-aware knowledge to be another promising future research direction. It is worth noting that a number of existing methods that rely on LLM-generated prompts are limited in their transferable knowledge across unseen classes and datasets [90, 91] (e.g., any new class at test-time would require mining the LLM descriptions in advance). On the contrary, our proposed weight initialization and task distribution regularization strategies provide a natural framework for LLM-generated prompts to be used alongside arbitrary learnable prompts (e.g. replacing t h,l y in eq. ( 7)). This compliments the idea of LLM-based text-only supervision frameworks [92] that seek to enrich zero-shot transfer of prompts to new classes by extracting rich contextual information from LLM data. 3Compatibility with Vision-Language datasets The tasks we have covered so far in the paper are based solely on Vision datasets. To further demonstrate that our method is compatible with more sophisticated vision-language datasets, we here consider using a toy Visual Question Answering (VQAv2) task from the CLiMB dataset [87] . The CLiMB dataset hosts a number of tasks/settings to evaluate multi-modal and low-shot transfer abilities of CL algorithms. However, given the intricacies of these tasks (visual question answering, reasoning, etc.), we leave a full in-depth engagement with CLiMB [87] as a separate future direction for research. 4To show the aptness of our method for the dataset's tasks, we carry out preliminary experiments on the single-task learning setting [94] of the VQAv2 subset of CLiMB. Following [94] , we rely on the BART model [95] for text generation here. Table 22 shows that our method surpasses the Continual-CLIP by 9.29 percentage points on the VQAv2 task, thus showing that ours enhances the zero-shot generalization capability of CLIP.VQAv2 task score Continual-CLIP 57.42 Ours 66.71Table 22 : Single-task learning performance on the VQAv2 subset of the CLiMB dataset.Recent years have witnessed the immense popularity of sequential generative models like Stable Diffusion [10] with applications in multimodal content generation as well as scientific research through fast and highly detailed sampling. The CLIP text encoder is widely employed by such generative models for learning personalized concepts conditioned on text prompts [96, 97] . By effective continual finetuning of the text encoder's features, our method can thus aid in customizing such models in a sequential manner using multiple, fine-grained concepts [98, 26] .F Derivation of ELBO for the static prior.We seek to maximize the likelihood p(y 1:T ) for all observed labels y 1:T . To derive the predictions, our framework uses the visual-aligned text features t1:T c and the image inputs x (see eq. ( 1)). Our evidence is thus p(y 1:T |x; t1:T c ) for which we derive the lower bound (ELBO). In the following, we denote the prior network as p θ (z t ) for which the true posterior is p θ (z t |x; tt c ). We approximate the true posterior using the variational posterior q ϕ (z t |x; tt c ). Our derivation ends up with the reconstruction term p θ (y t |z t , x; tt c ) that can be seen as a deterministic function converting a given latent vector z t and an input image x into an observation y t . For our CLIP-based variational framework, this deterministic function is the cosine similarity operation followed by the softmax application (Eq. (3b)). )dz 1:T ∵ q ϕ (z 1:T |x 1:T )dz 1:T = 1 = q ϕ (z) q ϕ (z t |x; tt c ) ) = T t=1 E q ϕ (z t |x; tt c ) log p θ (y t , z t |x; tt c ) q ϕ (z t |x; tt c ) + E q ϕ (z t |x; tt c ) log q ϕ (z t |x; tt c ) p θ (z t |x; tt c ) (Split the expectation) = T t=1 E q ϕ (z t |x; tt c ) log p θ (y t , z t |x; tt c ) q ϕ (z t |x; tt c ) + D KL q ϕ (z t |x; tt c )∥p θ (z t |x; tt c ) (Definition of KL divergence) ≥ T t=1 E q ϕ (z t |x; tt c ) log p θ (y t , z t |x; tt c ) q ϕ (z t |x; tt c ) (∵ KL divergence ≥ 0) ≥ T t=1 E q ϕ (zThe choice of prior is pivotal to a Bayesian inference workflow like ours [99] . While a standard Gaussian prior p χ = N (0, I) adapts well to a range of settings, it is (seemingly) uninformative regarding the nature of a given task [100] . With the end goal of deriving more informative priors, we thus seek to replace p χ with task data-dependent prior distributions p t , wherever applicable.To this end, we first note that the outputs of the VGA module remain invariant not only to the order of the input text features (due to self-attention) but also to the order of the contextual image features (due to cross-attention). The latter invariance implies that the joint task-specific distribution learned by the encoder q t ϕ (conditioned on the VGA outputs tt c from eq. 5a) is preserved if we were to permute the elements of the task-specific visual context set. More formally, this observation helps guarantee the (finite) exchangeability and the consistency properties of a stochastic process [101] . Motivated by the above, we treat the t-th task image features x t as the target set T t and employ a randomly chosen subset of it as our context set C t to align the t-th task text features and to condition our prior p t on:EQUATIONwhere tt is the fused task-specific text feature following eq. (5b). The task-specific prior p t thus endows our training framework with a resemblance to the neural process (NP) architectures [102, 103, 8] . Following NPs, we use the same encoder q t ϕ to parameterize the conditional prior and the variational posterior. This results in the following approximate ELBO (see App. F for the ELBO derivation):EQUATIONwhere in practice, the entire set of t-th images in a training minibatch form the target set T t and a randomly chosen subset of the targets make up the context C t [104] . Note that unlike NPs, our framework does not entirely rely on data-driven priors. Namely, while training on a CL task t, the past-task encoders are frozen and we have ample t-th task data points to condition the prior on. We thus resort to optimizing the ELBO (13) during training. On the other hand, during finetuning, we have limited task-specific data points to condition our context on. As such, we empirically found that switching to the static prior yields better results and thus resort to optimizing the ELBO (10) during finetuning.G.1 Effect of the context size on data-driven prior.Table 18 in the main paper compares the results of using a data-driven prior against the uniform normal prior and the language-aware prior (see Sec. 3.3) , where the latter is driven from the pretrained text encoder using hand-crafted prompts. We observe that data-driven prior leads to minor accuracy improvements over the standard normal prior but falls narrowly behind the language-aware prior. Here, we study the influence of the batch size of the context set selected at random to derive our prior from.Table 23 shows the last task accuracy with varying context sizes and a fixed target batch size of 64. We find that a smaller context set size hurts the performance of the model to the extent of falling behind the standard normal prior. Given that the context sets are the sampled subsets of the training (target) minibatches, a much smaller context set can lead to the increase in the prior matching loss values. We find that the context set batch size of 40 performs the best, and thus use this to ablate the prior-dependent performances in the main paper. G.2 Derivation of ELBO for the data-driven prior.Similar to App. F, we start with the log-likelihood of the evidence which now involves conditioning on an additional context set C 1:T . The t-th task context set is used to condition our prior network p θ (z t |C t ). Following the standard practices of other data-driven prior frameworks [102, 8] , we introduce parameter-sharing between our conditional prior and variational posterior networks. This allows us to replace our prior network with the variational posterior network q ϕ (z t |T t ), where T is the target set for task t.log p θ (Y Justification: To support the claims, we provide in-depth experimental results on four different (with replay memory, cross-datasets, and resource-constrained) CL setups.EQUATIONGuidelines:• The answer NA means that the abstract and introduction do not include the claims made in the paper. • The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers. • The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings. • It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.From a practitioner's perspective, this enriches the modularity by taking away the overhead of engineering the priors specific to the prompt-type that could, for instance, be spanning multiple layers and/or modalities.Given that new classes might emerge at test time for which we do not have the LLM-generated descriptions, it is important that the learned prompts preserve their zero-shot generalization ability.The CLiMB dataset[87] was introduced as an independent CL benchmark with a number of tasks (Visual Question Answering/Reasoning/Entailment) and training settings including low-shot and unimodal learning. Existing works[94] that study CLiMB thus rely solely on it and not on additional datasets for evaluations. 


Decision: Initially, the paper receives three negative scores and one positive score; after the rebuttal, one reviewer increases the score to borderline accept. I would like to thanks the authors for providing the detailed responses to the reviewers’ questions and addressed many concerns from the reviewers. The AC read through the manuscript, all reviews, and the rebuttal. Some reviewers did not actively participate in the discussion, although the AC tried several times to initiate one. The AC carefully read the authors' response and think it addresses the concerns from the reviewers well and would like to recognize the originality of the paper. The AC would like to accept this paper. The AC also strongly encourage the authors to polish the writing and incorporating the suggestions of the reviewers in the final version.

Reviews: review: paper_summary: paper_summary: This paper proposes Continual Learning with Probabilistic Finetuning (CLAP) for class-incremental learning using CLIP. The key modules of the proposed idea are as follows. First, the authors introduce a CLIP-based probabilistic finetuning model using Bayesian Variational Inference to achieve better generalization during the continual learning process. Second, they propose a visual-guided attention (VGA) model to facilitate cross-modal feature alignment in the continual learning process. Lastly, to alleviate forgetting of pre-trained language-aware CLIP knowledge, they suggest past-task distribution generalization. Additionally, to enable parameter-efficient learning, a probabilistic adapter is used, along with a method for its initialization to enhance stability. Experimental results on various datasets demonstrate that the proposed algorithm achieves superior class-incremental learning performance compared to existing algorithms.
strength_weakness: strength_weakness: 1. I have no major concerns regarding the contribution of the proposed algorithm for class-incremental learning using CLIP. However, I have some questions based on the experimental results.

1-1) Unlike algorithms like L2P and DualPrompt, which utilize exemplar memory, the paper does not use exemplar memory. Are the results in L2P and DualPrompt sections of the paper based on using exemplar memory in a fair comparison? To ensure a fair comparison, results using exemplar memory should be shown.

1-2) The paper only considers prompt-based algorithms like L2P and DualPrompt using Vision Transformer (ViT). However, newer prompt-based algorithms (e.g., CODA-Prompt) that achieve better performance and representation-based algorithms (e.g., Ranpac and EASE) that generally improve performance have been proposed. The authors should consider these algorithms as additional baselines. For more details, please refer to this survey paper [1].

1-3) Among existing baselines, PROOF is currently the state-of-the-art algorithm. While Table 1 shows PROOF's results, Tables 2 and 16 do not. To validate the superiority of the proposed algorithm, results for PROOF should be shown in these tables and other key experiments.

2. Recent research has highlighted discussions on hyperparameter tuning for class-incremental learning algorithms [2] and pointed out issues regarding computational costs[3]. From this perspective, I believe that further discussion and additional analysis on computational costs regarding the proposed algorithm would make the paper more convincing.

3. Lastly, I have personal concerns regarding the necessity of class-incremental learning research using CLIP. As shown in [1], algorithms using only ViT have already achieved excellent performance in class-incremental learning research. Despite using pretrained ViT, one of their major advantages is achieving superior performance without using exemplar memory. Considering this perspective, the proposed research not only uses a pretrained CLIP model but also requires text information and additional exemplar memory usage. Simply comparing numerical experimental results suggests that the proposed algorithm does not achieve overwhelmingly superior performance compared to algorithms using only pretrained ViT. In light of this, I would like to understand: 1) What justifies the necessity of class-incremental learning research using CLIP with exemplar memory? Additionally, 2) I am curious about the potential for the proposed algorithm's ideas to be applied to continual learning in other domains using CLIP or continual pre-training of CLIP itself.

[1] "Continual learning with pre-trained models: A survey." arXiv preprint arXiv:2401.16386 (2024).

[2] "Hyperparameters in Continual Learning: a Reality Check." arXiv preprint arXiv:2403.09066 (2024).

[3] "Computationally budgeted continual learning: What does matter?." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2023.
questions: questions: See the Weakness section. I don't have significant concerns about the algorithm proposed in this paper, but I couldn't give it a higher score due to some experimental uncertainties and questions about the necessity of the setting. If the authors address these concerns in the rebuttal, I would gladly raise my score.
limitations: limitations: There is no potential negative societal impact of this paper.
paper_summary: paper_summary: The paper emphasizes on the existing limitations of deterministic approaches in fine-tuning and highlights the need for probabilistic fine-tuning approach. Following this, it proposes a probabilistic parameter efficient fine-tuning method for continually learning vision language models like CLIP.
strength_weakness: strength_weakness: 1. Justification of probabilistic modelling of the text feature and not the image feature space is not clear.
2. The approach is highly inefficient in terms of inference time.
3. Recent approaches like ConvPrompt[a], CODA-Prompt[b], HiDe-Prompt[c], and SLCA[d] not compared.


[a]Roy, Anurag, et al. "Convolutional Prompting meets Language Models for Continual Learning." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2024

[b]Smith, James Seale, et al. "Coda-prompt: Continual decomposed attention-based prompting for rehearsal-free continual learning." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2023.

[c]Wang, Liyuan, et al. "Hierarchical decomposition of prompt-based continual learning: Rethinking obscured sub-optimality." Advances in Neural Information Processing Systems 36 (2024).

[d]Zhang, Gengwei, et al. "Slca: Slow learner with classifier alignment for continual learning on a pre-trained model." Proceedings of the IEEE/CVF International Conference on Computer Vision. 2023.
questions: questions: 1. Could you address the points I raised in the weakness section?

2. The paper demonstrates a ~2% performance improvement with the addition of the memory consolidation component. However, I'm interested in seeing how the proposed method performs when the replay memory size is set to zero.
limitations: limitations: The authors have discussed the limitations of their work in the paper.
paper_summary: paper_summary: This paper introduces CLAP4CLIP, a method designed to enhance continual learning (CL) using CLIP, a pre-trained vision-language model. The method leverages probabilistic fine-tuning with task-specific adapters to mitigate the issue of catastrophic forgetting commonly faced in CL. By incorporating visual-guided attention (VGA) modules, the model aims to align text features with frozen visual features during incremental training. The proposed method is evaluated on several datasets, including CIFAR100, ImageNet100, ImageNet-R, CUB200, and VTAB, and compared against multiple baselines and state-of-the-art fine-tuning methods.
strength_weakness: strength_weakness: 1. Given CLIP’s strong generalization abilities and its effectiveness in zero-shot learning, the reliance on replay strategies might seem redundant and potentially underutilizes CLIP’s full capabilities. 
2. The paper does not explicitly detail whether the VGA module is updated during incremental tasks. This is a critical aspect, as the update strategy could significantly impact the model's performance and stability.
3. The method involves multiple components, such as probabilistic fine-tuning, VGA modules, and task-specific adapters, which may introduce significant computational overhead.
questions: questions: 1. Could you provide more insights into why the replay strategy is necessary and how it complements the use of CLIP in your method?
2. How is the VGA module handled during incremental tasks? Are its parameters updated, and if so, what strategy is used to ensure consistency and stability across tasks?
3. What are the computational requirements of your method compared to the baselines, especially concerning the additional components introduced? How do you balance the trade-off between performance improvements and computational efficiency?
limitations: limitations: *
paper_summary: paper_summary: The authors present a novel method for CL called CLAP (Continual LeArning with Probabilistic finetuning) applied to the CLIP model. The technique employs probabilistic modeling to refine task-specific modules aligned with visual-guided text features, improving model adaptation to new tasks while mitigating the forgetting of old ones. It also benefits from the knowledge of pre-trained CLIP for this purpose. This method also offers compatibility with prompt-based finetuning methods as well.  The approach demonstrates superiority over traditional deterministic finetuning methods through enhanced performance and better uncertainty estimation in diverse experimental setups.
strength_weakness: strength_weakness: 1. **Presentation Issues:** Figure 1 could be larger to improve readability and clarity. The paper would benefit from better visualization to help convey the complex mechanisms of the proposed method more effectively.

2. **Reference Order and Citations:** The order of the references seems incorrect, which could potentially confuse readers. Additionally, Reference [36] should be discussed in the related works section as well to better contextualize the contributions of the paper.
questions: questions: Please address the mentioned weaknesses.
limitations: limitations: The limitations of this work are discussed and presented in Appendix E.

Comments: title: Requesting feedback on our rebuttal
Requesting feedback on our rebuttal
comment: Dear Reviewer bibK,

We thank you again for taking the time to review this work. We put our best effort into preparing the rebuttal to your questions, including reporting the experiments on zero replay memory size, comparing with CODA-Prompt, and justifying design choices/inference time overhead. We would very much appreciate if you could engage with us through your feedback on our rebuttal. We would be glad to answer any further questions and clarify any concerns.

Also, if you are satisfied with our answers, please consider revising your score.

With best regards
Dear Reviewer KrxH,

We thank you again for taking the time to review this work. We put our best effort into preparing the rebuttal to your questions, including running experiments without memory replay. We would very much appreciate it if you could provide us with your feedback on our rebuttal. We would be glad to answer any further questions and clarify any concerns.

Also, if you are satisfied with our answers, please consider revising your score.

With best regards
Thank you to the authors for addressing my concerns. I will be keeping my original score.
I would like to thank the authors for conducting additional experiments and providing an author response to address the concerns raised in my review. I have thoroughly read both the author response and the updated PDF, and as a result, I am increasing my score to 5. I hope that the final version of the paper will fully incorporate the contents of the response.