Manuscript Offprint

arXiv:2611.03528

Contrastive Adapter Training and Consensus Knowledge Distillation for Multi-Source-Free Domain Adaptation in Skin Cancer Diagnosis

Ali Abedi, Q. M. Jonathan Wu, Ning Zhang, Farhad Pourpanah

Abstract

Skin cancer diagnosis, particularly the differentiation of melanoma from benign nevi, is a vital yet challenging task due to the visual similarity between lesions. Although deep learning models such as convolutional neural networks (CNNs) and vision transformers (ViTs) have demonstrated promising performance, their effectiveness often deteriorates when applied to data from heterogeneous clinical sources. While conventional domain adaptation methods address domain shift, they require access to source data during adaptation, which is often infeasible due to privacy regulations. Multi-source-free unsupervised domain adaptation (MSFDA) addresses this limitation by leveraging multiple labeled source domains to generalize to an unlabeled target domain without requiring access to source data, making it suitable for privacy-sensitive medical settings. However, existing MSFDA methods rely on full backbone fine-tuning, leading to catastrophic forgetting and overfitting on small clinical datasets, and address domain shift at the aggregation stage without establishing a shared domain-invariant feature space. Furthermore, their reliance on hard pseudo-labels or confidence-weighted aggregation introduces noisy supervision signals under domain shift. To address these limitations, we propose CAT-CKD, consisting of two components: (1) contrastive adapter training (CAT), which trains lightweight ConvPass adapters within a frozen ViT backbone using supervised contrastive learning (SCL) to establish a shared domain-invariant feature space before source-specific model training, and (2) consensus knowledge distillation (CKD), which aggregates logits from multiple source models into a consensus supervisory signal and adapts a student model on unlabeled target data using KL divergence. Experiments on five publicly available skin lesion datasets show that CAT-

CKD achieves an average AUROC of 86.1%, outperforming existing MSFDA methods while requiring only 4.3M trainable parameters. The code for this paper is available at https://github.com/A-Abedi/CAT_CKD.

Keywords: Skin cancer diagnosis, Supervised contrastive learning, Unsupervised domain adaptation, Knowledge distillation

1. Introduction

Melanoma is one of the most aggressive and potentially fatal forms of skin cancer, responsible for a large number of skin cancer-related deaths worldwide [1, 2]. Early and accurate diagnosis of melanoma is crucial, as it is highly treatable in its initial stages but can rapidly metastasize if left undetected [3]. Differentiating melanoma from benign skin lesions such as nevi is a fundamental challenge in dermatology due to their similar visual appearance [4, 5]. This motivates the development of computer-aided diagnostic systems to assist clinicians in improving diagnostic accuracy.

In recent years, deep learning techniques, such as convolutional neural networks (CNNs) [6, 7, 8] and vision transformers (ViTs) [9], have shown promising results in medical image analysis, including skin cancer diagnosis [4, 2]. However, the limited availability of annotated data drives researchers to rely on existing labeled datasets collected from multiple clinical centers, as annotation requires scarce domain expertise and is prohibitively time-consuming [10]. Nevertheless, a major obstacle remains: the domain shift problem. Variations in imaging devices, acquisition protocols, and patient demographics across centers introduce discrepancies between source and target domains, which substantially degrade the generalizability of deep learning models when deployed in previously unseen clinical data [11, 12, 13, 14]. Compounding this challenge, privacy regulations and institutional policies [15] typically prevent source data from being revisited once a model is deployed to a new clinical environment [16].

Multi-source-free unsupervised domain adaptation (MSFDA) addresses domain shift by leveraging labeled data from multiple source domains to generalize to an unlabeled target domain without requiring access to source data during adaptation. This setup aligns better with real-world clinical settings, where privacy regulations often prevent access to source datasets during deployment [17, 18]. While promising, existing MSFDA methods suffer from two key limitations. First, they rely on full backbone fine-tuning during adaptation, which causes catastrophic forgetting of pretrained representations and overfitting on the small, imbalanced datasets typical of clinical settings. Second, they attempt to reconcile domain shift at the aggregation or adaptation stage [19], without first establishing a shared domain-invariant backbone, which if available, could be frozen during source-specific model training, reducing both overfitting and computational overhead. Furthermore, their reliance on hard pseudo-labels that directly propagate teacher errors [20], or confidence-weighted aggregation that amplifies errors from overconfident teachers [21, 22], introduces noisy supervision signals that are unreliable under the domain shift conditions inherent to multi-center clinical data.

