Enhancing Domain Adaptation through Prompt Gradient Alignment

Authors: hoang  phan
lam  tran
quyen  tran
trung  le
Venue: NeurIPS_cc_2024_Conference
Published: 2024-05-14 16:18:27

Abstract: Prior Unsupervised Domain Adaptation (UDA) methods often aim to train a domain-invariant feature extractor, which may hinder the model from learning sufficiently discriminative features. To tackle this, a line of works based on prompt learning leverages the power of large-scale pre-trained vision-language models to learn both domain-invariant and specific features through a set of domain-agnostic and domain-specific learnable prompts. Those studies typically enforce invariant constraints on representation, output, or prompt space to learn such prompts. Differently, we cast UDA as a multiple-objective optimization problem in which each objective is represented by a domain loss. Under this new framework, we propose aligning per-objective gradients to foster consensus between them. Additionally, to prevent potential overfitting when fine-tuning this deep learning architecture, we penalize the norm of these gradients. To achieve these goals, we devise a practical gradient update procedure that can work under both single-source and multi-source UDA. Empirically, our method consistently surpasses other vision language model adaptation methods by a large margin on a wide range of benchmarks. The implementation is available at https://github.com/VietHoang1512/PGA.

Main paper: 
 introduction: 
 Deep learning has significantly advanced the field of computer vision, achieving remarkable performance in tasks such as image classification [1] [2] [3] [4] [5] , object detection [6] [7] [8] [9] , and semantic segmentation [10] [11] [12] [13] . However, the effectiveness of these deep learning models heavily relies on large amounts of labeled training data, which is often labor-intensive and expensive to collect. Moreover, the discrepancy between training data and real-world testing data can lead to substantial performance drops when models are deployed in practical settings [14] [15] [16] .To address these challenges, Unsupervised Domain Adaptation (UDA) has emerged as a pivotal solution. UDA aims to transfer knowledge from a labeled source domain to an unlabeled target domain in the presence of a domain shift, thereby enabling models to generalize well across different domains without requiring extensive labeled data for the target domain. This is often achieved by optimizing objective function on source domains and other auxiliary terms that encourage learning domaininvariant feature representations [17] [18] [19] [20] or enhance model robustness [21] [22] [23] [24] , which mitigates the domain shift and improve the performance on unseen data. Nevertheless, aligning representations could potentially hurt the model performance due to the loss of discriminative features [25, 26] . Conceptually, our proposed method is orthogonal to these invariant feature learning methods, and they could complement each other.Recent works leveraging pre-trained models like CLIP [27] for UDA can significantly bridge domain gaps and improve generalization by utilizing rich semantic information and robust visual representations through extensive pre-training on diverse image-text datasets. Following this vein, DAPL [25] first introduces domain-specific and domain-agnostic prompts to efficiently adapt pre-trained vision-language models without fine-tuning the entire model. Furthermore, MPA [28] aligns multiple prompts from different sources using an auto-encoder. While these methods could obtain superior performance on different benchmarks, we find that the main improvement comes from the strong zero-shot performance and self-training mechanism. In particular, prior works often generate pseudolabel for unlabeled images and then train the model on those samples. Consequently, finetuning a pretrained CLIP model on this dataset alone without leveraging source datasets can help refine model prediction significantly, boosting the performance from 88.1% to 90.1%, yielding a competitive result compared against MPA, as presented in Table 1 Motivated by this observation, we directly optimize the main objective function not only on source domains but also on the target data, instead of only using them for auxiliary objectives as in previous work [29, 30] . We thus cast the original UDA problem as a multi-objective optimization (MOO) problem. Specifically, we minimize a vector-valued loss function, which includes the objectives of multiple source domains and the target domain. This formulation allows us to apply existing results from MOO literature for finding Pareto solutions, from which we can not optimize an objective without hurting another [31] [32] [33] or encourage positive inter-task transfer between objectives [34] [35] [36] [37] .Note that in the context of UDA, we focus more on learning the target task, thus motivating us to apply prioritized MOO algorithms [38] [39] [40] or to incorporate predefined preferences [32, [41] [42] [43] . While those methods allow practitioners to focus more or less on the objectives at hand, they come with the cost of extensive hyperparameter tuning. Besides, recent works [44] [45] [46] argue that simple loss functions reweighting can match the performance of gradient-based MOO methods [35, 47] . Those findings suggest we focus more on the inherent conflict nature of per-objective gradients instead of attempting to remove the conflict between them [35, 34] .In this paper, we propose casting the problem of UDA as a multi-objective optimization by leveraging powerful pre-trained models. However, while obtaining impressive results on various downstream tasks, over-parameterization is still a crucial problem for transformer-based models [48, 49] , which potentially causes overfitting [50] [51] [52] [53] [54] more severely than small-parameter architectures [55] , especially in the multi-task learning context. For that reason, we propose to (i) fine-tune pre-trained model via prompt learning, which is known for being more robust [56] [57] [58] and especially more light-weight than full fine-tuning, (ii) and to leverage the gradient norm penalty to encourage model generalization [59, 24, 60, 61] . Furthermore, we introduce a gradient alignment algorithm to foster inherent consensus between per-objective gradients without modifying the gradient itself. Our proposed method, termed Prompt Gradient Alignment (PGA), and its variant for multi-source UDA, Multi-Prompt Gradient Alignment (MPGA), achieve state-of-the-art performance on different UDA benchmarks. As shown in Figure 1 , PGA and MPGA outperform traditional UDA methods like MFSAN [62] and recent prompt-based UDA methods such as MPA [28] and DAMP [63] while requiring fewer trainable parameters. We also provide a generalization bound for UDA and show how theoretical insights motivate the design of our proposed method. 
related work: 
 Unsupervised Domain Adaptation. A dominant approach to solving the UDA problem is to reduce the distribution shift between source and target domains. Following the foundational theory outlined in [64] , one group of methods seeks to minimize the H-divergence between the marginal distributions of these domains [65] [66] [67] . Alternatively, other methods aim to align the moments of these distributions, as suggested in [68] [69] [70] . Additionally, adversarial learning has been employed to learn domain-invariant features. For instance, methods such as those in [19, 71] use a domain discriminator to differentiate between source and target samples, training a feature extractor to deceive this discriminator. However, as [25] highlights, these methods often struggle with a trade-off between domain alignment and classification performance, particularly in multi-source scenarios where only a single model is used.Prompt learning-based domain adaptation is a novel approach introduced in [25] , leverages the generalization capabilities of CLIP to learn both domain-agnostic and domain-specific prompts. This method effectively addresses the trade-off between domain alignment and classification performance by employing a contrastive loss. This loss aligns the representation of an image with the prompt corresponding to its ground truth class and domain, thereby encouraging the learning of domaininvariant features. Building on this foundation, MPA [28] advances the concept of multi-source UDA. It adapts the prompt learning strategy to each source-target domain pair. The prompts are aligned through a denoising auto-encoder using Euclidean distance. However, prompting is known as a brittle process where a small shift to the prompt can cause large variations in the model predictions [72] [73] [74] . Therefore, in this work, we propose to intervene in the training on the gradient space as it offers a more interpretable and controllable effect during training. Furthermore, PGA is trained in an end-to-end fashion, avoiding the sequential training for each source-target pair as in MPA.Gradient-based multi-task learning. Due to the multi-objective nature of the multi-source domain adaptation problem, one can leverage recent methods from the multi-task learning literature [34, 35, 75] to derive an optimization procedure that benefits the learning across domains or put more weight on some specific domains via incorporating preference [32, 41, 42] . While those techniques are readily applicable in our context, we directly re-weight per-task gradients, similar to scalarization, instead of adopting multi-task learning methods for simplicity. Furthermore, our work is orthogonal to those gradient-based multi-task learning methods where we encourage the consensus among objects instead of directly manipulating their gradients to remove inherent conflicts among them.Gradient matching is commonly used in continual learning [76] [77] [78] to measure conflict and transferability between tasks. A positive dot product between two tasks' gradients implies updating the models with one task can benefit the other. This principle is also applied in domain generalization [79, 80] to focus on invariant features. However, our approach aligns in the space of prompt gradient, a significantly smaller parameter set than the full model gradients used in previous works. Besides, to avoid the computation of costly second-order derivatives, [79] linearly approximate the inner product between gradients, which underperforms on datasets with a larger number of domains due to cumulative approximation error. Meanwhile, our method does not face this problem since we implicitly compute this term without using any approximation. More works sharing the same intuition of gradient alignment are provided in Appendix D.3 Background 
unsupervised domain adaptation: 
 Given a set of N ≥ 1 source domains {D S,i } N i=1 each of which is a collection of data-label pairs of domain i, i.e. D S,i = {x j , y j } N S,i j=1 , and one unlabelled target domain D T = {x j } N T j=1 , where N S,i and N T are respectively the number of data points in source domain i and target domain T , the goal is to learn a model that can perform well on the unlabelled target domain. In this paper, we focus on classification problems and denote K as the number of categories.CLIP [27] is a vision-language model that consists of an image encoder f i and a text encoder f t , which is trained to align the visual representation f i (x) of an image x with the textual representation f t (y) of the corresponding label. The textual representation is derived from a manually crafted prompt p k in the form "A photo of a [CLASS] k ", where [CLASS] k is the class k's name. With great generalization capability, pre-trained CLIP models are often used for a variety of downstream tasks through prompt learning.For zero-shot inference, K class names are forwarded through the text encoder, and the one with the highest representation similarity with the image is the predicted class:EQUATIONand ⟨., .⟩ measures the cosine similarity and γ is the temperature.For fine-tuning, a set of learnable class-shared prompts are added to the class token to formP k = [v 1 |v 2 | • • • |v M ][CLASS] k, where v i is a vector with the same size as the word embedding, and M is the number of added prompts. These prompts are learnt by maximizing log-likelihood on downstream data, i.e. max i log P (y = y i |x i , P ). Note that in this predictive probability, we abuse symbol P to refer to the learnable tokens v i , and when we drop the symbol as in 1, we refer to the zero-shot prediction using CLIP. As a result, additional information about the downstream task can be encoded in the prompts, and this design will enable knowledge transfer from pre-trained datasets. 
proposed method: 
 In this section, we describe our proposed prompt gradient alignment method. Motivated by the lightweight and effective nature of prompt learning in adapting pre-trained knowledge to downstream tasks, we cast UDA as a multi-objective optimization (MOO) problem, from which we propose aligning gradients of different objectives and minimizing their norms simultaneously. Additionally, we derive a UDA generalization bound to justify the intuition of our method. The full details of our proposed method in the generalized case where we have more than one source domain are provided in Appendix B.A common assumption in domain adaptation literature is that each domain can be represented by domain-specific features and those that are shared with others. To reflect this, we employ two sets of prompts for each domain: domain-agnostic prompt (or shared prompt, interchangeably) P sh , and domain-specific prompts P S,i and P T . Here, P S,i refers to prompt used for source domain i, and P T is that for target one. In particular, following DAPL, we use K × M 1 tokens to constructP sh = [P k sh ] K k=1 , where P k sh = [v k 1 |v k 2 | • • • |v k M1] is class-specific shared tokens. For source-and target-specific prompts, we use M 2 tokens: P S,i = [u S,i 1 |u S,i 2 | • • • |u S,i M2 ], P T = [u T 1 |u T 2 | • • • |uAs we introduced, to learn those prompts, we consider the cross-entropy losses applied to source data and target data with pseudo labels as a set of objectives to optimize simultaneously:L total (P ) := [L S,i (P )] N i=1 , L T (P ) = [L S,i (P sh , P S,i )] N i=1 , L T (P sh , P T ) , L S,i (P sh , P S,i ) = CE(P sh , P S,i ;EQUATIONlog P (y = y j |x j , P sh , P S,i ), (2)L T (P sh , P T ) = CE τ (P sh , P T ; X T , Y T ) = - 1 N T N T j=1I(P (y = ŷj |x j ) ≥ τ ) log P (y = ŷj |x j , P sh , P T ),EQUATIONIn summary, the total loss consists of N + 1 objectives. The target objective is applied to target samples whose zero-shot predictions made by CLIP are larger than a threshold τ .Given these objectives, source-and target-specific prompts can be updated by minimizing source and target losses, respectively. Regarding domain-agnostic prompt, one can put a weighting term on the signal from source losses to compute the gradient. Formally, for ∀i = 1 → N , we have: g sh,i , g S,i = ∇ P L S,i (P sh , P S,i ), g sh,T , g T = ∇ P L T (P sh , P T ), P S,i = P S,i -ηg S,i ,EQUATIONEQUATION)where η is the learning rate, and λ is the weighting term to control how much emphasis we want to put on the target domain. Note that we treat gradient signals from source domains equally as we assume no prior preference knowledge about them. Nevertheless, one can measure the domain similarity between each source and target domain to devise a better way to reweight source domains' objectives. However, as will be shown in the experiments, taking the average is simple yet yields superior results, hence we will leave this for future work.For simplicity, we first consider the single-source UDA setting and will present the extension to the multi-source one later in Appendix B. One problem with the method above is we ignored the potential inherent gradient conflict between objectives when updating the shared prompt. To mitigate this, one can follow gradient-based methods, such as [35, 47] to manipulate the gradients so that conflict is reduced. However, it has been shown in [44] [45] [46] that comparable performance can be obtained without such complex manipulations, but with simple re-weighting the loss functions. Therefore, to encourage consensus between these gradients without modifying them, we propose aligning gradients between source and target domains during training. Specifically, we aim to maximize their cosine similarity, ⟨g sh,S , g sh,T ⟩, If this goal is achieved, one can expect the shared prompt to capture useful features for classes regardless of domains. Indeed, -g sh,S denotes the direction that moves the shared prompt towards low-loss region of source data, and similar for -g sh,T . Hence, when they point to the same direction, i.e., ⟨g sh,S , g sh,T ⟩ > 0, updating the shared prompt as in Eq. 6 can reduce loss of both domains, because the aggregated gradient g sh = λg sh,S + g sh,T will create acute angles with both g sh,S and g sh,T . As a result, the shared prompt can learn knowledge that benefits both domains, which is its ultimate goal.However, there remain two important questions when implementing this gradient alignment constrain: (i) How to incorporate the cosine similarity maximization term as a regularization in the framework described in Sec. 4.2?; and (ii) How to reduce training time and space when explicitly maximizing it, as it involves the computation of Hessian matrix w.r.t the shared prompt? Our method will address these two concerns.Consider the following loss applied on target data with ||.|| denoting l 2 -norm of a vector:L align T (P ) := L T (P sh -ρ g sh,S ∥g sh,S ∥.∥g sh,T ∥ , P T ) ≈ L T (P sh , P T ) -ρ (g sh,S ) T .∇ P sh L T (P sh , P T ) ∥g sh,S ∥.∥g sh,T ∥ = L T (P sh , P T ) -ρ⟨g sh,S , g sh,T ⟩, (7) where Eq. 7 is obtained by applying first-order Taylor expansion with ρ is a small value, and T is the vector transpose. It can be seen that minimizing this loss also maximizes cosine similarity between gradients of the two domains. In order to achieve this, let denote a = g sh,S ∥g sh,S ∥.∥g sh,T ∥ , and consider the loss's gradient w.r.t P sh : g align sh,T := ∇ P sh L T (P sh -ρa, P T ) = d(P sh -ρa) d(P sh ) ∇ P sh L T (P sh , P T )P sh =P sh -ρa ≈ ∇ P sh L T (P sh , P T )| P sh =P sh -ρa .In the approximation of Eq. 8, we avoid the Hessian computation by dropping the derivative of a w.r.t P sh . Now we can practically apply deep learning optimizers, such as SGD, to minimize L align T (P ). Specifically, we first compute gradients of the source and target losses w.r.t the shared prompt to get vector a, then move the current shared prompt to the new stage: P sh = P sh -ρa. Finally, at this new stage, re-compute the loss on target data then calculate the new gradient.In a similar way, we can derive L align S (P ) on source data and then compute its new gradient w.r.t the shared prompt, i.e. g align sh,S . Given these two new gradients, we can combine them to get the final update direction of the shared prompt, which will navigate it to common low-valued regions in the loss landscapes of both domains. b = g sh,T ∥g sh,S ∥.∥g sh,T ∥ , g align sh,S ≈ ∇ P sh L S (P sh , P S )| P sh =P sh -ρb , g align sh = g align sh,T + λg align sh,S .So far, we have proposed casting each domain loss as an objective in a multiple-objective optimization framework, and have suggested maximizing congruence between gradients of these objectives to reduce their inherent conflict. However, the domain loss is in the empirical form, which has been shown to be easily stuck in sharp minima and thus limiting generalization ability [81, 82] , especially under distribution shifts [83] . Therefore, we argue that explicit control over the generalization of these prompts can be beneficial. Moreover, inspired by the finding in [59] that gradient norm penalization can help model favor flat minima, and by the effectiveness of such minima in the context of multi-task learning [81] , we propose minimizing prompt gradient norm of each objective to enhance prompt generalization.By following the same analysis as in Eq. 7, we can seamlessly fuse the gradient norm penalty term with the cosine similarity maximization with the loss below:L PGA T (P ) := L T (P sh -ρ ga g sh,S ∥g sh,S ∥.∥g sh,T ∥ + ρ gn g sh,T ∥g sh,T ∥ , P T + ρ gn g T ∥g T ∥ )≈ L T (P sh , P T ) -ρ ga (g sh,S ) T .∇ P sh L T (P sh , P T ) ∥g sh,S ∥.∥g sh,T ∥ + ρ gn (∥g sh,T ∥ + ∥g T ∥)= L T (P sh , P T ) -ρ ga ⟨g sh,S , g sh,T ⟩ + ρ gn (∥g sh,T ∥ + ∥g T ∥),where g T is the gradient of the target loss w.r.t target-specific P T , and gn stands for gradient norm.We then follow the derivation of Eq. 8 to come up with a practical approximation of the gradient of L PGA T (P )g PGA sh,T , g PGA T := ∇ P L PGA T (P ) ≈ ∇ P L T (P sh , P T )| P sh =P sh -ρgaa+ρgn g sh,T ||g sh,T || ,P T =P T +ρgn g T ||g T || .Similarly, we obtain the gradient of the source objectiveg PGA sh,S , g PGA S ≈ ∇ P L S (P sh , P S )| P sh =P sh -ρgab+ρgn g sh,S||g sh,S || ,P S =P S +ρgng S ||g S || .Following the same update rules in Eq. 5 and Eq. 6, the prompts can be learnt to achieve both of our two goals: inter-domain gradient alignment and flat minima enforcement, which can lead to improved performance for UDA. We will recap this with a generalization bound in the next part, and provide details for the final loss function in Appendix B.We informally present an information-theoretic bound to explain why PGA works. Refer to Appendix A for the formal version. For simplicity, we will consider the single-source UDA setting and abuse N as the number of source samples. Let Z, P be the input-label space and prompt space (or hypothesis space), respectively. Assume the loss function ℓ :P × Z → R + 0 is R-subgaussian *Denote µ, µ ′ as the two underlying distributions from which the source and target data is sampled, and KL(.||.) as the KL-divergence. The generalization error * is defined as the difference between the target population loss and the source empirical lossErr := E P ,D S ,D T [R µ ′ (P ) -R D S (P )] = E P ,D S ,D T [E Z ′ ∼µ ′ [ℓ(P , Z ′ )] - 1 N N i=1 ℓ(P , Z i )].Theorem 4.1. Under the assumption R-subgaussianity, the generalization error can be upperbounded by:|Err| ≤ 4R 2 N T t=1 η2 t E P t-1 ,D S ,D T [∥g src t ∥ 2 + ∥g tgt t ∥ 2 + ∥g src t -g tgt t ∥ 2 ] + 2R 2 KL(µ||µ ′ ),where T is the total number of training iterations, ηt is the learning rate at iteration t scaled by a scalar, g src t = ∇ P L S (P t-1 ), g tgt t = ∇ P L T (P t-1 ) are the gradients w.r.t P t-1 of source loss Eq. 2 and target loss Eq 3 where P t is the prompt at iteration t.As our method tries to minimize source empirical loss, gradient norms and gradient mis-alignment, from the first term in the R.H.S of Eq. 4.1, its benefit to the performance on target domain can be justified. Furthermore, the second term shows that the generalization error can be reduced by bridging the gap between the two domain distributions, which is the core of many UDA methods, such as [70, 84] . However, as stated earlier, our work is orthogonal to this line of method as we do not explicitly attempt to close such gap. Hence, an interesting future development could be taking the second term into account. Refer to Appendix A.5 for more discussion about this bound. 
experiments: 
 In this section, we evaluate the efficacy of our proposed method on different UDA benchmarks, following the same protocol of recent prompt-based UDA studies [25, 28] . Before that, we start with a simple multi-objective-optimization setup to derive insights into the effectiveness of our proposed method compared to conventional empirical risk minimization (ERM).Let y ∈ {-1, 1} be the true label, e be the environmental feature and ϵ be Gaussian noise, x ∈ R 300 , and p ∈ (0, 1), C > 1 be predefined scalar constants. The data-generating process is given by: The environmental feature e correlates with the true label y according to p. Similar to [55, 85] , we set p = 0.9 for the training and validation set (in-distribution) and p = 0.1 for the test sety ∼ U{-1, 1}, e ∼ p p (e = y | y = y) = p p p (e = -y | y = y) = (1 -p) , ϵ ∼ N 0, I 298 , x = [C * e, y, ϵ]* A random variable X is R-subgaussian if for any ρ, log E exp(ρ(X -EX)) ≤ ρ 2 R 2 /2. *Refer to the Appendix to see why the expectation is taken over P , DS, DT . (out-of-distribution). Figure 2 presents the performance of three linear classifiers trained by ERM, our gradient alignment method only and PGA. In summary, while ERM learns non-predictive features and fails to generalize beyond in-distribution data, our gradient alignment algorithm can leverage the gradient information from multiple environments to learn the core feature that helps perform well on OOD data. Besides, incorporating the gradient norm penalty term further enhances stability and robustness at convergence.Datasets. We conduct experiments using three well-established UDA datasets of varying scales: ImageCLEF [17] , Office-Home [86] , and DomainNet [87] , respectively. Detailed descriptions of these datasets are available in Appendix C.1.Metrics. We evaluate our model by reporting the top-1 accuracy for each target domain and the average accuracy across all domains. To further validate the effectiveness of our proposed method, we conduct experiments in two distinct settings: a source-combined setting, where data from all source domains are merged, and a multi-source setting, which utilizes individual domain identifications. Additionally, we provide pair-wise single-source domain adaptation results for the Office-Home dataset.Baselines. Regarding prompt-based baselines, we compare our method with MPA [28] , DAPL [25] ,Simple Prompt [28] , and Zero-shot CLIP [27] . To ensure a comprehensive evaluation, we also include comparisons with various non-prompt methods such as DCTN [88] , MDDA [89] , MFSAN [62] , T-SVDNet [90] and PFSA [91] ... As we follow the same settings as in [28] and [25] , results for baselines are taken from those studies for the consistency. Note that while DAPL [25] , MPA [28] and our methods employ CoOp [92] with text-end soft-prompt, other methods finetune the transformer block [63] or both image and text-end soft-prompts [93] or the whole encoders [94, 95] . Since those methods typically fine-tune many more parameters, we thus do not include them in the experimental results for the sake of fair comparison.Table 2 presents the results for the ImageCLEF and Office-Home datasets. Under the source-combined scenario, PGA significantly outperforms nearly all other baseline methods on both datasets, with the exception of its own multi-source variant, MPGA. For instance, PGA surpasses the second-best source combined method by a notable 4% in average accuracy and exceeds MPA by over 1%.Notably, in the Office-Home domain Clipart, while two prompt-based baselines, DAPL and Simple Prompt, lag behind their non-prompt counterparts, PGA still manages to achieve slightly better results than these non-prompt methods. In the multi-source setting, MPGA consistently delivers the highest performance across all domains, notably outperforming MPA, the state-of-the-art (SOTA) prompt-based method for multi-source UDA, by a substantial margin of 4% on Office-Home.Table 3 : Accuracy (%) on DomainNet. We use bold to denote the best method overall and underscore to denote the best method using source combine. DomainNet On DomainNet, as Table 3 presents, our method still obtains superior average accuracy under both source combined and multi-source, higher than the runner-up by 3.4% and 2.1%, respectively. Overall, in the domain where CLIP brings significant results compared with non-prompt baselines, our method leads to better performance, except for the difficult QuickDraw domain, as remarked by a relatively low zero-shot accuracy for CLIP-based methods, where it seems that prompt learning fails to beat non-prompt counterparts. Even though, both PGA and MPGA still outperform other prompt-based counterparts while fine-tuning fewer parameters (e.g. 500k versus 2M of MPA).→ Clp → Inf → Pnt → Qdr → Rel → Skt Avg Zero-Shot CLIP [In addition, we also demonstrate our method's effectiveness under 12 pair-wise source-target settings on Office-Home in Table 4 . Again, PGA acquires the highest average score and consistently beats DAPL under 12 settings while using the same parameter-efficient-finetuning method [92] . From Table 5 , we can see that (i) learning prompts using solely the target loss, the accuracy across all settings already surpasses that of Zero-shot CLIP. This confirms the reliability of pseudo labels generated by CLIP. (ii) When adding source loss and grad-norm penalization, the results improve slightly. (iii) Importantly, adding gradient alignment, the scores increase more clearly. These observations verify each of our contributions. Furthermore, to show that gradient alignment indeed increases consensus between gradients, we plot cosine similarity along the training process with three different values of ρ ga in Figure 3 . First, during early training stages, there seems to be less agreement between gradients when no alignment is enforced, c.f. ρ ga = 0. When ρ ga > 0, we can see the similarity increase. Noticeably, there exists a point where similarity starts plummeting. This is reasonable when the model starts to converge to a Pareto solution where source and target gradients cancel each other. This is depicted more clearly in Figure 4 in the appendix where the closer the model is to the Pareto front, the more conflict the gradients are.EQUATIONQuestion: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?Answer • At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable). • Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted. 
conclusion: 
 In this work, we have proposed a framework for UDA inspired by Multi-objective optimization thanks to the generalizability of CLIP and the lightweight nature of prompt learning. We have then devised a practical method to align per-objective gradients, which aims to encourage inherent consensus between objectives. We have further fused gradient norm penalization into the method to enhance prompt generalization. Finally, a UDA generalization bound is presented to justify the benefits of our method.Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?Answer: [Yes]Justification: We provide detailed settings and hyperparameters for all experiments.Guidelines:• The answer NA means that the paper does not include experiments.• 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. 
experiment statistical significance: 
 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 conducted the illustrative experiment ten times independently with different random seeds and reported the mean and standard derivation of the result. The other experiment setups follow the protocol of prior well-known work.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 mention about compute resources in Appendix.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). 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: [NA] Justification: This paper has no negative social impact.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]Answer: [NA] Justification: There are no crowdsourcing experiments and research with human subjects in this paper. Guidelines:• The answer NA means that the paper does not involve crowdsourcing nor research with human subjects. • Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper. • We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution. • For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review. 
 
 Appendix: Due to space constraints, some details were omitted from the main paper. We therefore include additional theoretical developments (section A), the detailed algorithm description (section B) and experimental results (section C) in this appendix.Here, we provide an information-theoretic generalization bound for UDA, which can be reduced by our gradient alignment and gradient norm penalization. For simplicity, we will consider the single-source UDA setting.To begin, we first define some additional notations: let X , Y, P be the input space, output space, and prompt space (or hypothesis space), respectively. Denote the input-label space as Z = X × Y, and the loss function as ℓ : P × Z → R + 0 (Cross entropy in our case). Finally, denote µ, µ ′ as the two underlying distributions from which the source and target domains are sampled. The training data for source domain D S = {Z i } N i=1 is drawn i.i.d from µ ⊗N , and that for target domainD T = {X ′ j } M j=1 is from µ ′ ⊗M X .For each prompt parameter, the population risk in the target domain is defined asEQUATION)This risk is the ultimate goal that a UDA algorithm aims to minimize. However, since µ ′ is unknown, and only a finite number of training data is given, we define the empirical risk in the source domain asEQUATIONIn the information-theoretic analysis framework, model parameter, P ∈ P in our case, is a random variable that is outputted from a learning algorithm A characterized by some conditional distribution P P |D S ,D T . Then the generalization error, measuring how close these two risks can be, has the formEQUATIONwhere the expectation is taken over P , D S , D T ∼ P P |D S ,D T , µ ⊗N , µ ′ ⊗M X .To derive the bound, we need the following assumption on the loss function, which is commonly adopted in many information-theoretic bounds such as those in [112, 113] :Assumption A.1. (Subgaussianity). ℓ(P ; Z ′ ) is R-subgaussian * under P P ,Z ′ |X ′ j =x ′ j , ∀x ′ j ∈ X , for any P ∈ P.We also present the definitions of Mutual Information, Disintegrated Mutual Information, and Conditional Mutual Information: Definition A.2. (Mutual Information). I(X; Y ) = KL(P X,Y ||P X ⊗ P Y ), where KL is the KLdivergence and ⊗ denote the product of two marginal distributions. Definition A.3. (Disintegrated Mutual Information). The disintegrated mutual information between two random variables X and Y given a realization of a variable Z = z isI Z=z (X; Y ) = KL(P X,Y |Z=z ||P X|Z=z ⊗ P Y |Z=z ) Definition A.4. (Conditional Mutual Information). I(X, Y |Z) = E Z I Z (X; Y ). * A random variable X is R-subgaussian if for any ρ, log E exp(ρ(X -EX)) ≤ ρ 2 R 2 /2.Theorem A.5. Under assumption A.1, the generalization error can be upper-bounded byEQUATION)where T is the total number of training iterations, η t is the learning rate at iteration t, P t is the prompt at iteration t, g src t = ∇ P L src (P t-1 ), g tgt t = ∇ P L tgt (P t-1 ) are the gradients w.r.t P t-1 of source loss Eq.2 and target loss Eq.3, and σ t is the standard deviation of the isotropic Gaussian noise added to the update of P t .Remark A.6. For the purpose of simplicity, here we consider a 'noisy' update version of prompts:P t = P t-1 -η t g + N t , N t ∼ N (0, σ 2 t I).However, note that the bound still holds for the conventional SGD update, i.e., no added noise, by following techniques in [113] .Remark A.7. Our methods align gradients of shared-prompt, but here we can omit its subscript in the inter-domain gradient matching term, ∥g src t -g tgt t ∥ 2 , by noting that g src t = [g sh,src t , g S t , 0] andg tgt t = [g sh,tgt t , 0, g T t ]. Indeed, ∥g src t -g tgt t ∥ 2 = ∥g src t ∥ 2 + ∥g tgt t ∥ 2 -2(g sh,src t ) T g sh,tgt t, where T denotes the vector transpose. In addition, this bound suggests maximizing the dot product between gradients; however, to stabilize training, we aim to maximize the cosine similarity instead.This theorem suggests that penalizing gradient norm and matching gradients across domains can improve generalization on the target domain, i.e., the first term in the R.H.S of A.5 is minimized. Note that minimizing gradient norm has been widely used in [59, 81, 114] to control the sharpness of the loss landscape, which is strongly related to the generalization capability of the model. In this work, we can empirically and theoretically verify the effectiveness of this technique in the gradient space of prompt, consistent with results in previous works [115, 116] .Regarding the second term, we do not aim for a method that can explicitly reduce the gap between source and target distributions, because we do not want to remove any domain-specific features that may be helpful for prediction. Instead, we want to capture domain-agnostic features in the shared prompt, and specific features in the domain-specific ones so that at inference, a more meaningful representation can be obtained by using these prompts. Hence, one possible direction for future work is to design and learn prompts such that domain distribution alignment can also be achieved.Finally, this bound can grow as the number of training iterations increases unless gradient norms and the difference between source and target gradients are extremely small at final iterations. Future work could be overcoming this limitation by considering other bounds, such as ones suggested in [117] .Proof. Our bound is inspired from the bound in Theorem 5.1 in [112] , which is restated as the following lemma Lemma A.8. Under assumption A.1, the generalization error can be upper-bounded byEQUATIONEQUATIONNow consider the 'noisy' update of the prompt as presented in Eqs. 6 and 5:EQUATIONEQUATIONAssume that we obtain the final prompts after T iterations, then following the chain rule of mutual information and data processing inequality, we have EQUATIONEQUATIONEQUATIONwhere P Gt|DT ,P t-1 is some random distribution, every choice of which results in a upper bound for the MI, and the equality holds when P Gt|DT ,P t-1 = P -g src t+ N t 2η t |D T ,P t-1 .Therefore, if we choose P Gt|DT ,P t-1 = N (0, , which is also a Gaussian distribution due to the effect of the added noise, we reach the gradient matching term,EQUATION2η 2 t σ 2 t E D S ,D T ,P t-1 ||g src t -g tgt t || 2 .Note that in Eq. 15, we suppose the source-weight term λ = 1 to simplify proof. However, if one wishes to keep the impact of λ, they can change g src t = [λg sh,src t , g S t , 0]. In this case, the terms under the expectation in the bound will become: (λ 2 -1)||g As we cast UDA as a MOO problem, the ideal final objectives, in the case of single-source UDA, would be [L PGA S (P ), L PGA T (P )], where L PGA T (P ) := L T (P sh -ρ ga g sh,S ∥g sh,S ∥.∥g sh,T ∥ + ρ gn g sh,T ∥g sh,T ∥ , P T + ρ gn g T ∥g T ∥ ),L PGA S (P ) := L S (P sh -ρ ga g sh,T ∥g sh,S ∥.∥g sh,T ∥ + ρ gn g sh,S ∥g sh,S ∥ , P S + ρ gn g S ∥g S ∥ ).As aforementioned, we use scalarization method, i.e. reweighting loss functions with λ put on the PGA source objective. As a result, the PGA gradient updates for prompts are g PGA sh,T , g PGA T := ∇ P L PGA T (P ), g PGA sh,S , g PGA S := ∇ P L PGA S (P ), P S = P S -ηg PGA S , P T = P T -ηg PGA T , P sh = P sh -η(g PGA sh,T + λg PGA sh,S ).However, computing these PGA gradients will trigger the computation of the Hessian matrix. Hence, we approximate them with a practical version:g PGA sh,T , g PGA T := ∇ P L PGA T (P ) ≈ ∇ P L T (P sh , P T )| P sh =P sh -ρga g sh,S∥g sh,S ∥.∥g sh,T ∥ +ρgn Our method can be easily extended to work with multi-source domains by noting that the target gradient is aligned with each of the source gradients.g PGA sh,T , g PGA T := ∇ P L PGA T (P ), g PGA sh,i , g PGA S,i := ∇ P L PGA S,i (P ), ∀i = 1 → N P S,i = P S,i -ηg PGA S,i , ∀i = 1 → N P T = P T -ηg PGA T , P sh = P sh -η(g PGA sh,T + λ i g PGA sh,i ), g PGA sh,T , g PGA T ≈ ∇ P L T (P sh , P T )| P sh =P sh -ρga i g sh,i∥g sh,i ∥.∥g sh,T ∥ +ρgn g sh,T||g sh,T || ,P T =P T +ρgnEQUATION)g PGA sh,i , g PGA S,i ≈ ∇ P L S,i (P sh , P S,i )| P sh =P sh -ρga g sh,T∥g sh,i ∥.∥g sh,T ∥ +ρgn g sh,i||g sh,i || ,P S,i =P S,i +ρgnEQUATION)The details of our proposed method for the general case of N source domains are presented in Algorithm 1. When N = 1, our method degrades to PGA.In this section, we provide additional information for our experimental settings in Section C.1 and C.2 then include detailed ablation studies and other empirical results in Section C.3.Input: Prompt P = [P sh , {P S,i } N i=1 , P T ], gradient norm penalization trade-off ρ gn , alignment strength ρ ga , source-gradient trade-off λ, learning rate η. Output: Updated prompt P * 1: Compute target loss L T (P sh , P T ) as in Eq. 3 2: Compute gradients of shared and target-specific prompts w.r.t target loss g sh,T , g T ← ∇ P L T (P sh , P T ) 3: Compute source losses L S,i (P sh , P S,i ) as in Eq. 2 4: Compute gradient of shared and source-specific prompts w.r.t each source loss g sh,i , g S,i ← ∇ P L S,i (P sh , P S,i ), ∀i = 1 → N 5: Compute g PGA sh,T , g PGA T as in Eq. 28 6: Compute g PGA sh,i , g PGA S,i as in Eq. 29 ∀i = 1 → N 7: Compute combined gradient of shared prompt g PGA sh = g PGA sh,T + λ i g PGA sh,i 8: Update promptP * = [P sh , {P S,i } N i=1 , P T ] -η[g PGA sh , {g PGA S,i } N i=1 , g PGA T ]C. For fair comparisons, we use a ResNet50 as our backbone on Image-CLEF and Office-Home and a ResNet101 on DomainNet. Their weights are taken from pretrained-CLIP and kept frozen during training. Prompts are trained with the mini-batch SGD optimizer with a learning rate of 0.003 and 0.005. We use a batch size of 32 and adopt a cosine learning rate scheduler. For hyper-parameters, token lengths M 1 and M 2 are both set to 16. Pseudo-label threshold τ is set to 0.4 for producing reliable labels. ρ gn , ρ ga and λ are found using grid-search. Details are provided in the public source code.During inference, we average the prediction of both source P S and target P T prompts, which empirically yield the best performance. Please note that the inference cost remains almost the same as using a pretrained CLIP as computing class embeddings is an one-time-cost. The complexity grows linearly with the number of prompts during training (= 2 with PGA and N + 1 in the case of MPGA), which is typically not a big issue in practice since the model training can quickly converge by fine-tuning under intrinsic dimension [119] . We further confirm this in the computation complexity ablation study below.We run a small multi-objective-optimization problem on the ZDT-1 problem [120] . The ZDT-1 problems have a 30-dimensional variable and two differentiable objective functions f 1 , f 2 :min f 1 (x) min f 2 (x) = g(x)h (f 1 (x), g(x))The function g(x) can be considered as the function for convergence, their formulas are given by:f 1 (x) = x 1 g(x) = 1 + 9 n -1 n i=2 x i h (f 1 , g) = 1 -f 1 /g 0 ≤ x i ≤ 1 i = 1, . . . , nwith the Pareto solutions are given by: As can be seen from Figure 4 , the cosine similarity increases at the beginning of the training and then decreases when the obtained solution reach the region near the Pareto front. This behavior aligns with the gradient similarity evolution experiment in the main paper.0 ≤ x * 1 ≤Apart from those experiments in the main paper, we expand the single-source unsupervised domain adaptation setup by including the empirical results on two large-scale synthetic-to-real benchmark for classification adaptation S2RDA-49 and S2RDA-MS-39 [121] . For each task, synthetic samples are created by rendering 3D models from ShapeNet, matching the label space of the real/target domain, with 12K RGB images per class. The S2RDA-49 real domain contains 60,535 images across 49 classes from various sources including the ImageNet validation set. The S2RDA-MS-39 real domain includes 41,735 natural images for 39 classes from MetaShift, featuring complex contexts like object co-occurrence and attributes, which adds to the task's difficulty. Table 6 illustrates accuracy and mean score over classes, where utilizing pretrained vision-language models still shows their impressive performance. Using pretrained CLIP standalone outperforms other traditional DA methods and PGA further boosts the performance by large margins, 4% on S2RDA-49 and 1.5% on S2RDA-MS-39, respectively.Similar to previous work on CLIP adaptation [25, 28] , we vary the pseudo label threshold τ value to study its sensitivity. As can be seen in Figure 7 , both PGA and MPGA's performance is relatively stable across different values of τ , indicating that our methods are not sensitive to τ , and the best result is obtained at a reasonable trade-off between the quantity and quality of pseudo data. In Figure 5 , we provide the complexity for some comparative baselines. Accuracy curve (left): While DANN and CDAN obtain their best performance at approximately 77% after more than 1000s, PGA and MPGA achieve 84% within 100s. Besides, the first stage of pairwise source-target training of MPA takes 159s, followed by 35s for the second stage to actually train the final model. Number of Trainable Parameters (middle): PGA and MPGA, with fewer than 140k parameters, require significantly fewer parameters than MPA, DANN and CDAN, which have around 1M, 48.9M and 51.7M parameters, respectively. GPU Memory Usage (right) PGA, MPGA, and MPA exhibit substantially lower memory footprints, around 1300MB compared to 7000MB of DANN and CDAN throughout training. Figure 6 shows that PGA is generally not sensitive to ρ ga and ρ gn within their acceptable range, i.e. 1e-2 to 10 for ρ ga and 1e-5 to 0.1 for ρ gn . (i) a too large value of ρ gn is less effective than smaller ones; (ii) ImageCLEF prefers larger values of ρ ga while OfficeHome prefers smaller ones, suggesting that source and target domains in the former dataset may be more similar than those in the latter, hence over-matching gradients in the latter dataset may be adverse. We present results of our methods using ViT-B/16, ViT-L/14 backbones on OfficeHome in Tables 8 and 9 , following experimental setups in [122, 123] . We can observe the superiority of our methods among all baselines while finetuning a small portion of the backbones using prompt tuning. Especially, PGA outperforms the second-best method on ViT-B/16 backbone by ≈ 1% accuracy score. Following a different protocol, Table 9 provides the results of ViT-L/14 backbones on Office-Home but with three source domains per category on Art, Clipart, Realworld and Product domain. In this setup, MPGA and PGA still consistently yield the best and second-best scores among all categories. This section is to study how does the method performs when there are extreme label distribution shifts between source and target domains. We test PGA on the setting of label shift following [124] , where the source or target domains are down-sampled with only 30% of data from the first-half of the classes are taken (indicated by s-prefix).Table 10 : Accuracy (%) on the sub-sampled Office-Home for unsupervised domain adaptation. The prefix s-denotes the domain where we sample only 30% of the images from the first half of its classes, following the label shift setting from prior work. All experiments are run on Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz and NVIDIA A100-SXM4-80GB GPU.Another work sharing the same intuition of gradient alignment is ProGrad [125] , which manipulates gradient of the fine-tuned loss to preserve general knowledge of the pretrained model. Similar to other gradient-based MTL methods [34, 35] , it attempts to remove conflicts between per-objective gradients at each time step, thus is orthogonal to our approach. In contrast, we aim to stimulate their inherent consensus throughout training by encouraging the same training trajectory for both domains, hence, the model can find commonly good regions for them. Another concept that relates to gradient alignment is meta-learning. This has been introduced to Domain generalization in [126, 127] . Their intuition is a training procedure that enables the model to achieve low loss on a subset of training domains after having learned the other ones, and they work on the full model space. In a recent work about Vision-Language Models [128] , meta-learning was used to deal with the problem of few-shot prompt learning by meta-learning prompt initialization. The gradient of the inner loop is modified with a learnable regulating function, and data for the support and query sets are found by hierarchically clustering an auxiliary large-scale image-text dataset. This method also has the impact of aligning gradient between support and query data as a result of meta-learning. However, its computation and space complexity is rather large as it requires the computation of Hessian matrix, web-scale of image-text pairs, and meta-learns the soft initialization for prompts.First, our work relies on pretrained-CLIP, meaning that if UDA data is too different from pretrained knowledge, our method may fail to learn adequately. Therefore adapting our method to scratchtraining scenarios without heavy computation and space complexity should be investigated. Second, the derived bound can be potentially loose as the number of training iterations increases. Thus studying other types of bounds could be an interesting work. Finally, as we mentioned, a strategy to explicitly align feature distribution across domains is worth looking into.• The answer NA means that the paper does not include experiments.• If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not. • If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable. • Depending on the contribution, reproducibility can be accomplished in various ways.For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed. • While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. , with an open-source dataset or instructions for how to construct the dataset). (d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility.In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results. 


Decision: This paper proposes an approach for enhancing domain generalization by aligning prompt gradient. While reviewers believe that the paper is well-written and the approach is novely, concerns are raised in terms of the experiments and comparisons. The rebuttal successfully addressed most of the concerns, while there are still doubts in terms of whether the approach can be used in traditional DA approaches. Overall, the AC believes the paper provides a new pespective for DA research and thus recommends acceptance.

Reviews: review: paper_summary: paper_summary: To enhance both transferability and discriminability for prompt learning based domain adaptation, this paper proposes a Prompt Gradient Alignment (PGA) method. PGA encompasses multiple domain-wise classification objectives, cosine similarity maximization regularizers between prompt gradients of different domains, and prompt gradient norm penalty for each classification objective. It can thus achieve both inter-domain gradient alignment and flat minima enforcement. To efficiently and effectively update the designed prompts, a practical gradient update procedure is devised and works under both single-source and multi-source UDA. Empirical results shown the superiority of the proposed method.
strength_weakness: strength_weakness: 1. The abstract should reflect the technical highlights. For example, UDA is essentially a multiple-objective optimization problem, which is not the technical novelty of this paper.

2. As indicated by Theorem 4.1, the proposed method minimizing source empirical loss, gradient norms, and gradient misalignment, model and reduce the upper bound of the established generalization error. Nevertheless, it is not intuitive why minimizing gradient norms and gradient misalignment are beneficial for the performance on the target domain. 

3. In Theorem 4.1, g_t^src and g_t^T are the gradients w.r.t. P_t of source loss and target loss respectively. The two gradients should be derived from the same prompt or different prompts? Can the gradient alignment theory be extended to other spaces like image, feature, and output spaces?

4. Due to use of pseudo labels for the target domain, though they are improved by confidence filtering, the accuracy of pseudo labels may greatly affect the success of inter-domain gradient alignment. It is encouraged to investigate the relationship between them.

5. Some important related works are missing in the discussion of related works, e.g., [a].

[a] Tang et al. Unsupervised domain adaptation via distilled discriminative clustering. PR, 2022.

6. Validation on larger datasets like S2RDA [b] is important for three reasons. First, it is a more large-scale, realistic, challenging multi-domain benchmark dataset. Second, it is tailored for synthetic-to-real transfer, more in line with industrial needs. Third, this paper leverages the powerful generalization capability of large-scale pre-trained vision-language models and fine-tuning with a large amount of training data can avoid the potential risk of overfitting.

[b] Tang and Jia. A New Benchmark: On the Utility of Synthetic Data with Blender for Bare Supervised Learning and Downstream Domain Adaptation. CVPR, 2023.

7. What circumstances does the overfitting issue appear? Why does penalizing gradient norms alleviate the overfitting issue? Are there any theoretical reasons?

8. In Eq. (6), L_tgt should be L_T? In Eq. (20), L_s should be L_s^PGA? The authors may re-write the final overall objective for clarity.
questions: questions: See Weaknesses.
limitations: limitations: N/A
paper_summary: paper_summary: This paper proposes a novel approach called Prompt Gradient Alignment (PGA) for unsupervised domain adaptation (UDA). The key contributions are: (1) Formulating UDA as a multi-objective optimization problem with objectives for source and target domains; (2) Aligning gradients between objectives to encourage consensus; (3) Penalizing gradient norms to improve generalization; (4) Leveraging pre-trained vision-language models through prompt learning. The method is evaluated on standard UDA benchmarks and demonstrates consistent improvements over other prompt-based baselines. A theoretical generalization bound is also provided to justify the approach.
strength_weakness: strength_weakness: The computational complexity and training time comparisons to baseline methods are notably absent. Without this information, it's difficult to assess the practical trade-offs of implementing PGA compared to existing methods. This is particularly important given the method's use of gradient manipulation, which could potentially increase computational requirements.
The paper's heavy reliance on pre-trained CLIP models raises questions about the method's applicability in scenarios where such pre-training is not available or suitable. While the use of pre-trained models is a strength in many cases, it could also be a limitation in domains significantly different from CLIP's training data.
The discussion of hyperparameter sensitivity is limited. Given the importance of hyperparameters like ρga and ρgn in the gradient alignment and norm penalization processes, a more thorough exploration of their impact on performance would be valuable.
While the method shows improvements over existing approaches, the degree of novelty is somewhat incremental. The core ideas build heavily on existing prompt-based and gradient manipulation techniques, which may limit the paper's impact.
questions: questions: 1. How does PGA's computational complexity compare to baseline methods? Are there significant differences in training time?
2. Have you explored performance on data types beyond image classification? How generalizable do you expect the method to be?
3. How sensitive is the method to hyperparameter choices, particularly for gradient alignment and norm penalization?
4. Given the reliance on CLIP pre-training, how well do you expect the method to perform in domains very different from CLIP's training data?
5. How does the method's performance change as the degree of domain shift varies? Is there a point where simpler approaches become competitive?
limitations: limitations: The reliance on CLIP pre-training potentially limits applicability to domains very different from CLIP's training data. It's unclear how well the method would perform on specialized domains (e.g., medical imaging, satellite imagery) that are not well-represented in CLIP's training set.
The paper does not thoroughly explore potential failure cases or scenarios where the method might struggle. For instance, how does the method perform when there are extreme label distribution shifts between source and target domains? Or when the domain shift is particularly severe?
The scalability of the method to very large datasets or high-dimensional data is not addressed. It's unclear how the computational requirements scale with dataset size or feature dimensionality.
paper_summary: paper_summary: This paper proposed a novel domain adaptation method that tunes the text prompts based on self-training with pseudo labels. The proposed method treats the source training and target training as multi-objective optimization problems, and it introduces to alignment of the gradients from both training (Prompt Gradient Alignment) so as not to cause conflict between the source and target training. The authors validated the proposed method empirically and theoretically.
strength_weakness: strength_weakness: + It is questionable whether the comparison with existing methods is fair.
  + The old domain adaptation methods fail to show their effectiveness when they are applied to the CLIP model. I suspect that those domain adaptation methods were not properly applied to CLIP. Is there any reason why they fail?
  + Conversely, would it not be possible to evaluate the proposed method in accordance with existing domain adaptation benchmarks? For example, would it be possible to evaluate the proposed method by updating the model parameters instead of the prompts?
+ There are some additional related works that should be discussed in the paper.
  + Bose, Shirsha, et al. "Stylip: Multi-scale style-conditioned prompt learning for clip-based domain generalization." Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision. 2024. This work proposes a prompt training method for the domain generalization tasks.
  + Zhu, Beier, et al. "Prompt-aligned gradient for prompt tuning." Proceedings of the IEEE/CVF International Conference on Computer Vision. 2023. This introduces a gradient matching idea into prompt tuning, which has a similar mind to this paper.
+ Some of the formulas are a little difficult to follow.
  + It is very difficult to understand which of eq 9 or eq 11 is the actual loss function. This goes for eq 16 and eq 18 as well. I recommend separating the formulations for easier understanding.
questions: questions: + As mentioned in the third bullet of weaknesses, I could not fully understand the formulations. Could you explain which is the actual loss function?
limitations: limitations: + I did not found any additional limitation for this work.
paper_summary: paper_summary: This paper aims to leverage prompt tuning of vision-language models for Unsupervised Domain Adaptation (UDA) tasks. The authors formulate UDA as a multi-objective problem where each objective is modeled by a domain loss. To resolve conflicts between domains, they manipulate gradients by maximizing their cosine similarity. Additionally, to stabilize the training procedure, they propose using the norm of the gradients as a regularization term. They also provide a generalization error bound for their method. Empirical results demonstrate the effectiveness of the proposed method.
strength_weakness: strength_weakness: Major:

(1) Recent empirical and theoretical studies [1] show that simply reweighting the loss of different objectives can match the performance of gradient surgery. When the model is under-parameterized (which may be the case for prompt learning, as the prompt parameters are relatively small compared to the CLIP parameters), simple reweighting is sufficient to fully explore the Pareto front. My question is why the proposed gradient manipulation is better. Can the authors provide theoretical analysis or empirical validation?

[1] Revisiting Scalarization in Multi-Task Learning: A Theoretical Perspective

(2) The backbone CLIP-ResNet-50 is a weak backbone. Please consider conducting some experiments on a CLIP-ViT based model.

Minor:

(1) Missing references. There have been some studies that use gradient alignment for prompt learning, e.g., [3,4]. Please consider adding them to the related works section.

[3] Prompt-aligned Gradient for Prompt Tuning
[4] Gradient-Regulated Meta-Prompt Learning for Generalizable Vision-Language Models

(2) Table 1 in the Introduction is not well explained. It does not specify which dataset and CLIP backbone are used, and the symbols $\rightarrow C, I, P$ are not explained. In addition, Table 2 should be referenced as Figure 1.
questions: questions: Please refer to the weaknesses, and I am willing to raise the score if the major weaknesses are addressed.
limitations: limitations: Limitations have been discussed and no negative societal impact has been identified.

Comments: title: Thank you
Thank you
Author response to Reviewer dhjM
Official Comment by Authors
comment: Hi,

Could you take a look at the authors rebuttal and finalize your rating?

Thanks, AC
Thank you for raising your concerns, and for your detailed review and insightful suggestions. Addressing these points will undoubtedly enhance the paper's presentation and more thoroughly examine our proposed method. We will further follow your valuable recommendation.
I'd like to acknowledge receipt of your response, e.g., the supplementary experiments involving traditional UDA and larger datasets. The results effectively alleviate my previous apprehensions. I commend the authors for conducting these experiments and sharing results that will significantly impact future research. Given that all my concerns have been satisfactorily addressed, I have revised my rating to 8.
We sincerely thank the reviewer for the engaging discussion and greatly appreciate the valuable suggestions and feedback provided. We are honored by your appreciation of our paper and grateful for your support toward its acceptance. Thank you for your positive evaluation!
Thank you for the response about the additional experiments with traditional UDA. These results fully addressed my last concern. I also appreciate the fact that the authors have done these experiments and reported the results that will be very meaningful to subsequent reseaches. Since all my concerns have now been addressed, I have raised my score to 7.
We would like to thank the reviewer for acknowledging our effort and we are encouraged that our responses have addressed most of your concerns. Regarding your last concern about the fairness of our experiments with traditional UDA methods, we have examined DANN and CDAN using a CLIP backbone to provide more insight into the limitations of domain-invariant feature learning in adapting pretrained CLIP to new domains. We will run more experiments on other datasets and incorporate obtained results to the revision. It is important to note that our baseline results, so far, are taken directly from prior work, as we adhere to the recent protocols for adapting CLIP from prior work.

| Method        | Backbone     | →C     | →I     | →P     | Average | # Param |
|-|-|-|-|-|-|-|
| SOURCE ONLY   | RN50-FC      |  94.7 | 90.2 | 79.3   | 88.1   | 38M     |
| DANN          | RN50-FC      | 96.0 | 92.3 | 80.2   | 89.5   | 38M     |
| CDAN          | RN50-FC      | 96.2 | 92.0 | 80.4   | 89.5  | 38M     |
| SOURCE ONLY   | RN50         | 93.3 | 88.5 | 78.8   | 86.9   | 38M     |
| DANN          | RN50         |  94.5 | 91.5 | 79.0   | 88.3   | 38M     |
| CDAN          | RN50         |  94.7 | 92.0 | 79.0   | 88.6   | 38M     |
| SOURCE ONLY   | CLIP-RN50    | 93.0 | 90.7 | 78.7   | 87.4   | 102M    |
| DANN          | CLIP-RN50    |  95.0 | 91.7 | 79.2   | 88.6   | 102M    |
| CDAN          | CLIP-RN50    |  93.7 | 93.0 | 80.0   | 88.9   | 102M    |
| DAN | ResNet50     | 93.3 |  92.2 |  77.6 |  87.7 | 48.9M   |
| D-CORAL  |  ResNet50     | 93.6  | 91.7  | 77.1  | 87.5 | 47.5M |
| DANN          | ResNet50     | 95.7 | 91.8 | 77.9   | 87.8   | 48.9M   |
| PGA           | Prompt-tuning|  96.8 | 95.7 | 84.6   | 92.4   | 114k    |
| MPGA          | Prompt-tuning|  97.4 | 96.5 | 84.7   | 92.9   | 131k    |

Specifically, we applied DANN and CDAN on CLIP’s ResNet50 configured in three different ways: with a randomly initialized fully connected classifier (RN50-FC), with a frozen text encoder (RN50), and using the entire CLIP backbone (CLIP-RN50). The results, presented in the table below, demonstrate that appropriately adapting prior UDA methods to different parts of the CLIP model can yield better results compared to traditional methods on a ResNet backbone (e.g., DAN, CORAL, DANN). Eventhough, PGA and MPGA still exhibit superior performance, even with significantly fewer parameters finetuned. We hypothesize that relying solely on source classification loss and another objective for invariant feature learning can degrade CLIP’s rich semantic representation [R8, R9, R10, R11], which is crucial for predicting target domain data. To counteract this, utilizing target pseudo data (similar to self-training baseline in Table 1) or adopting a more carefully-designed optimization procedure that better leverages information from both source and target data—similar to our proposed method—could enhance performance.

We hope this response provides further insights into why traditional UDA methods may not perform as well as other prompt-based baselines. If the reviewer found any further unaddressed concerns, we are always happy to provide further clarifications and improve our work based on the constructive feedback from the reviewers.

[R8] Kumar, Ananya, et al. "Fine-Tuning can Distort Pretrained Features and Underperform Out-of-Distribution." ICLR 22.

[R9] Zheng, Zangwei, et al. "Preventing zero-shot transfer degradation in continual learning of vision-language models." ICCV 23.

[R10] Lai, Zhengfeng, et al. "Padclip: Pseudo-labeling with adaptive debiasing in clip for unsupervised domain adaptation." ICCV 23.

[R11] Ding, Yuxuan, et al. "Don't stop learning: Towards continual learning for the clip model." arXiv 22.
We sincerely thank you for your insightful review and supportive feedback to make the paper more complete. Your support is highly appreciated, and we are glad that our responses have addressed your concerns.
Thank you for the responses. I think my concerns have mostly been addressed. I still have concerns about the performance of the old domain adaptation methods, but I understand that is not a unique weakness of this paper but applied to all prior studies. I acknowledge that the proposed method is superior to the newer domain adaptation methods (e.g., DAPL) on equal conditions, so this concern may not be so critical. In conclusion, I maintain my positive evaluation for this paper.
Thanks for the response. All my concerns are resolved and I have raised my rating