arXiv:2609.09737cs.CVSep 2026

Manuscript Offprint

arXiv:2609.09737

Distilling Image Prototypes for Guided Test-Time Adaptation

Liwen Wang, Xingbo Dong, Iman Yi Liao, Deyin Liu, Massimo Tistarelli, Lin Yuanbo Wu, Zhe Jin

Liwen Wang, Xingbo Dong, Iman Yi Liao, Deyin Liu, Member, IEEE, Massimo Tistarelli, Lin Yuanbo Wu, Senior Member, IEEE, Zhe Jin, Member, IEEE

Abstract—Test-Time Adaptation (TTA) enhances the robustness of models against distribution shifts but faces two critical challenges: error accumulation from noisy pseudo-labels and catastrophic forgetting of source knowledge. Uncertainty-based approaches designed to mitigate error accumulation often yield overconfident or computationally expensive estimates, while strategies intended to prevent forgetting via prototype replay rely on static representations that easily become misaligned as the model adapts. To address these issues, this paper proposes a novel framework, Distilling Image Prototype for Guided Test-Time Adaptation (DIPTA). The core of the proposed approach is the introduction of a Distill Image Prototype (DIP), a compact set of synthetic images that serves as a dynamic and regenerative anchor of source knowledge. This prototype enables a dynamic feature replay mechanism that continuously generates feature prototypes aligned with the current state of the model, thus effectively preventing catastrophic forgetting. Furthermore, the DIP anchors a source-calibrated uncertainty estimation method, which provides a less biased measure of sample reliability by leveraging stable source knowledge, thereby robustly suppressing error accumulation. Extensive experiments on multiple benchmarks demonstrate that DIPTA significantly outperforms state-of-the-art methods, particularly under severe domain shifts. The source code is available at https://github.com/LiwenWang919/DIPTA.

Index Terms—Test-time adaptation, distilling image prototype, dynamic replay, source-calibrated uncertainty estimation.

I. INTRODUCTION

DEEP learning models struggle when test data shifts from their training distribution. Test-Time Adaptation (TTA) addresses this by enabling online adaptation using unlabeled data [1]–[4]. However, TTA faces two major hurdles: error accumulation from noisy pseudo-labels and the catastrophic forgetting of original source knowledge. Current strategies to combat catastrophic forgetting often involve replaying information from the source domain. A prominent line of work [5], [6] advocates for replaying pre-computed feature prototypes, which are class-wise average feature vectors derived from the source data. This line of research also includes methods that maintain a source-like feature bank or use nearest-neighbor retrieval [7]. However, these approaches have a critical flaw: these prototypes are computed once using the pretrained source model and remain static throughout the adaptation process. As the model updates its parameters to the target domain, its internal feature representation evolves, causing a growing misalignment between the static prototypes and the current feature space of the model. Consequently, these outdated prototypes provide a progressively potentially misleading anchor, thereby failing to prevent forgetting effectively. This fundamental limitation motivates the first research question: How can a replay-capable knowledge anchor be established that dynamically evolves with the model to alleviate catastrophic forgetting in a continually shifting environment?

Conversely, mitigating error accumulation typically relies on uncertainty estimation to identify and down-weight unreliable predictions. However, existing methods face a significant dilemma. Entropy-based techniques [8]–[10] are prone to overconfidence, especially on out-of-distribution data, as they only capture the sharpness of the output distribution, not the true epistemic uncertainty of the model [1], [2], [11], [12]. While more principled Bayesian methods [13], [14] can capture this uncertainty, they are frequently computationally prohibitive for online TTA. Recent efforts to improve their efficiency, such as through last-layer variational inference [15] or simplified Laplace approximations [16], still face challenges in non-stationary TTA settings. More critically, both types of estimates are inherently biased in the TTA context because they are computed solely based on the reaction of the model to the target data, which is itself non-stationary and potentially noisy. There is no stable reference point from the source domain to ground these estimates. This leads to the second research question: How can a stable source-domain anchor be leveraged to achieve unbiased uncertainty estimation, thereby reliably suppressing error accumulation?