To address the challenge of noisy supervision under domain shift, knowledge distillation (KD) [23] can facilitate the transfer of information from well-trained source models to a target model, which enables effective learning without direct access to the source data [24, 25]. Using multiple teacher models allows KD to mitigate individual source biases and provide more robust supervision signals for the student model. The success of this process depends heavily on the quality of the teacher models, which must be carefully fine-tuned to ensure they provide accurate and consistent guidance.

Addressing the absence of a shared domain-invariant backbone requires a training stage that leverages all available labeled source data jointly with an objective that explicitly encourages same-class samples from different domains to be close together in the feature space. However, directly fine-tuning large pretrained ViTs for this purpose is computationally expensive and prone to overfitting and catastrophic forgetting, particularly when labeled data are scarce and imbalanced across clinical centers. Parameter-efficient fine-tuning (PEFT) methods [26], including adapters [27, 28] and low-rank adaptation (LoRA) [29, 30], offer a practical solution by updating only a small subset of parameters while keeping the backbone frozen, thereby preserving pretrained knowledge and reducing the risk of overfitting. This makes PEFT particularly well-suited for building a shared domain-invariant backbone in the MSFDA setting, where labeled data are limited and privacy constraints prevent repeated access to source data during deployment.

This paper introduces CAT-CKD, an MSFDA framework for skin cancer diagnosis that directly addresses the limitations of prior methods through two complementary components. First, we introduce Contrastive Adapter Training (CAT), a PEFT strategy that inserts convolutional bypass adapters (ConvPass) [28] into a frozen ViT backbone and trains them using supervised contrastive learning (SCL) [31], which encourages intra-class compactness and inter-class separation across domains regardless of their origin, to establish a shared domain-invariant feature space before source-specific models are built. Second, we design a Consensus Knowledge Distillation (CKD) strategy, in which the logits from multiple trained source models are aggregated into a consensus supervision signal, which we show reduces logit-level variance compared to any single teacher, and used to adapt a student model on the unlabeled target domain via Kullback–Leibler (KL) divergence, avoiding the unreliable confidence estimates that plague existing aggregation strategies under domain shift. Because adaptation relies solely on trained source models, the proposed framework avoids direct access to source-domain images during deployment. Extensive experiments demonstrate that CAT-CKD provides a practical and parameter-efficient solution for source-free adaptation in skin cancer diagnosis under data-sharing constraints.

The main contributions of this work include:

  • We propose CAT-CKD, an MSFDA framework for skin cancer diagnosis that explicitly establishes a shared domain-invariant backbone before source-specific models are built, directly addressing the representation-level and supervision-level limitations of existing methods.

  • We introduce CAT, which trains ConvPass adapters using supervised contrastive learning across source domains in the MSFDA setting, producing a shared domain-invariant feature space while avoiding catastrophic forgetting and overfitting.

  • We design CKD, which aggregates logits from multiple source models into a theoretically grounded consensus supervisory signal and adapts a student model on unlabeled target data using a KL-divergence objective, providing more stable supervision than existing aggregation strategies.

  • We conduct extensive experiments, ablation studies, and efficiency analyses on five public skin lesion datasets, demonstrating competitive performance with substantially fewer trainable parameters than existing methods.

The remainder of this paper is organized as follows. Section 2 reviews related work in skin cancer diagnosis, domain adaptation, parameter-efficient fine tuning, and knowledge distillation. Section 3 presents the problem formulation and details the proposed CAT-CKD framework. Section 4 describes the experimental setup and discusses the results. Finally, Section 5 concludes the paper and outlines directions for future work.

