Stabilizing In-Context Multi-Source Domain Adaptation for Biomedical Images Through Controls

Ana Sanchez-Fernandez, Thomas Pinetz, Werner Zellinger, Günter Klambauer

TL;DR

Batch effects are a major hurdle for applying deep learning to biomedical images, causing models to perform poorly on new data. This paper introduces CS-ARM-BN, a novel method that leverages "negative control" samples, a common experimental artifact, to stabilize model adaptation. This approach significantly improves robustness to variations in data size and class distribution, making deep learning models more reliable for real-world biomedical applications like drug discovery.

What Problem Does This Paper Address?

Deep learning models hold immense promise for analyzing biomedical images to predict crucial information like disease states or drug effects. However, a persistent challenge is "batch effects" – unwanted variations in image data caused by differences in experimental conditions (e.g., different days, equipment, or reagents). These effects can be more prominent than the actual biological signal of interest, severely degrading a model's ability to generalize to new, unseen data.

Traditional domain adaptation methods often assume a simple setup of one source and one target domain. Biological datasets, however, are inherently multi-source, with data often coming from various experimental batches. While some methods adapt models at test time using Batch Normalization (BN) statistics, they falter when dealing with small target batch sizes or shifts in class distribution (i.e., when the proportion of different classes changes in the new data). This is a critical limitation, as real-world biological experiments often involve small sample sizes and varying class distributions.

Methods

The core innovation of this paper is CS-ARM-BN (Control-Stabilized Adaptive Risk Minimization with Batch Normalization). It builds upon existing meta-learning adaptation methods, specifically ARM-BN, which learns to adapt BN statistics during training. The key novelty is the strategic use of negative control samples.

  • Negative Controls: These are unperturbed samples included in nearly every biological experiment as a baseline. They represent the technical variation of the batch without any biological signal.
  • In-Context Adaptation: CS-ARM-BN uses these negative controls, along with the actual experimental (perturbed) samples, as a "context" to adapt the model's BN statistics at test time. This context is used without any gradient updates, making it a fast, in-context learning approach.
  • Stabilization: By incorporating controls, which are independent of the biological signal and class distribution, CS-ARM-BN creates a more stable and reliable estimate of batch-specific technical variations. This makes the adaptation process robust even when the number of perturbed samples is small or the class distribution is skewed.

Datasets

The primary dataset used for evaluation is the JUMP-CP dataset. This is a large-scale dataset for microscopy imaging, specifically used for Mechanism-Of-Action (MoA) classification, a crucial task in drug discovery. The authors utilize sources 3 and 8 from this dataset.

Key Insights and Ideas

  • Negative Controls are Gold: The paper highlights that a common experimental artifact (negative controls) can be repurposed as a powerful tool for improving model robustness.
  • Context is King for Adaptation: The "in-context learning" paradigm, where models condition their predictions on a small set of unlabeled samples from the new batch, is shown to be highly effective for biomedical image adaptation.
  • BN Statistics are Sensitive: Existing BN-based adaptation methods are highly susceptible to small batch sizes and label shifts because their statistics become noisy and confounded by these factors.
  • Trade-off Management: CS-ARM-BN effectively manages the bias-variance trade-off. It introduces a small bias but significantly reduces variance, leading to lower overall error, especially in challenging real-world scenarios.

Key Results

  • Robustness to Batch Size: CS-ARM-BN significantly outperforms existing methods like AdaBN and ARM-BN when adapting with very few perturbed samples (as low as M=1). For instance, in Table A7, CS-ARM-BN maintains high accuracy (around 0.92) even with a labeled batch size of 1, while others drop drastically.
  • Robustness to Label Shift: The method demonstrates remarkable stability under varying degrees of label shift (Table 3 and Table A9). While methods like TENT, AdaBN, and ARM-BN see accuracy plummet as label shift increases, CS-ARM-BN's performance remains high, achieving around 0.90 accuracy even with severe label shift.
  • Closing the Generalization Gap: CS-ARM-BN effectively closes the gap between in-domain and out-of-domain performance. In Table 1, it achieves an accuracy of 0.930 ± 0.019 on new experimental batches, very close to the in-domain baseline of 0.939 ± 0.005.
  • Cross-Source Transfer: While challenging, CS-ARM-BN shows improved robustness in cross-source transfer experiments (Table 2), indicating its potential for adapting to data from different labs or instruments.

Limitations and Future Work

  • Control Sample Availability: The method relies on the presence of negative control samples, which are common but not universally guaranteed in all experimental settings.
  • Cell Line Specificity: The study did not explore scenarios where control samples might come from a different cell line than the perturbed samples.
  • Image-Level vs. Well-Level: Most experiments were performed at the image level. The authors note that aligning at the plate level (which has fewer samples but more consistent experimental conditions) yielded better results than batch or source level alignment, suggesting that the "level" of domain alignment is crucial.
  • Future Directions: The authors suggest exploring other scenarios, such as different cell lines for controls, and investigating the impact of processing all well images together for more stable results. They also mention that test-time scaling (using higher resolution images at inference) can further improve performance, indicating a trade-off between efficiency and accuracy.

Summary updated

Abstract

Biomedical imaging data presents enormous potential for deep learning models to predict invaluable properties, such as diseases and drug effects. However, unavoidable alterations of the technical conditions cause *batch effects*: variations between groups of samples that are not due to any biological signal of interest. Batch effects greatly hinder the generalization abilities of deep learning models, preventing their practical use in the real world. Unsupervised Domain Adaptation (UDA) methods have been proposed to mitigate batch effects, but they usually assume that the data is comprised of only one source domain and one target domain, whereas biological datasets are comprised of multiple domains, both at training and at inference time. While Batch Normalization–based test-time and meta-learning adaptation methods offer a promising mechanism for domain alignment, we show that existing approaches exhibit degraded performance under the usual inference scenarios of small target batch sizes and label shift. We address these limitations by leveraging negative control samples, which are consistently present in every experimental batch in biological datasets, as stable context for adaptation. We propose CS-ARM-BN, a meta-learning BN adaptation method that uses controls both during training and inference to stabilize domain statistics. We perform a suite of experiments of Mechanism-Of-Action (MoA) classification, a crucial task for drug discovery, on the large JUMP-CP imaging dataset. Our experiments show that CS-ARM-BN substantially improves robustness to batch size and class distribution shifts, enabling practical use of deep learning models for biomedical images.
BibTeX
@inproceedings{sanchezfernandez2026stabilizing,
  author = {Ana Sanchez-Fernandez and Thomas Pinetz and Werner Zellinger and Günter Klambauer},
  title = {{Stabilizing In-Context Multi-Source Domain Adaptation for Biomedical Images Through Controls}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=oUGeAcxuz5},
}
Figure