It is identified that the root cause of both limitations is the lack of a dynamic, reliable, and efficient source of knowledge during adaptation. To bridge this gap, this paper introduces a concept dubbed Distilling Image Prototype (DIP). A DIP is not a static feature vector but a compact set of synthetic images distilled from the entire source dataset. This distillation process refines synthetic images so that a model trained on them closely resembles the performance of a model trained on the complete source data [17]. The key advantage of the DIP is its regenerability: it exists in the image space, allowing it to be continuously processed through the updated feature extractor

This work was supported by the National Natural Science Foundation of China (Grant No. 62306003), the Open Research Fund of Guangdong Laboratory of Artificial Intelligence and Digital Economy (SZ) (Grant No. GML-KF-24-29), and the Open Foundation of Jiangxi Provincial Key Laboratory of Image Processing and Pattern Recognition (Grant No. ET202404437). (Corresponding author: Xingbo Dong and Zhe Jin)

Liwen Wang, Xingbo Dong, Deyin Liu, and Zhe Jin are with the Anhui Provincial Key Laboratory of Secure Artificial Intelligence, Anhui Provincial International Joint Research Center for Advanced Technology in Medical Imaging, School of Artificial Intelligence, Anhui University, Hefei 230093, China (e-mail: liwenwang@stu.ahu.edu.cn; xingbo.dong@ahu.edu.cn; jinzhe@ahu.edu.cn).

Iman Yi Liao is with the School of Computer Science, University of Nottingham (Malaysia Campus), Selangor Darul Ehsan, 43500, Malaysia (e-mail: Iman.Liao@nottingham.edu.my).

Massimo Tistarelli is with the Department of Engineering, University of Sassari, Sassari, Italy (e-mail: tista@uniss.it).

Lin Yuanbo Wu is with the School of Engineering, University of Warwick, CV4 7AL Coventry, U.K. (e-mail: jolin.lwu@gmail.com).

0000-0000/00$00.00 © 2026 IEEE during adaptation. This enables the on-demand generation of feature prototypes that are inherently aligned with the current feature space of the model, thereby solving the misalignment issue of static prototypes.

Guided by this concept, the Distilling Image Prototype for Guided Test-Time Adaptation (DIPTTA) framework is proposed. The DIP acts as a unified anchor, enabling two key innovations. First, to establish a replay-capable knowledge anchor that dynamically evolves with the model to prevent catastrophic forgetting in a continually shifting environment, the feature prototypes are regenerated for each incoming batch of target data by forwarding the DIP through the current student model. These dynamic prototypes are then used in a contrastive loss to pull the features of pseudo-labeled target samples towards their corresponding class anchors, ensuring that the model retains source knowledge without feature space distortion. Second, to leverage a stable source-domain anchor to achieve unbiased uncertainty estimation, thereby reliably suppressing error accumulation, the predictive uncertainty is computed by observing the response of the model (specifically, the classifier head) to the feature prototypes generated from the DIP. This measures the consistency between the target sample and the stable source knowledge, rather than the self-confidence of the model regarding the target sample alone. The resulting uncertainty measure is inherently unbiased and serves as a robust weight to modulate the contribution of each sample to the adaptation loss, effectively curating the learning signal. The key contributions can be summarized as follows:

• We introduce the novel concept of a Distilling Image Prototype (DIP) for test-time adaptation. A DIP is a compact set of synthetic images that serve as a dynamic and regenerative knowledge anchor, overcoming the rigidity of static source representations and providing a principled solution to knowledge preservation in non-stationary environments.

• We develop a Dynamic Feature Prototype Replay (DFPR) mechanism based on the DIP. This mechanism continuously regenerates feature prototypes aligned with the model's current state, effectively addressing catastrophic forgetting in continual test-time adaptation without access to the data of the source domain.

• We propose a Source-Calibrated Uncertainty Estimation (SCUE) method that leverages the DIP to debias uncertainty quantification. By anchoring the uncertainty measure in the stable source knowledge, our method provides a more reliable signal for weighting target samples, leading to robust adaptation against error accumulation.

  • Extensive experiments on multiple benchmarks demonstrate that our proposed DIP framework achieves state-of-the-art performance. The consistent improvements across various scenarios, especially under strong domain shifts, validate the effectiveness and robustness of our approach.

References (62)