Abstract
Pooling heterogeneous datasets across domains is a common strategy in representation learning, but naive pooling can amplify distributional asymmetries and yield biased estimators, especially in settings where zero-shot generalization is required. We propose a matching framework that selects samples relative to an adaptive centroid and iteratively refines the representation distribution. The double robustness and the propensity score matching for the inclusion of data domains make matching more robust than naive pooling and uniform subsampling by filtering out the confounding domains (the main cause of heterogeneity). Theoretical and empirical analyses show that, unlike naive pooling or uniform subsampling, matching achieves better results under asymmetric meta-distributions, which are also extended to non-Gaussian and multimodal real-world settings. Most importantly, we show that these improvements translate to zero-shot medical anomaly detection, one of the extreme forms of data heterogeneity and asymmetry.
Introduction
In high-stakes domains such as medical imaging, the prevailing paradigm for model training is "the more data, the better." Researchers frequently aggregate, or "pool," datasets from multiple institutions to maximize sample size. However, this approach often overlooks the inherent data heterogeneity—systematic differences in scanner protocols, patient demographics, and imaging modalities across hospitals.
This paper demonstrates that naive data pooling can be a "trap." When the meta-distribution of these domains is asymmetric (i.e., containing extreme outliers), simple aggregation introduces systematic biases that severely degrade zero-shot generalization. In such scenarios, "bad" data domains act as confounders, pulling the model's learned representations away from the true target distribution. We propose a Matching framework that selectively includes data based on an adaptive centroid to mitigate these effects.
Methodology: The Matching Framework
The proposed framework moves beyond simple aggregation by treating domain inclusion as a treatment assignment problem, inspired by propensity score matching in statistics.
Causal Matching and Adaptive Centroids
Instead of accepting all available data, the algorithm selectively admits domains based on their proximity to an adaptive centroid. This ensures "ignorability" (where inclusion depends only on observable features) and maintains "overlap" with the target distribution. The framework exhibits "double robustness": it remains stable even if either the matching threshold or the centroid update is slightly suboptimal.
Handling Complex Latent Spaces
To adapt this statistical framework to real-world medical data, we utilize:
- Normalizing Flows: These map complex, non-Gaussian data into a latent space where theoretical guarantees of matching hold.
- Variance-Aware Channel Attention (VACA): In multimodal CLIP feature spaces, VACA adaptively upweights class-discriminative channels while suppressing modality-specific noise (e.g., distinguishing "tumor" signal from "X-ray" noise).
- Geodesic Matching: For CLIP embeddings on a hypersphere, we employ geodesic distance ($d_G$) to preserve the geometric integrity of the feature space.
Experimental Evaluation
We evaluated the framework using the BMAD (Benchmarks for Medical Anomaly Detection) benchmark, covering six datasets across five domains: Brain MRI, Liver CT, Retinal OCT, Chest X-ray, Digital Histopathology (HIS), and RESC. We employed a "leave-one-out" strategy to simulate true zero-shot scenarios.
Robustness and Monotonicity
A key contribution is the introduction of the Data Addition (DA) score, which measures the monotonicity of performance improvement as more training domains are added. While baseline methods like MVFA and AnomalyCLIP often exhibit erratic performance swings when new, potentially confounding data is introduced, our matching framework ensures stable, non-deteriorating growth.
As shown in the Brain MRI results, the proposed method maintains high performance and stability, whereas competing models see their accuracy fluctuate significantly.
In the Liver CT domain, the framework achieved a peak performance of 98.75% for anomaly segmentation. Across all datasets, the method consistently achieved DA scores ≥ 4.0, confirming that adding more data domains consistently led to better or equal performance.
Discussion and Conclusion
Our theoretical and empirical results confirm that matching effectively filters out inter-domain variance while preserving essential intra-domain variability. By recognizing the "modality gap" as a feature and using VACA to shrink angular gaps between modalities, the model more effectively identifies common pathological signals across diverse scan types.
While the iterative refinement of the adaptive centroid and the use of Normalizing Flows introduce some computational overhead, the gains in robustness and zero-shot performance are substantial. Future work will explore the application of this matching framework to other high-stakes heterogeneous environments, such as autonomous driving and financial fraud detection.
Code is available at: https://github.com/AyushRoy2001/Beyond-Pooling
Summary updated