References (41)

  • Imaging & Visualization 11 (7) (2024) 2300257
  • A Deep Learning Approach to Differentiating Malignant Melanoma from Benign Melanocytic Nevi, Cancers 17 (1) (2024) 28
  • A Contemporary Review, Open Challenges and Future Research Directions, Cancers 15 (4) (2023) 1183
  • IEEE Conference on Computer Vision and Pattern Recognition, 2016, pp. 770–778
  • Efficient Convolutional Neural Networks for Mobile Vision Applications (Apr
  • Transformers for Image Recognition at Scale, in: International Conference on Learning Representations, 2021
  • A survey, Neurocomputing 312 (2018) 135–153
  • Architecture, Techniques, and Challenges, IEEE Transactions on Services Computing 19 (2) (2026) 1688–1707
  • Advances in Neural Information Processing Systems, Vol. 34, Curran Associates, Inc., 2021, pp. 2848–2860
  • Jing, L. Shao, Make source-free transfer great: Dynamic uncertainty-driven confident fusion for multi-source-free domain adaptation, Information Fusion 127 (2026) 103859
  • Multi-source-free aggregation adaptation with confidence calibration for fault diagnosis, Advanced Engineering Informatics 68 (2025) 103770
  • Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 10103–10112
  • Distilling the Knowledge in a Neural Network
  • Blais-Morin, Joint Progressive Knowledge Distillation and Unsupervised Domain Adaptation, in: 2020 International Joint Conference on Neural Networks (IJCNN), 2020, pp. 1–8
  • Blais-Morin, E. Granger, Knowledge distillation methods for efficient unsupervised adaptation across multiple domains, Image and Vision Computing 108 (2021) 104096
  • A Comprehensive Survey, arXiv:2403.14608 [cs] (Sep (opens arXiv in a new tab)
  • Adapting Image Models for Efficient Video Understanding, in: International Conference on Learning Representations, 2023
  • Deng, S. Chen, Z. Jin, Convolutional bypasses are better vision transformer adapters, in: ECAI 2024, IOS Press, 2024, pp. 202–209
  • Low-Rank Adaptation of Large Language Models (Jun
  • Efficiently Boosting the Robustness of Pretrained Vision Transformers, arXiv:2401.01752 [cs] (Jan (opens arXiv in a new tab)
  • P. Khosla, P. Teterwak, C. Wang, A. Sarna, Y. Tian, P. Isola, A. Maschinot, C. Liu, D. Krishnan, Supervised Contrastive Learning, arXiv:2004.11362 [cs] (Mar. 2021). (opens arXiv in a new tab)
  • A Literature Review, Applied Sciences 13 (9) (2023) 5521
  • Advances in Neural Information Processing Systems, Vol. 30, Curran Associates, Inc., 2017
  • G. Csurka (Ed.), Domain Adaptation in Computer Vision Applications, Springer International Publishing, Cham, 2017, pp. 189–209
  • S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, R. Garnett (Eds.), Advances in Neural Information Processing Systems, Vol. 31, Curran Associates, Inc., 2018
  • Proceedings of the 36th International Conference on Machine Learning, PMLR, 2019, pp. 2790–2799
  • Chen, C. Cardie, S. Belongie, B. Hariharan, S.-N
  • Adapting Vision Transformers for Scalable Visual Recognition, Advances in Neural Information Processing Systems 35 (2022) 16664–16678
  • IEEE Transactions on Pattern Analysis and Machine Intelligence
  • Adapting segment anything model for medical image segmentation, Medical Image Analysis 102 (2025) 103547
  • Paying More Attention to Attention: Improving the Performance of Convolutional Neural Networks via Attention Transfer
  • Adaptive Ensemble Knowledge Distillation in Gradient Space, in: Advances in Neural Information Processing Systems, Vol. 33, Curran Associates, Inc., 2020, pp. 12345–12355
  • 2023 IEEE International Conference on Multimedia and Expo (ICME), 2023, pp. 1943–1948
  • Feature-level Ensemble for Knowledge Distillation, arXiv:1909.10754 [cs] (Sep (opens arXiv in a new tab)
  • 2018 IEEE 15th International Symposium on Biomedical Imaging (ISBI 2018), 2018, pp. 168–172
  • IEEE Journal of Biomedical and Health Informatics
  • Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, 2024, pp. 5157–5166
  • Non-Destructive Task Composition for Transfer Learning, in: P. Merlo, J. Tiedemann, R. Tsarfaty (Eds.), Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, Association for Computational Linguistics, Online, 2021, pp. 487–503
  • Proceedings of the European Conference on Computer Vision (ECCV), 2018
  • Improving semi-supervised learning with pseudo-margins, in: Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2023, pp. 15773–15782
  • Advances in Neural Information Processing Systems, Vol. 31, 2018