SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Hyperparameter Sensitivity. As shown in Fig. 3b, our model exhibits low sensitivity to both  $\lambda_{kl}$  and  $\lambda_{kd}$  in ADA, and moderate sensitivity to  $\lambda_{kl}$  in SFADA.
Table 4: Ablation study of DAPM-TT on Office-31 and VisDA. Dif. and Det. are short for diffusion classifier and deterministic classifier, respectively.
We conjecture the reason is that the source-available scenario involves more loss terms in the training objective, the additional source domain data and distribution alignment objectives like  $\mathcal{L}_{adv}$  may make the optimization landscape more complex and susceptible to suboptimal solutions based on weighting hyperparameters. In contrast, in SFADA, the model solely relies on the target data and regularization losses like  $\mathcal{L}_{KL}$  for alignment, reducing dependence on precise weighting. As SFADA lacks source-supervised information, we recommend using a slightly larger  $\lambda_{kl}$  to ensure good adaptation performance.
Classifier	Loss	Office-31	VisDA-2017
Dif.	Det.	\( \mathcal{L}_{KD} \)	\( \mathcal{L}_{KL} \)	\( \mathcal{L}_{adv} \)	ADA	SFADA	ADA	SFADA
✓	91.4	90.8	86.3	86.7
✓	91.1	91.0	86.5	86.5
✓	✓	92.2	91.9	87.1	87.6
✓	✓	✓	92.9	-	87.7	-
✓	✓	✓	93.0	93.0	88.5	88.4
✓	✓	✓	93.0	93.1	88.3	88.2
✓	✓	✓	✓	93.5	-	89.1	-
✓	✓	✓	✓	93.4	-	88.9	-
In this work, we propose a novel probabilistic framework for ADA that leverages the variability of both latent data representation and model prediction for better uncertainty estimation. Our approach combines a variational autoencoder, a diffusion probabilistic classifier, and an auxiliary deterministic classifier to guide training and ensure an invariant latent space. Our experiments on three domain adaptation benchmarks demonstrate the effectiveness of our approach in improving task performance and effectively handling uncertainty estimation for both ADA and SFADA.
This work was supported in part by the National Natural Science Foundation of China under Grant 62173066, 62250061 and 62176042, and in part by Sichuan Science and Technology Program under Grant 2023NSFSC0483, and in part Sponsored by CAAI-Huawei MindSpore Open Fund.
[1] Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In ICML, pages 1180-1189. PMLR, 2015.
[2] Zhekai Du, Jingjing Li, Hongzu Su, Lei Zhu, and Ke Lu. Cross-domain gradient discrepancy minimization for unsupervised domain adaptation. In CVPR, pages 3937-3946, 2021.
[3] Kuniaki Saito, Kohei Watanabe, Yoshitaka Ushiku, and Tatsuya Harada. Maximum classifier discrepancy for unsupervised domain adaptation. In CVPR, pages 3723-3732, 2018.
[4] Viraj Prabhu, Arjun Chandrasekaran, Kate Saenko, and Judy Hoffman. Active domain adaptation via clustering uncertainty-weighted embeddings. In ICCV, pages 8505-8514, 2021.
[5] Binhui Xie, Longhui Yuan, Shuang Li, Chi Harold Liu, Xinjing Cheng, and Guoren Wang. Active learning for domain adaptation: An energy-based approach. In AAAI, volume 36, pages 8708-8716, 2022.
[6] Ming Xie, Yuxi Li, Yabiao Wang, Zekun Luo, Zhenye Gan, Zhongyi Sun, Mingmin Chi, Chengjie Wang, and Pei Wang. Learning distinctive margin toward active domain adaptation. In CVPR, pages 7993-8002, 2022.
[7] Dan Wang and Yi Shang. A new active labeling method for deep learning. In IJCNN, pages 112-119. IEEE, 2014.
[8] Yazhou Yang and Marco Loog. Active learning using uncertainty information. In ICPR, pages 2646-2651. IEEE, 2016.
[9] Zhenyu Lu and Josh Bongard. Exploiting multiple classifier types with active learning. In GECCO, pages 1905-1906, 2009.
[10] Sheng-Jun Huang, Rong Jin, and Zhi-Hua Zhou. Active learning by querying informative and representative examples. In NeurIPS, 2010.
[11] Bo Fu, Zhangjie Cao, Jianmin Wang, and Mingsheng Long. Transferable query selection for active domain adaptation. In CVPR, pages 7272-7281, 2021.
[12] Avishek Saha, Piyush Rai, Hal Daumé, Suresh Venkatasubramanian, and Scott L DuVall. Active supervised domain adaptation. In ECML-PKDD, pages 97-112. Springer, 2011.
[13] Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In CVPR, pages 427-436, 2015.
[14] Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model's uncertainty? evaluating predictive uncertainty under dataset shift. In NeurIPS, 2019.
[15] Deng-Bao Wang, Lei Feng, and Min-Ling Zhang. Rethinking calibration of deep neural networks: Do not be afraid of overconfidence. In NeurIPS, pages 11809-11820, 2021.
[16] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. In NeurIPS, pages 8780-8794, 2021.
[17] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In NeurIPS, pages 6840-6851, 2020.
[18] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021.
[61] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 9(11), 2008.
[62] Kuniaki Saito, Donghyun Kim, Stan Sclaroff, Trevor Darrell, and Kate Saenko. Semi-supervised domain adaptation via minimax entropy. In ICCV, pages 8050-8058, 2019.
[63] Durk P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In NeurIPS, 2015.
[64] Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In ICML, pages 1050–1059. PMLR, 2016.
[65] Audun Jsang. Subjective Logic: A formalism for reasoning under uncertainty. Springer Publishing Company, Incorporated, 2018.
[66] Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In NeurIPS, 2017.
[67] Shiwei Liu, Tianlong Chen, Zahra Atashgahi, Xiaohan Chen, Ghada Sokar, Elena Mocanu, Mykola Pechenizkiy, Zhangyang Wang, and Decebal Constantin Mocanu. Deep ensembling with no overhead for either training or testing: The all-round blessings of dynamic sparsity. arXiv preprint arXiv:2106.14568, 2021.
Appendix Contents
A. Derivations
B. Algorithm
C. More Implementation Details
D. Additional Experimental Results
E. Further Discussion
F. Limitations and Broader Impacts
A Derivations
A.1 Derivation of the Labeled Source Objective
Given a labeled source sample  $(\pmb{x}^s,\pmb{y}_0^s)$ , our goal is to inference the latent data representation  $z^{s}$  and a sequence of latent class representations  $\pmb{y}_{1:T}^{s}$ , which controls the generation process of data points and predictions, respectively. The log-likelihood of the labeled source data can thus be expressed by:
$$
\log p \left(\boldsymbol {x} ^ {s}, \boldsymbol {y} _ {0} ^ {s}\right) = \log \int p \left(\boldsymbol {x} ^ {s}, \boldsymbol {y} _ {0: T} ^ {s}, \boldsymbol {z} ^ {s}\right) d \boldsymbol {y} _ {1: T} ^ {s} d \boldsymbol {z} ^ {s}. \tag {17}
$$
Since Eq. (17) is intractable to compute in practice, we then leverage variational inference to approximate the posterior distribution of unknown variables  $(\pmb{z}^s,\pmb{y}_{1:T}^s)$  and solve it by optimizing the following ELBO:
$$
\log \int p \left(\boldsymbol {x} ^ {s}, \boldsymbol {y} _ {0: T} ^ {s}, \boldsymbol {z} ^ {s}\right) d \boldsymbol {y} _ {1: T} ^ {s} d \boldsymbol {z} ^ {s} \geq \mathbb {E} _ {q \left(\boldsymbol {y} _ {1: T} ^ {s}, \boldsymbol {z} ^ {s} \mid \boldsymbol {x} ^ {s}, \boldsymbol {y} _ {0} ^ {s}\right)} \left[ \log \frac {p \left(\boldsymbol {y} _ {0 : T} ^ {s} , \boldsymbol {x} ^ {s} , \boldsymbol {z} ^ {s}\right)}{q \left(\boldsymbol {y} _ {1 : T} ^ {s} , \boldsymbol {z} ^ {s} \mid \boldsymbol {x} ^ {s} , \boldsymbol {y} _ {0} ^ {s}\right)} \right], \tag {18}
$$
where  $q(\boldsymbol{z}^s, \boldsymbol{y}_{1:T}^s \mid \boldsymbol{x}^s, \boldsymbol{y}_0^s)$  is the approximation of the ground-truth joint posterior  $p(\boldsymbol{z}^s, \boldsymbol{y}_{1:T}^s \mid \boldsymbol{x}^s, \boldsymbol{y}_0^s)$ , which can be further factorized as:
$$
q \left(\boldsymbol {z} ^ {s}, \boldsymbol {y} _ {1: T} ^ {s} \mid \boldsymbol {x} ^ {s}, \boldsymbol {y} _ {0} ^ {s}\right) = q _ {\rho} \left(\boldsymbol {z} ^ {s} \mid \boldsymbol {x} ^ {s}, \boldsymbol {y} _ {0} ^ {s}\right) q \left(\boldsymbol {y} _ {1: T} ^ {s} \mid \boldsymbol {y} _ {0}, \boldsymbol {z} ^ {s}, \boldsymbol {x} ^ {s}\right). \tag {19}
$$
With Eq. (19) and the generative process assumed in Eq. (8), we have the following derivation:
In ①, the forward diffusion process  $q(\pmb{y}_{1:T}^s \mid \pmb{x}^s, \pmb{z}^s, \pmb{y}_0^s)$  and the reverse diffusion process  $p_\theta(\pmb{y}_{0:T}^s \mid \pmb{x}^s, \pmb{z}^s)$  are still based on the original input  $\pmb{x}^s$ . In this work, we make a simplification design to assume that the observed class variable  $\pmb{y}_0^s$  and latent ones  $\pmb{y}_{1:T}^s$  are only conditioned
on the latent variable  $z^s$ . We demonstrate the reasonability of this simplification in Appendix A.3. Consequently, we have
$$
① = \mathbb {E} _ {q \left(\boldsymbol {y} _ {1: T} ^ {s} \mid \boldsymbol {z} ^ {s}, \boldsymbol {y} _ {0} ^ {s}\right)} \left[ \frac {p _ {\theta} \left(\boldsymbol {y} _ {0 : T} ^ {s} \mid \boldsymbol {z} ^ {s}\right)}{q \left(\boldsymbol {y} _ {1: T} ^ {s} \mid \boldsymbol {y} _ {0} ^ {s} , \boldsymbol {z} ^ {s}\right)} \right], \tag {21}
$$
which has the same form of ELBO as the diffusion classifier in Eq. (4).
A.2 Expression of the Labeled Target Objective
For the labeled target data  $(\pmb{x}^t,\pmb{y}_0^t)$ , the unknown latent variables are the same as the labeled source data, and therefore the ELBO is analogous to that of the labeled source data. The only difference is that we use the target-specific decoder  $p_{\psi}(\pmb{x}^t\mid \pmb{z}^t)$ . We give the full expression as follows:
Analogously, we additionally impose the classifier  $p_{\omega}(\pmb{y}_0^t \mid \pmb{z}^t)$  in the latent space to jointly train the source and target labeled data. The final training objective  $\mathcal{L}_t^l$  for labeled target data is therefore:
$$
\mathcal {L} _ {t} ^ {l} = - \mathcal {L} _ {E L B O} ^ {l} + \mathbb {E} _ {\left(\boldsymbol {x} ^ {t}, \boldsymbol {y} _ {0} ^ {t}\right) \sim \mathcal {T} _ {l}} \mathbb {E} _ {q _ {\rho} \left(\boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} \left[ - \log p _ {\omega} \left(\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {z} ^ {t}\right) \right]. \tag {23}
$$
A.3 Derivation of the Unlabeled Target Objective
For the unlabeled target data  $\boldsymbol{x}^t$ , our goal is to inference the low-dimensional latent embedding  $z^t$  that induces a domain-invariant latent space  $\mathcal{Z}$  and the class label  $y_0^t$  based on  $z^t$ . Besides, we assume a meanfield distribution on  $q(\boldsymbol{z}^t, \boldsymbol{y}_0^t \mid \boldsymbol{x}^t)$ , which can then be factorized as:
$$
q \left(\boldsymbol {z} ^ {t}, \boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t}\right) = q \left(\boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}\right) q \left(\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t}\right). \tag {24}
$$
Therefore, we optimize the following ELBO by regarding  $z^t$  and  $y_0^t$  as unknowns:
$$
\begin{array}{l} \log p \left(\boldsymbol {x} ^ {t}\right) = \log \int p \left(\boldsymbol {x} ^ {t}, \boldsymbol {y} _ {0} ^ {t}, \boldsymbol {z} ^ {t}\right) d \boldsymbol {y} _ {0} ^ {t} d \boldsymbol {z} ^ {t} \\ \geq \mathbb {E} _ {q \left(\boldsymbol {y} _ {0} ^ {t}, \boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} \left[ \log \frac {p \left(\boldsymbol {x} ^ {t} , \boldsymbol {y} _ {0} ^ {t} , \boldsymbol {z} ^ {t}\right)}{q \left(\boldsymbol {y} _ {0} ^ {t} , \boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} \right] \\ = \mathbb {E} _ {q \left(\boldsymbol {y} _ {0} ^ {t}, \boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} \left[ \log \frac {p (\boldsymbol {z} ^ {t}) p _ {\psi} (\boldsymbol {x} ^ {t} \mid \boldsymbol {z} ^ {t}) p _ {\omega} \left(\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t} , \boldsymbol {z} ^ {t}\right)}{q _ {\rho} \left(\boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}\right) q \left(\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} \right] \\ = \mathbb {E} _ {q \left(\boldsymbol {y} _ {0} ^ {t}, \boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} \left[ \log \frac {p \left(\boldsymbol {z} ^ {t}\right)}{q _ {\rho} \left(\boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} + \log p _ {\psi} \left(\boldsymbol {x} ^ {t} \mid \boldsymbol {z} ^ {t}\right) + \log \frac {p _ {\omega} \left(\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t} , \boldsymbol {z} ^ {t}\right)}{q \left(\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} \right] \tag {25} \\ = \mathbb {E} _ {q _ {\rho} (\boldsymbol {z} ^ {t} | \boldsymbol {x} ^ {t})} [ \log p _ {\psi} (\boldsymbol {x} ^ {t} \mid \boldsymbol {z} ^ {t}) ] - D _ {K L} \left(q _ {\rho} (\boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}) \| p (\boldsymbol {z} ^ {t})\right) + \\ \end{array}
$$
$$
\begin{array}{l} \mathbb {E} _ {\boldsymbol {z} ^ {t} \sim q _ {\rho} (\boldsymbol {z} ^ {t} | \boldsymbol {x} ^ {t})} \mathbb {E} _ {q \left(\boldsymbol {y} _ {0} ^ {t} | \boldsymbol {x} ^ {t}\right)} \left[ \log \frac {p _ {\omega} \left(\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t} , \boldsymbol {z} ^ {t}\right)}{q \left(\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t}\right)} \right] \\ = \mathbb {E} _ {q _ {\rho} (\boldsymbol {z} ^ {t} | \boldsymbol {x} ^ {t})} [ \log p _ {\psi} (\boldsymbol {x} ^ {t} \mid \boldsymbol {z} ^ {t}) ] - D _ {K L} \left(q _ {\rho} (\boldsymbol {z} ^ {t} \mid \boldsymbol {x} ^ {t}) \| p (\boldsymbol {z} ^ {t})\right) - \\ \end{array}
$$
$$
\mathbb {E} _ {\boldsymbol {z} ^ {t} \sim q (\boldsymbol {z} ^ {t} | \boldsymbol {x} ^ {t})} \underbrace {\left[ D _ {K L} (q (\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t}) \| p _ {\omega} (\boldsymbol {y} _ {0} ^ {t} \mid \boldsymbol {x} ^ {t} , \boldsymbol {z} ^ {t}) \right]} _ {\text {②}} := \mathcal {L} _ {E L B O} ^ {u}.
$$
Since our deterministic classifier encodes the covariate-dependence between  $\mathbf{y}_0^t$  and  $z^t$ , therefore,  $\mathbf{y}_0^t$  is not depended on  $\mathbf{x}_t$  in our formulation, i.e.,  $p_{\omega}(\mathbf{y}_0^t \mid \mathbf{x}^t, \mathbf{z}^t) = p_{\omega}(\mathbf{y}_0^t \mid \mathbf{z}^t)$ . ② demonstrates that, to maximize  $\mathcal{L}_{ELBO}^u$ ,  $D_{KL}(q(\mathbf{y}_0^t \mid \mathbf{x}^t) \| p_{\omega}(\mathbf{y}_0^t \mid \mathbf{z}^t) \equiv 0$  should always be satisfied. On the other hand, we empirically find that  $p_{\omega}(\mathbf{y}_0^t \mid \mathbf{z}^t)$  can be a good approximation of  $q(\mathbf{y}_0^t \mid \mathbf{x}^t)$  even when it is solely based on latent  $\mathbf{z}^t$ . Therefore, we assume that the model output  $\mathbf{y}_0^t$  is only depended on the latent embedding  $\mathbf{z}^t$ , which supports the derivation in Eq. (20).
B Algorithm
B.1 Algorithm of DAPM-TT for Conventional Active Domain Adaptation
The overall trianing and section procedure of DAPM-TT for ADA is summarized in Algorithm 1.
Algorithm 1 Pseudo code of DAPM-TT for ADA
Require: Labeled source dataset  $S$ , whole target dataset  $\mathcal{T}$ , unlabeled target dataset  $\mathcal{T}_u$ , labeled target dataset  $\mathcal{T}_l$ , total training rounds  $R$ , total annotation budget  $B$ , per round annotation budget  $b$ , step number per adaptation stage  $N_a$ , step number per diffusion stage  $N_d$ .
Ensure: Optimal model parameters  $\{\theta, \rho, \phi, \psi, \omega, \tau\}$ .
1: Initialize student model parameters  $\{\rho, \omega\}$  and other parameters  $\{\theta, \phi, \psi, \tau\}, \mathcal{T}^l = \emptyset, \mathcal{T}^u = \mathcal{T}$
2: Initialize teacher model parameters  $\Omega^{\prime} = \{\rho ,\omega \}$
3: for  $t = 1$  to  $R$  do
4: for  $i = 1$  to  $N_{a}$  do
5: Update parameters  $\{\rho, \phi, \psi, \omega, \tau\}$  via optimizing Eq. (14). % Adaptation Stage
6: Update teacher model parameters  $\Omega^{\prime}$  with updated  $\{\rho ,\omega \}$  based on EMA.
8: for  $j = 1$  to  $N_{d}$  do
9: Update diffusion classifier parameters  $\theta$  via optimizing Eq. (15). % Diffusion Stage
10: end for
11: if  $t \leq \frac{B}{h}$  then
12: For each  $x^{t}\in \mathcal{T}_{u}$  , generate  $N$  predictions  $\{\widetilde{y}_n^t\}_{n = 1}^N$  % Selection Stage
13: Identify the two most predicted classes  $a, b$  for each  $\pmb{x}^t$ .
14: Conduct t-test between  $\{\widetilde{y}_n^t [a]\}_{n = 1}^N$  and  $\{\widetilde{y}_n^t [b]\}_{n = 1}^N$  and obtain the p-value for each  $x^{t}$
15: Selected  $\leftarrow$  Select samples with top- $b$  p-values from  $\mathcal{T}_u$ .
16:  $\mathcal{T}_u = \mathcal{T}_u\backslash Selected,\mathcal{T}_l = \mathcal{T}_l\cup Selected.$
17: end if
18: end for
19: return Final model parameters  $\{\theta, \rho, \phi, \psi, \omega, \tau\}$ .
B.2 Algorithm of DAPM-TT for Source-Free Active Domain Adaptation
In SFADA, We do not use the domain classifier since the source domain data and target domain data cannot co-exist. In addition, we also use confident unlabeled target samples that are pseudo-labeled by the teacher model to substitute the source-labeled samples in  $\mathcal{L}_s$  in the diffusion stage. We denote the corresponding training loss by  $\mathcal{L}_t^p$ .
The overall trianing and section procedure of DAPM-TT for SFADA is summarized in Algorithm 2.
Algorithm 2 Pseudo code of DAPM-TT for SFADA
Require: Labeled source dataset  $\mathcal{S}$  for pre-training, whole target dataset  $\mathcal{T}$ , unlabeled target dataset  $\mathcal{T}_u$ , labeled target dataset  $\mathcal{T}_l$ , total training rounds  $R$ , total annotation budget  $B$ , per round annotation budget  $b$ , step number per adaptation stage  $N_a$ , step number per diffusion stage  $N_d$ , step number of source pre-training  $N_s$ .  
Ensure: Optimal model parameters  $\{\theta, \rho, \phi, \psi, \omega\}$ .  
1: Initialize model parameters  $\{\rho, \omega\}$  and other parameters  $\{\theta, \phi, \psi\}, \mathcal{T}^l = \emptyset$ ,  $\mathcal{T}^u = \mathcal{T}$   
2: for  $i = 1$  to  $N_s$  do  
3: Update source model parameters  $\rho, \phi, \omega$  via optimizing  $\mathcal{L}_s$ . % Source Pre-training  
4: end for  
5: Initialize teacher model parameters  $\Omega' = \{\rho, \omega\}$   
6: for  $t = 1$  to  $R$  do  
7: for  $j = 1$  to  $N_a$  do  
8: Update parameters  $\{\rho, \psi, \omega\}$  via optimizing  $\mathcal{L}_t^u + \mathcal{L}_t^l$ . % Adaptation Stage  
9: Update teacher model parameters  $\Omega'$  with updated  $\{\rho, \omega\}$  based on EMA.  
10: end for  
11: for  $k = 1$  to  $N_d$  do  
12: Update diffusion classifier parameters  $\theta$  via optimizing  $\mathcal{L}_t^p + \mathcal{L}_t^l$ . % Diffusion Stage  
13: end for  
14: if  $t \leq \frac{B}{b}$  then  
15: For each  $\boldsymbol{x}^t \in \mathcal{T}_u$ , generate  $N$  predictions  $\{\widetilde{\boldsymbol{y}}_n^t\}_{n=1}^N$  % Selection Stage  
16: Identify the two most predicted classes  $a, b$  for each  $\boldsymbol{x}^t$ .  
17: Conduct t-test between  $\{\widetilde{\boldsymbol{y}}_n^t[a]\}_{n=1}^N$  and  $\{\widetilde{\boldsymbol{y}}_n^t[b]\}_{n=1}^N$  and obtain the p-value for each  $\boldsymbol{x}^t$ .  
18: Selected ← Select samples with top- $b$  p-values from  $\mathcal{T}_u$ .  
19:  $\mathcal{T}_u = \mathcal{T}_u \backslash Selected$ ,  $\mathcal{T}_l = \mathcal{T}_l \cup Selected$ .  
20: end if  
21: end for  
22: return Final model parameters  $\{\theta, \rho, \phi, \psi, \omega\}$ .
Variational Autoencoder The architecture of the VAE and the deterministic classifier is presented in detail in Fig. 5. The encoder comprises a pre-trained ResNet-50 backbone and three initialized linear layers with a ReLU activation following the first linear layer. We assume a Gaussian distribution for the latent embedding, and its mean and covariance are estimated by two separate linear layers based on the first linear layer. The decoder is a two-layer MLP that has the same output dimension as the backbone's output. This encourages the decoder to reconstruct the feature generated by the backbone.
Deterministic Classifier The deterministic is simply a single layer linear classifier. We adopt the weight normalization technique on the classifier to stabilize the training.
Diffusion Classifier The diffusion classifier is conditioned on the latent embedding  $\mathbf{z}$ , the ground-truth  $\mathbf{y}$ , the guided information  $f_{\Omega}$  and the time step  $t$ . We adopt the same architecture as [19] for class variable diffusion, except for the dimension of the input variable. For clarity, we describe the detailed model structure in Fig. 6 (a).
Figure 5: Architecture of the variational autoencoder and the deterministic classifier used in this work. The numbers on the data flow indicate the dimensions of the model output.
Figure 6: Architecture of (a) the diffusion classifier and (b) the domain discriminator.
Domain Discriminator. As shown in Fig. 6 (b). The domain discriminator we used is a three-layer MLP with a Dropout layer after the first and the second layers. And the output is a one-dimensional value with Sigmoid activation, which indicates the domainness of the sample.
Conventional Active Domain Adaptation. In the adaptation stage, we utilize the SGD optimizer with a learning rate of 0.01, momentum of 0.9, and weight decay of 0.001. We set the EMA rate for the teacher model to 0.99. In the VAE objective, we assume a standard Gaussian distribution,  $\mathcal{N}(0, I)$ , for the prior distribution of the latent variable  $z^s(z^t)$ . For Office-31 and VisDA, we use the features generated by a pre-trained ResNet-50 and freeze the backbone parameters to accelerate training and conserve memory. However, for Office-Home, which has more diverse categories, we jointly train the backbone with other modules to learn more specific category knowledge, and we set the learning rate to 0.001, which is 10 times lower than that of other models. For Office-31 and Office-Home, we conduct adaptation for 5 epochs and train the diffusion classifier for 10 epochs in each training round. The total number of training rounds is 20. For VisDA, we set the epoch number in each stage to 1, and the total number of training rounds is 10. To train the diffusion classifier, we use the Adam optimizer with a learning rate of 0.001 and epsilon of 1e-8. The batch size is the same as that in the adaptation stage, and we use an EMA strategy with a rate of 0.9999 to update the model parameters. All experiments are conducted on a single RTX 3090 GPU.
Source-Free Active Domain Adaptation. In SFADA, we use the SGD optimizer without momentum and weight decay for adaptation. The learning rate is set to 0.01 for Office-31 and Office-Home, and 0.001 for VisDA. As with ADA, we freeze the backbone for Office-31 and VisDA and open it for
Office-Home. We pre-train the source model for 10 epochs for VisDA and 30 epochs for the other datasets. In each active learning round, we set the epoch numbers for the adaptation stage and the diffusion stage to 5 and 10, respectively, for Office-31 and Office-Home, and both to one for VisDA. The training details for the VAE, teacher model, and diffusion classifier are the same as in ADA.
C.3 Hyperparameter Choices of the Diffusion Classifier
Following [19], the hyperparameters of the diffusion classifier are set in a standard DDPM [17] manner. Specifically, the number of diffusion timesteps  $T$  is set to 1000, and a linear noise schedule with  $\beta_{1} = 0.0001$  and  $\beta = 0.02$  is adopted for the forward diffusion process.
C.4 Implementation of Compared Baseline Methods
Note that for conventional ADA, we cite the results of previous AL methods and ADA methods reproduced in [5] if the experimental settings are the same. For DUC [20] that does not report the result on Office-31 dataset, we report the results by our own runs based on the code from the official repository at https://github.com/BIT-DA/DUC. We have tuned some hyperparameters to ensure the best results we can achieve.