Manuscript Offprint
arXiv:2610.13027Dataset-Specific Encoding of Image Content Underlies Cross-Dataset Failure in Brain MRI Foundation Models
Abstract
Frozen features of brain MRI foundation models lose accuracy on new datasets, a failure usually blamed on the features encoding where each scan came from. We show that the failure lies elsewhere. Across 17 public datasets and eight frozen representations, every representation recognizes the MRI sequence within each dataset, yet most fail on an unseen one. The cause is neither dataset encoding nor a shift of each dataset: the content itself is encoded along different directions in each dataset. This explains which datasets fail, for the sequence and for sex, and why removing the dataset signal with INLP, LEACE, CORAL or adversarial training never improves sequence transfer. Only the broadly pretrained 3DINO and SAM-Med3D encode the sequence consistently enough to transfer; the brain-specific BrainIAC and BrainFM do no better than an untrained network. Code is available at https://github.com/BrainFM/brainfm-profiler/tree/main/representation_utility.
1 Introduction
Public brain MRI datasets support machine learning research on neurological disease but are individually small and narrow. Foundation models for brain MRI are therefore pretrained on pooled collections drawn largely from public datasets [1–3]. Pooling increases sample size but introduces heterogeneity. Dataset bias is well known from natural images [4], and brain MRI adds to it: each public dataset mostly covers one disease, cohort and age range, so dataset identity is confounded with clinical content; sequences differ in contrast; release-specific preprocessing cannot be undone; labels overlap little across datasets; and subjects may recur across releases [5]. Models trained on such pools may learn dataset shortcuts [6, 7] rather than anatomy or pathology.
It is well established that representations retain where a scan came from. The source study or site can be decoded from brain MRI [8, 9], and recent negative controls show that this signal is already present in randomly initialized encoders and in the raw image [10], with the same pattern in EEG and fMRI foundation models [11, 12]. Frozen medical foundation models also lose accuracy on datasets and centres not seen in training, as shown for mammography [13, 14] and pathology [15, 16]. That frozen features fail across datasets is therefore known; why they fail is not. A representation can encode dataset identity and still transfer content, provided the content is encoded in the same way across datasets, so dataset identity alone does not explain the failure. For brain MRI, existing tests also do not cover the setting in which public data are actually pooled. They move between sites of a single study [10] or between scanners imaging the same subjects [17], or they apply simulated artifacts [18]. In the only brain MRI test of pretrained models against an untrained control, pretraining gave no reliable advantage [10], but only models of one architecture family were tested. Removing the site signal after extraction did not help on held-out sites [10], but whether this holds for other removal methods and for independent datasets, and what prevents it from working when the content is clearly encoded, has not been measured.
We address these questions with frozen representations, the way foundation models are commonly used. Transfer is measured by leave-one-dataset-out linear probing on 17 independent public datasets: a linear classifier trained on the frozen features of all datasets but one is evaluated on the held-out dataset. The probe predicts the MRI sequence (T1, T1c, T2 or FLAIR), the only content label available for every scan in all 17 datasets; disease labels barely overlap between datasets and are confounded with dataset identity. Sex, available in ten datasets, serves as a second, anatomical label. Because the sequence is easily recognized within every dataset, a failure to transfer it cannot be blamed on missing information, which lets us study why transfer fails rather than only whether it does. In short, we find that in most representations the difference between sequences is itself different in each dataset: this is not a shift, so centring does not repair it, and it ties the dataset signal to the content, so removing one removes the other. Our contributions are:
-
A diagnosis of cross-dataset failure that also explains why removing the dataset signal does not help. We separate three candidate causes of the failure: encoding of the source dataset, a shift of each dataset, and disagreement of the class directions between datasets. To tell them apart, we combine centring tests with a direction-consistency score adapted from cross-lingual transfer [19, 20]. With these tools we identify the cause for the sequence and for sex, rank representations from the training datasets alone, and explain why four removal methods (INLP, LEACE, CORAL and adversarial training) fail to improve transfer, revising the earlier explanation of this failure on held-out sites [10].
-
A controlled comparison of brain-specific and broadly pretrained foundation models. We compare two brain-specific and two broadly pretrained foundation models against four baseline encoders, with controls for architecture, input scaling, skull stripping and pretraining overlap. We show that broad multi-organ pretraining, not brain-specific pretraining, yields features that transfer across datasets, qualifying the earlier finding that pretraining adds nothing [10].
We release the code, the list of sampled scans and the result tables.
Cross-dataset failure of frozen medical foundation models. Outside brain MRI, several studies show that frozen foundation-model features fail across datasets or centres. Germani et al. [13] use frozen encoders on ten mammography datasets and find that classifiers trained on the aggregated data show dataset-dependent failure modes, with disparities in error, confidence and calibration, and they propose representation-level diagnostics of shortcut risk and evaluate mitigation strategies. Nguyen et al. [14] probe 15 frozen backbones trained on three mammography datasets and tested on twelve others: mammography-specific pretraining does not guarantee robustness, a general-purpose vision model remains competitive, and the better representations keep clinical signal while still reflecting dataset and acquisition structure. In pathology, all ten foundation models tested by de Jong et al. [15] represent the medical centre strongly, and errors follow same-centre confounders; PathoROB [16] extends this to 20 models and 34 centres, and image-level processing does not remove the hospital signatures [21]. These studies establish that the failure occurs, and Germani et al. add diagnostics of shortcut risk at the level of the representation. Our aim is to explain the failure in brain MRI, by measuring whether the directions that separate a content label agree across datasets, by separating a shift of each dataset from a disagreement of directions, and by showing why removing the dataset signal cannot repair the second.
Robustness of brain MRI foundation models. Recent 3D foundation models include brain-specific models such as BrainIAC [2] and BrainFM [3], and broadly pretrained medical models such as 3DINO [22] and SAM-Med3D [23]. Mielcarz et al. [18] apply seven simulated MRI artifacts to five such models and find 3DINO the most stable and BrainIAC the most sensitive, but do not test transfer across real datasets. Navarro-González et al. [17] scan the same 20 subjects on eight scanners and find that encoders supervised with anatomical or age metadata are scanner-robust, whereas self-supervised ones, including BrainIAC, are not. Mouheb et al. [24] compare BrainIAC and 3DINO on African and non-African cohorts and relate performance gaps to dataset size. Avci et al. [25] learn representations that separate anatomy from acquisition by modelling acquisition metadata. Our results agree with the artifact study on real dataset shift, and our controls attribute the difference between models to pretraining rather than to architecture, input scaling or data overlap.
Removing unwanted information from representations. Feature-level harmonization of MRI [26], such as ComBat [27, 28], adjusts features for site effects. In representation learning, iterative nullspace projection (INLP) [29] and LEACE [30] erase a labelled attribute linearly; CORAL [31] aligns second-order statistics between domains; and domain-adversarial training [32], also used to unlearn scanner information in neuroimaging [33], makes a domain classifier fail. FEATMAP [34] corrects acquisition signatures in foundation model embeddings using paired scans of the same subjects. We test whether such methods help when only a dataset label is available, as is the case for public collections.
Predicting transfer from representation geometry. In multilingual language models, the alignment of representations across languages predicts zero-shot cross-lingual transfer [19, 20]. In domain generalization, aligning class-conditional features across source domains is a common training objective, although it is not sufficient for generalization on its own [35], and geometric properties of in-distribution embeddings have been used to predict robustness to corruptions without target labels [36]. We bring the alignment idea to frozen medical encoders as a diagnostic: the agreement of per-dataset sequence directions, computed from class means, and a centring test that separates a shift of each dataset from a disagreement of directions. Leave-one-domain-out evaluation follows standard practice in domain generalization [37], and linear probes on frozen features follow [38].
3 Data and Representations
3.1 Datasets
We use 17 public adult brain MRI datasets that cover tumors, multiple sclerosis, stroke, epilepsy, neurodegeneration and healthy controls (Table 1). They were selected from a survey of public brain MRI datasets [39], keeping those with well-formed NIfTI files and replacing aggregated benchmarks by their original sources. Each dataset contributes at most about 300 structural volumes, sampled patient-wise (all scans of a randomly chosen patient) until the cap is reached, so that no dataset dominates; this yields 4,167 volumes. Ten datasets contain more than one sequence and seven contain only one. A screen of cross-dataset nearest neighbours in four representations, checked against acquisition metadata, found no evidence of subjects shared between datasets; the only matches were among the BraTS25 sub-challenges, which share a processing grid, not subjects.
3.2 Representations
A representation is the feature vector obtained for each volume from a frozen encoder together with its input preprocessing; no model is fine-tuned. We compare eight representations in three groups (Table 2): four baseline encoders, ranging from no learning to CT pretraining, with the three networks implemented in MONAI [61]; two brain-specific foundation models; and two broadly pretrained medical foundation models. The Handcrafted representation is a 26-element vector of intensity percentiles and moments, entropy, gradient and sharpness measures, and the original voxel geometry. The feature choice (class token or pooled map) and intensity scaling for BrainIAC, BrainFM and 3DINO follow Mielcarz et al. [18], within the shared geometry described below; for SAM-Med3D, the image-encoder output is mean-pooled.
Three control representations aid interpretation: the ViT-L of 3DINO with random weights; 3DINO with the shared z-score input instead of its percentile scaling; and MedicalNet with percentile scaling instead of its z-score input.
3.3 Preprocessing
Every volume, regardless of source or encoder, is reoriented to RAS, resampled trilinearly to 2 mm isotropic spacing and centre-cropped or zero-padded to voxels, a 256 mm box that contains a whole head without clipping. Each encoder then receives only the resizing and intensity scaling used in its pretraining, without additional skull stripping or registration (Table 3). The Handcrafted statistics are computed before intensity scaling, so that raw intensity scale remains among their features. BrainIAC and BrainFM were pretrained on skull-stripped, registered scans, whereas 10 of
Five BrainMetShare scans have a header voxel size (0.9375 mm) that disagrees with their affine (1.0 mm); the header value is used.
Table 1: The 17 public brain MRI datasets, grouped by domain. Sampled: number of volumes used in this study.
| Dataset | Sequences | Sampled |
|---|---|---|
| Brain tumor | ||
| BraTS25-MEN [40–42] | T1, T1c, T2, FLAIR | 300 |
| BraTS25-MET [43] | T1, T1c, T2, FLAIR | 300 |
| BraTS25-SSA [44, 45] | T1, T1c, T2, FLAIR | 300 |
| BrainMetShare [46] | T1, T1c, FLAIR | 300 |
| NSK-GBM [47] | T1, T1c, T2, FLAIR | 168 |
| UPENN-GBM [48, 49] | T1, T1c, T2, FLAIR | 300 |
| Multiple sclerosis | ||
| 3D-MR-MS [50] | T1, T1c, T2, FLAIR | 120 |
| MS-60 [51] | T1, T2, FLAIR | 180 |
| MSLesSeg [52] | T1, T2, FLAIR | 300 |
| Stroke | ||
| ISLES22 [53] | FLAIR | 250 |
| Epilepsy | ||
| EPISURG [54] | T1 | 300 |
| Neurodegenerative | ||
| OASIS-1 [55] | T1 | 300 |
| OASIS-2 [56] | T1 | 301 |
| UMF-PD [57] | T1 | 82 |
| Healthy | ||
| BGSP [58] | T1 | 241 |
| IXI [59] | T1, T2, PD | 300 |
| NFBS [60] | T1 | 125 |
| Total | 4,167 | |
the 17 datasets are not skull-stripped; a control in Section 5.4 tests whether this mismatch explains their results.
4 Evaluation Protocol
Each representation is examined with respect to two labels: the source dataset and the imaging sequence (T1, T1c, T2 or FLAIR), which serves as the content label. PD occurs in a single dataset and is excluded. Features are standardized and, where they have more than 100 dimensions, reduced to 100 principal components. All classifiers are -regularized logistic-regression probes with balanced class weights, implemented in scikit-learn [67], and data are split at the patient level, so that scans of one patient never appear in both training and test data.
Decodability. On the pooled corpus, the probe predicts the source dataset (17 classes) and the sequence under five-fold cross-validation repeated three times; here standardization and PCA are fitted once on the whole corpus, a step that uses no labels. The sequence is also predicted within each of the ten multi-sequence datasets (five-fold cross-validation, with standardization and PCA fitted on the training folds). Performance is reported as balanced accuracy and, for the pooled probes, compared against a null of 100 label permutations. Per-scan acquisition properties derived
Table 2: Frozen representations compared in this study. Dim.: feature dimension.
| Representation | Architecture | Pretraining | Dim. |
|---|---|---|---|
| Baseline encoders | |||
| Handcrafted | — | none (image statistics) | 26 |
| Untrained CNN | DenseNet-121 [62] | none (random weights) | 1024 |
| MedicalNet [63] | ResNet-34 [64] | supervised segmentation, MRI and CT | 512 |
| SwinUNETR [65] | Swin | self-supervised, CT [66] | 768 |
| Brain-specific foundation models | |||
| BrainIAC [2] | ViT-B/16 | self-supervised, brain MRI | 768 |
| BrainFM [3] | 3D U-Net | brain MRI with synthetic contrast, resolution and bias-field changes | 2048 |
| Broadly pretrained medical foundation models | |||
| 3DINO [22] | ViT-L/16 | self-distillation, ~100k MRI, CT, PET volumes | 1024 |
| SAM-Med3D [23] | ViT-B/16 | promptable segmentation, ~22k CT, MRI volumes | 384 |
Table 3: Encoder-specific input size and intensity scaling, applied after the shared geometry pipeline.
| Encoder | Input size | Intensity scaling |
|---|---|---|
| Untrained CNN, MedicalNet, SwinUNETR, SAM-Med3D | z-score, non-zero voxels | |
| BrainIAC | z-score, non-zero voxels | |
| 3DINO | 0.05–99.95th percentile to | |
| BrainFM | min-max to | |
| Handcrafted | none |
from the images and headers (template space, bias-field strength, a ghosting and motion index, and, for IXI, the scanner) are probed in the same way.
Cross-dataset transfer. The sequence probe is trained on 16 datasets and evaluated on the held-out one, with standardization and PCA refitted on the training datasets of each split. This succeeds only if the held-out dataset encodes the sequence along the same feature directions as the training datasets. The primary metric is the balanced accuracy averaged over the ten multi-sequence held-out datasets; plain accuracy on the seven single-sequence datasets is reported separately. Representations are compared with a paired two-sided Wilcoxon signed-rank test over held-out datasets.
Neighbourhood structure. Without training a classifier, the ten nearest neighbours of each volume (cosine distance, excluding scans of the same patient) show whether the feature space is organized locally by dataset or by sequence.
Direction consistency. We describe the score for the sequence; for sex it is defined in the same way with the male–female direction. A linear probe trained on several datasets transfers to a new one only if the new dataset separates the sequences along similar directions. We measure this directly, inside each leave-one-dataset-out split and in the same feature space as the probe. For a dataset with sequence set , let be the mean feature vector of sequence , and let
be the dataset's class-balanced centre. The sequence offsets describe how each sequence differs from the rest of its own dataset, independently of where the dataset lies in feature space. The consistency of the held-out dataset with a set of reference datasets is
where are the reference datasets that contain sequence and only multi-sequence datasets are used. With the training datasets, uses the held-out labels and therefore explains transfer to that dataset rather than predicting it. A version that needs no target data, the pool consistency, averages over the training datasets themselves; it characterizes a representation before it is applied to a new dataset. The score is the analogue, for datasets and class means, of the cross-lingual alignment measures that predict zero-shot transfer in multilingual language models [19, 20].
Centring tests. Two centring tests separate a shift of each dataset's features from a disagreement of directions. Label-free centring subtracts each dataset's feature mean, including that of the held-out dataset, before the probe is trained and applied; it can be used at test time. Class-balanced centring subtracts instead, which removes any shift without being affected by the mix of sequences in each dataset, but uses the held-out labels and is therefore an oracle. If transfer failed because each dataset is displaced as a whole, the oracle would recover it; if it failed because directions disagree, neither test would help.
Sex as a second content label. Sex is recorded for 2,186 volumes in ten datasets (Table 1: 3D-MR-MS, ISLES22, IXI, MS-60, MSLesSeg, NSK-GBM, OASIS-1, OASIS-2, UMF-PD and UPENN-GBM). The same leave-one-dataset-out protocol is applied to these ten datasets, with a balanced-class probe for sex. Because several datasets contain more than one sequence, the male–female direction of a dataset is computed inside each sequence with at least three scans per sex and then averaged, so that a different mix of sequences between the sexes does not enter it; consistency is the cosine between this direction and the mean direction of the training datasets, and the centring tests are defined as above.
Post-hoc removal of the dataset signal. Four standard methods are applied unmodified, covering linear erasure, distribution alignment and non-linear adversarial training. INLP [29] repeatedly projects the features onto the nullspace of a linear classifier, first for the per-scan acquisition properties and then for the source dataset; a step is discarded if it lowers sequence decodability by more than five points, a threshold fixed in advance. LEACE [30] removes, in closed form, the linear subspace that predicts the source dataset while changing the features as little as possible (rank 15, one less than the number of training datasets). CORAL [31] aligns rather than erases, recolouring each dataset's features to the mean and covariance of the training datasets; it also uses the unlabelled features of the held-out dataset. The adversarial method [32, 33] trains a small network, through a gradient-reversal layer, to map the features so that a dataset classifier fails. Each method has a control that should not help: a random projection of the same rank (INLP, LEACE), alignment to a wrong dataset (CORAL), and an untrained network of the same shape (adversarial). Methods and controls are fitted on the 16 training datasets of every leave-one-dataset-out split, after which the sequence probe is trained and tested exactly as before, so the values before removal equal those of the transfer evaluation. Dataset and sequence decodability are also measured inside the training datasets before and after removal, to check what each method actually removed. For
Table 4: Properties encoded by each frozen representation. Decodable: balanced accuracy of patient-level cross-validation for the source dataset and the sequence on the pooled corpus (chance 0.06 and 0.25; all outside the permutation null, ), and for the sequence within each multi-sequence dataset (mean over ten datasets). Across datasets: leave-one-dataset-out sequence prediction, as balanced accuracy averaged over the ten multi-sequence held-out datasets and as accuracy averaged over the seven single-sequence datasets.
| Group | Representation | Decodable | Across datasets | |||
|---|---|---|---|---|---|---|
| Dataset | Sequence | Seq. within | 10 multi-seq. | 7 single-seq. | ||
| Baseline encoders | Handcrafted | 0.92 | 0.72 | 0.85 | 0.44 | 0.46 |
| Untrained CNN | 0.94 | 0.88 | 0.93 | 0.49 | 0.73 | |
| MedicalNet | 0.94 | 0.87 | 0.89 | 0.44 | 0.58 | |
| SwinUNETR | 0.91 | 0.83 | 0.91 | 0.47 | 0.67 | |
| Brain-specific FMs | BrainIAC | 0.84 | 0.76 | 0.84 | 0.50 | 0.53 |
| BrainFM | 0.93 | 0.89 | 0.93 | 0.55 | 0.75 | |
| Broad medical FMs | 3DINO | 0.95 | 0.95 | 0.97 | 0.72 | 0.97 |
| SAM-Med3D | 0.94 | 0.92 | 0.93 | 0.69 | 0.85 | |
| Controls | 3DINO, random weights | 0.79 | 0.76 | 0.86 | 0.50 | 0.67 |
| 3DINO, z-score input | 0.94 | 0.92 | 0.94 | 0.62 | 0.78 | |
| MedicalNet, percentile input | 0.94 | 0.90 | 0.93 | 0.60 | 0.67 | |
sex, LEACE and CORAL with their controls are applied in the same way; INLP and the adversarial network are not, because their stopping rule and training objective here are built to retain the sequence.
Predicting failure without target labels. A user deploying a frozen encoder on a new dataset usually has no labels for it. We therefore compute consistency from the unlabelled held-out features: they are clustered with -means, with the number of sequences in the dataset (known from file names in practice), and the cluster offsets are matched to the training sequence offsets by maximizing the summed cosine (Hungarian algorithm); the score is the mean matched cosine. It is compared with two standard label-free estimators of accuracy under distribution shift: the average maximum softmax probability of the probe [68], and average thresholded confidence (ATC) [69], whose threshold is set by patient-grouped cross-validation on the training datasets. Each score is evaluated by its Spearman correlation with the measured transfer across the held-out datasets of one representation, the question a user faces, and averaged over representations.
5 Results
5.1 The sequence is encoded within every dataset but lost across datasets
Within a single dataset, every representation distinguishes the sequences reliably (0.84–0.97, Table 4), and the sequence is also decodable on the pooled corpus (0.72–0.95), where the probe sees every dataset during training. Yet a probe trained on 16 datasets largely fails on the seventeenth (Figure 1). For the baseline encoders and both brain-specific models, balanced accuracy falls to 0.44–0.55. The two broadly pretrained models, 3DINO and SAM-Med3D, keep more (0.72 and 0.69), but still lose 0.24–0.25 of their within-dataset accuracy, too much for a sequence classifier to be reliable on a new dataset without adaptation. Sex fails in the same way: across datasets, every representation stays between 0.51 and 0.69 balanced accuracy against a chance level of 0.50 (Table 5).

Figure 1: Leave-one-dataset-out transfer of the imaging sequence. Balanced accuracy on each of the ten held-out datasets with more than one sequence (dots) and their mean (bar and number). Grey: baseline encoders; orange: brain-specific foundation models; blue: broadly pretrained medical foundation models; hatched: controls.
5.2 Why transfer fails
Since the sequence is present in every dataset, the failure is not missing information. We test three explanations in turn: the features encode the source dataset, each dataset is shifted as a whole, or the directions that separate the classes differ between datasets. We then apply the same tests to sex.
5.2.1 Encoding the source dataset does not explain the failure
Every representation identifies the source dataset with a balanced accuracy of 0.84–0.95, against a chance level of 0.06 (Table 4; all ). Most of this signal requires no learning: the Untrained CNN matches MedicalNet (both 0.94), and the Handcrafted statistics reach 0.92. The randomly initialized ViT-L is the exception, reaching 0.79 before and 0.95 after 3DINO pretraining. Per-scan acquisition properties (template space, bias field, ghosting and motion, and IXI scanner) are likewise decodable (0.85–1.00, chance 0.25–0.33). This agrees with earlier reports that the source study can be recovered from brain MRI [8, 9] and from natural images [4], even with randomly initialized features [10].
Encoding the source dataset, however, does not go together with poor transfer (Figure 2). 3DINO separates the source datasets best and also transfers the sequence best; the baseline encoders separate datasets almost as well but transfer far worse; and the random-weight ViT-L separates datasets least yet transfers poorly. Both kinds of information can coexist in the same features, in line with observations in mammography [14], so dataset decodability is not the explanation.
The neighbourhood structure reflects the same difference. This comparison of same-dataset and same-sequence neighbours follows the robustness index of PathoROB [16], which compares same-centre and same-biology neighbours in pathology. Averaged over the ten multi-sequence datasets,

Figure 2: Source-dataset decodability (balanced accuracy, 17 classes) against cross-dataset sequence transfer (leave-one-dataset-out balanced accuracy on the ten multi-sequence held-out datasets). Grey: baseline encoders; orange: brain-specific foundation models; blue: broadly pretrained medical foundation models; open circle: 3DINO with random weights.
most representations have more neighbours from the same dataset than with the same sequence (e.g. MedicalNet 0.86 against 0.77, BrainFM 0.88 against 0.77); locally, they are organized primarily by dataset. 3DINO is the only representation in which the same sequence is at least as common as the same dataset (0.89 against 0.87), despite separating datasets best.
5.2.2 The failure is not a shift of each dataset
If each dataset were displaced as a whole in feature space, removing each dataset's mean would recover transfer. It does not (Figure 3b). Neither centring test changes sequence transfer significantly for any representation ( ); most representations lose slightly, and 3DINO gains 0.06 without reaching significance. Label-free and class-balanced centring agree to within 0.01, so the different mix of sequences in each dataset is not the cause either.
5.2.3 The failure is a disagreement of sequence directions
Direction consistency tracks transfer. Across all representations and held-out datasets, a held-out dataset whose sequence offsets agree with those of the training datasets is one to which the sequence transfers (Spearman , , ; Figure 3a). The relation also holds within representations, positive for 10 of 11 with a mean of 0.57, so it identifies which datasets a given representation fails on and is not only a difference between representations. The baseline encoders have the least consistent directions (0.11–0.21), BrainFM reaches 0.30, and 3DINO and SAM-Med3D reach 0.45 and 0.48; BrainIAC (0.46) is discussed below. The input-scaling controls move consistency and transfer together: percentile scaling raises MedicalNet's consistency from 0.21 to 0.37, and z-score input lowers 3DINO's from 0.45 to 0.34.
Because this score uses the held-out labels, part of this relation is expected by construction. Two versions without them show it is more than that. Measured on the training datasets alone, the pool consistency ranks the 11 representations and controls by their transfer to unseen datasets.
(a)

(b)
Figure 3: Sequence-direction consistency and transfer. (a) Consistency of each held-out multi-sequence dataset with the training datasets against transfer to that dataset, for every representation (filled) and control (open). (b) Mean transfer before and after centring each dataset's features, label-free (squares) or class-balanced using the held-out labels (oracle, diamonds). Grey: baseline encoders; orange: brain-specific foundation models; blue: broadly pretrained medical foundation models.
, without any data from the target. Computed from clusters of the unlabelled held-out dataset, it ranks the held-out datasets of a representation by transfer with a mean of 0.37, better than average confidence in 10 of 11 representations and than ATC in all 11, which barely track transfer within a representation ( and 0.01; Appendix Table 8). It works best where the sequences form clear clusters, as for 3DINO and SAM-Med3D ( and 0.92), whereas confidence remains the better way to compare whole representations ( against 0.11).
Consistency is a necessary rather than a sufficient condition: BrainIAC (0.46) and 3DINO with random weights (0.44) have consistent directions yet transfer poorly. Both also have among the lowest within-dataset sequence accuracies (0.84 and 0.86, Table 4): their sequence offsets point the same way across datasets but are small relative to the spread within each sequence.
5.2.4 Sex: directions disagree, and part of the failure is a shift
Direction consistency again explains which held-out datasets fail, more weakly than for the sequence (Spearman , , ; positive within 10 of 11 representations, mean ), and the mean consistency of a representation tracks its mean transfer ( , , ). The pool consistency, computed without the target, points the same way but is not significant here ( , ).
Unlike for the sequence, centring helps in part. Label-free centring raises the sex transfer of the Handcrafted statistics from 0.51 to 0.61 (p = 0.004) and moves MedicalNet and BrainFM up by 0.03–0.06 without reaching significance, whereas it changes the broadly pretrained models by at most 0.02 (Table 5). For these representations part of the failure is therefore a shift of each dataset as a whole, which the centring test separates from a disagreement of directions.
Table 5: Sex as a second content label. Leave-one-dataset-out balanced accuracy averaged over the ten held-out datasets with sex labels; consistency of the held-out male–female direction with the training datasets. Control in brackets: a random projection of the same rank (LEACE) or alignment to a wrong dataset (CORAL). *: differs from before, , paired Wilcoxon test.
| Representation | Consistency | Before | Centring | LEACE | CORAL |
|---|---|---|---|---|---|
| Handcrafted | 0.34 | 0.51 | 0.61* | 0.52 (0.51) | 0.65* (0.52) |
| Untrained CNN | 0.65 | 0.64 | 0.64 | 0.63 (0.65) | 0.70 (0.59) |
| MedicalNet | 0.49 | 0.65 | 0.70 | 0.62* (0.62) | 0.67 (0.58) |
| SwinUNETR | -0.05 | 0.60 | 0.60 | 0.60 (0.60) | 0.63 (0.60) |
| BrainIAC | 0.13 | 0.54 | 0.54 | 0.54 (0.55) | 0.53 (0.53) |
| BrainFM | 0.40 | 0.65 | 0.68 | 0.65 (0.64) | 0.69 (0.57) |
| 3DINO | 0.43 | 0.65 | 0.67 | 0.65 (0.63) | 0.65 (0.58) |
| SAM-Med3D | 0.60 | 0.69 | 0.69 | 0.68 (0.66) | 0.68 (0.61) |
5.3 Why removing the dataset signal does not help
The removal methods succeed at what they are designed to do. For the seven network representations, LEACE lowers dataset decodability inside the training datasets from 0.84–0.95 to 0.03–0.26 and CORAL to at most 0.11, while INLP (0.67–0.91) and the adversarial network (0.72–0.90) remove less (Appendix Table 7). Yet none of the 32 method–representation combinations improves sequence transfer significantly (Table 6); almost all lower it, and seven do so significantly, mostly after LEACE and the adversarial network. The single-sequence datasets show the same pattern, with every method lowering accuracy for every network representation. Removing the dataset directions is also no better than removing random ones: for no network representation do INLP or LEACE significantly beat their random-projection controls, and CORAL, although better than aligning to a wrong dataset, still lowers transfer. This extends the observation that INLP and ComBat bring no significant gain on held-out sites of one study [10] to independent datasets, two further methods, matched controls for each method and eight representations. It also rules out the explanation offered there, that the encoder output carried too little clinical information to begin with: here the sequence is strongly encoded, and removal still fails.
The reason is that the dataset and the sequence are not stored separately. When the difference between sequences is itself different in each dataset, the directions that tell datasets apart include these per-dataset sequence differences. Removing the dataset signal therefore also removes sequence information: inside the training datasets, sequence decodability falls by 0.14–0.24 after LEACE and by 0.26–0.28 after CORAL for every network representation. This loss is specific to the dataset directions: removing 15 random directions, the LEACE control, costs only 0.01–0.05, and the difference holds for every representation (p < 0.001, paired over the 17 splits; Appendix Table 7). Alignment fails for the reason found in the centring tests: matching the first two moments of each dataset cannot rotate inconsistent sequence directions into agreement. 3DINO is a partial exception: there, INLP removes 16 directions on average, against 3–9 for the other representations, lowering dataset decodability from 0.95 to 0.67 while sequence decodability falls only from 0.95 to 0.90. The features that encode the sequence most consistently are thus also those in which the dataset signal is most separable from it. After any correction, no representation other than 3DINO and SAM-Med3D exceeds 0.57, whereas the uncorrected 3DINO features reach 0.72: how consistently the sequence is encoded is set when the features are learned.
For sex, where part of the failure is a shift (Section 5.2.4), alignment can help. CORAL, which includes the per-dataset centring, raises the Handcrafted statistics from 0.51 to 0.65 (),
Table 6: Sequence transfer before and after removing the dataset signal. Leave-one-dataset-out balanced accuracy averaged over the ten multi-sequence held-out datasets; methods fitted on the training datasets of each split. Control in brackets: a random projection of the same rank (INLP, LEACE), alignment to a wrong dataset (CORAL), an untrained network of the same shape (adversarial). *: after differs from before, , paired Wilcoxon test over the ten datasets.
| Representation | Before | INLP | LEACE | CORAL | Adversarial |
|---|---|---|---|---|---|
| Handcrafted | 0.44 | 0.41 (0.44) | 0.42 (0.40) | 0.37 (0.27) | 0.42 (0.43) |
| Untrained CNN | 0.49 | 0.48 (0.47) | 0.41* (0.44) | 0.42 (0.28) | 0.45 (0.44) |
| MedicalNet | 0.44 | 0.44 (0.44) | 0.43 (0.42) | 0.42 (0.27) | 0.40 (0.45) |
| SwinUNETR | 0.47 | 0.41* (0.45) | 0.44 (0.40) | 0.45 (0.30) | 0.36 (0.41) |
| BrainIAC | 0.50 | 0.48 (0.50) | 0.44* (0.48) | 0.43 (0.25) | 0.40* (0.45) |
| BrainFM | 0.55 | 0.57 (0.55) | 0.54 (0.53) | 0.48 (0.33) | 0.50 (0.51) |
| 3DINO | 0.72 | 0.72 (0.73) | 0.70 (0.73) | 0.66 (0.32) | 0.51* (0.69) |
| SAM-Med3D | 0.69 | 0.67 (0.68) | 0.63 (0.64) | 0.57* (0.31) | 0.54* (0.56) |
while LEACE never helps and lowers MedicalNet (; Table 5). Alignment thus helps where the failure is a shift but not where directions disagree, and the centring test tells the two apart.
5.4 Which representations encode the sequence consistently
The two broadly pretrained models are the only ones with sequence directions consistent enough to transfer. 3DINO and SAM-Med3D exceed the Untrained CNN, which reflects the architecture alone, on every one of the ten held-out datasets (+0.23 and +0.20, each), so the gain is not driven by a few favourable datasets. Pretraining on brain MRI does not have this effect: BrainIAC and BrainFM do not transfer significantly better than the Untrained CNN (+0.01, ; +0.06, ), so matching the pretraining domain to the target anatomy is not sufficient. Because two different objectives, self-distillation and promptable segmentation, reach a similar level (), the breadth of the pretraining data likely matters more than the objective. The gain is specific to the sequence: for sex, 3DINO transfers no better than the other network representations (0.65, against 0.54–0.65) and SAM-Med3D only slightly better (0.69). Broad pretraining appears to align strong, global properties such as contrast across datasets, but not necessarily subtle anatomical ones.
These results refine two earlier observations. Rahbar [10] found no reliable advantage of brain-pretrained or CT-pretrained SwinUNETR encoders over an untrained copy; our CT-pretrained SwinUNETR likewise does not beat the Untrained CNN, so pretraining as such is not enough, but broad pretraining is. Mielcarz et al. [18] found 3DINO the most stable, BrainFM intermediate and BrainIAC the most sensitive under simulated artifacts; the three models fall in the same order here under real shift between independent datasets.
Controls. Four controls rule out simpler explanations for these differences. First, the gain is not due to the architecture: the ViT-L of 3DINO with random weights reaches only 0.50, like the baseline encoders and significantly below the pretrained model (), so the consistency is acquired during pretraining. Second, input normalization explains part of the gain but not all of it. Replacing 3DINO's percentile scaling with the shared -score input lowers its transfer to 0.62 (), and giving MedicalNet percentile scaling raises it from 0.44 to 0.60 (); yet 3DINO with -score input remains above the Untrained CNN (+0.14, ), and MedicalNet with percentile input remains below both broadly pretrained models ( ). Third, the brain-specific models do not fail merely because half of the held-out datasets retain the skull: on the five skull-stripped multi-sequence datasets, where the input matches their pretraining, BrainIAC and BrainFM reach 0.55 and 0.64, against 0.81 for 3DINO and 0.75 for SAM-Med3D. Finally, the advantage is not an artifact of pretraining overlap. UPENN-GBM, OASIS-1 and OASIS-2 may be part of the pretraining data of 3DINO or SAM-Med3D; excluding UPENN-GBM, the only one of the three with more than one sequence, leaves both above the Untrained CNN (+0.25 and +0.20, p = 0.004 each, n = 9).
6 Discussion
Why frozen features fail across datasets. Every representation tested identifies the source dataset and recognizes the sequence within each dataset, yet neither predicts transfer. The failure is not missing information, dataset encoding or a shift of each dataset; the directions that separate the classes differ between datasets. Dataset decodability and within-dataset or pooled accuracy are therefore poor guides to whether a representation is fit for pooling, and consistency must be measured on held-out datasets. The same account explains why removal fails: the directions that tell datasets apart include the per-dataset sequence differences, so erasing or aligning the dataset signal removes content too. This agrees with the observation that removing a site subspace can harm segmentation because site and anatomy share directions [10]. Correction has succeeded where paired scans of the same subjects are available [34], but public datasets are independent populations with only a dataset label; there, adapting the encoder with labelled target data remains the practical option.
Direction consistency as a diagnostic. Direction consistency is computed from class means alone and supports three practical checks. Before deployment, the pool consistency of the training datasets indicates which representation will transfer, significantly for the sequence and in the same direction for sex. On a new unlabelled dataset, cluster consistency warns which datasets a chosen encoder will fail on, a task on which standard confidence-based estimators [68, 69] fail under this kind of shift. And the centring test, run on labelled datasets, shows whether aligning datasets afterwards is worth trying at all. If a few target labels are available, the probe's accuracy on them is the more direct check. Consistency is necessary rather than sufficient, since the class offsets must also be large relative to the spread within each class, and the label-free variant is modest in absolute terms; a score that combines direction and separation is a natural next step.
Which features transfer: breadth of pretraining, not domain match. The two models pretrained on broad multi-organ CT and MRI collections encode the sequence consistently; the two brain-specific models, pretrained on the target anatomy, do not do significantly better than a network with random weights. The controls attribute the advantage to pretraining rather than to architecture, input scaling, skull stripping or data overlap. A plausible reading is that exposure to many scanners and protocols forces contrast to be encoded in shared terms, whereas a narrower brain-only corpus does not, although with two models per group this remains a hypothesis. It is consistent with the finding in mammography that domain-specific pretraining does not guarantee robustness to dataset shift [14], with the robustness of 3DINO to simulated artifacts [18] and with the poor cross-scanner reliability of BrainIAC [17], and it shows that the absence of a pretraining advantage reported for SwinUNETR encoders [10] does not hold for every model. Encoders supervised with acquisition or anatomical metadata [17, 25] are a natural next comparison. The advantage was small for sex, a subtler property: only SAM-Med3D was slightly ahead.
Limitations. The sequence is the only content label shared by all 17 datasets; it is a global, comparatively easy property. Sex extends the analysis to an anatomical label, but in ten datasets only, with weaker effects, and with LEACE and CORAL as the only removal methods. The label-free failure prediction assumes that the number of sequences in a new dataset is known and reaches only a moderate correlation. Transfer is measured with linear probes on frozen features; non-linear probes or fine-tuning may behave differently. The paired tests use ten multi-sequence held-out datasets, which limits statistical power; the pooled consistency correlation counts each dataset once per representation and is therefore not a test on independent samples, and the ranking of representations by pool consistency rests on 11 points. Each encoder receives the input scaling of its own pretraining, so part of the differences between models may reflect preprocessing, although the scaling controls bound this effect. The removal methods were applied with standard settings and a dataset label only; methods that use paired data or richer supervision were outside the scope. Finally, pretraining data of the foundation models are not fully documented, so the overlap control can only exclude datasets known or likely to be included.
7 Conclusion
Across 17 public brain MRI datasets, frozen features fail on new datasets not because the content is missing, nor because they encode the source dataset or because each dataset is shifted, but because the directions that separate the classes differ between datasets. This direction consistency tracks transfer for the sequence and for sex, ranks representations from the training datasets alone and, computed on an unlabelled new dataset, warns of failure better than confidence-based estimators. The same account explains why four standard methods for removing the dataset signal erased it without improving sequence transfer, and why alignment helped only where a centring test showed that the failure was a shift. Only two broadly pretrained medical foundation models encoded the sequence consistently enough to transfer; brain-specific pretraining did not. For anyone pooling public data, consistency across datasets should be treated as a property of how features are learned and verified on held-out datasets, not something to be corrected afterwards.
Code and Data Availability
Code, the list of sampled scans and the result tables are available at https://github.com/BrainFM/brainfm-profiler/tree/main/representation_utility. All 17 datasets are public and can be obtained from their original sources under their own licences. Because several of these licences do not permit redistribution of the data or of material derived from it, we do not redistribute the images or the extracted embeddings; the embeddings can be regenerated with the released code from the listed scans.
References
[1] Asbjørn Munk, Stefano Cerri, Jakob Ambsdorf, et al. A large-scale heterogeneous 3D magnetic resonance brain imaging dataset for self-supervised learning, June 2025. URL http://arxiv.org/abs/2506.14432. arXiv:2506.14432 [eess].
[2] Divyanshu Tak, Biniam A. Garomsa, Anna Zapaishchykova, et al. A generalizable foundation model for analysis of human brain MRI. Nature Neuroscience, 29(4):945–956, 2026. doi:10.1038/s41593-026-02202-6.
[3] Peirong Liu, Oula Puonti, Xiaoling Hu, Karthik Gopinath, Annabel Sorby-Adams, Daniel C. Alexander, W. Taylor Kimberly, and Juan E. Iglesias. A Modality-agnostic Multi-task Foundation Model for Human Brain Imaging, 2025. URL https://arxiv.org/abs/2509.00549. arXiv:2509.00549 [cs.CV].
[4] Antonio Torralba and Alexei A. Efros. Unbiased look at dataset bias. In 2011 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1521–1528. IEEE, 2011. doi:10.1109/CVPR.2011.5995347. URL https://doi.org/10.1109/CVPR.2011.5995347.
[5] Amelia Jiménez-Sánchez, Natalia-Rozalia Avlona, Dovile Juodelyte, Théo Sourget, Caroline Vang-Larsen, Anna Rogers, Hubert Dariusz Zajac, and Veronika Cheplygina. Copycats: the many lives of a publicly available medical imaging dataset. In Advances in Neural Information Processing Systems (Datasets and Benchmarks Track), 2024. URL https://arxiv.org/abs/2402.06353.
[6] Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A. Wichmann. Shortcut learning in deep neural networks. Nature Machine Intelligence, 2(11):665–673, 2020. doi: 10.1038/s42256-020-00257-z. URL https://doi.org/10.1038/s42256-020-00257-z.
[7] John R. Zech, Marcus A. Badgeley, Manway Liu, Anthony B. Costa, Joseph J. Titano, and Eric Karl Oermann. Variable generalization performance of a deep learning model to detect pneumonia in chest radiographs: a cross-sectional study. PLOS Medicine, 15(11):e1002683, 2018. doi: 10.1371/journal.pmed.1002683.
[8] Christian Wachinger, Anna Rieckmann, and Sebastian Pölsterl. Detect and correct bias in multi-site neuroimaging datasets. Medical Image Analysis, 67:101879, 2021. doi: 10.1016/j.media.2020.101879.
[9] Ben Glocker, Robert Robinson, Daniel C. Castro, Qi Dou, and Ender Konukoglu. Machine Learning with Multi-Site Imaging Data: An Empirical Study on the Impact of Scanner Effects, 2019. URL https://arxiv.org/abs/1910.04597. arXiv:1910.04597 [eess.IV]. Presented at Medical Imaging meets NeurIPS 2019.
[10] Saman Rahbar. Site is decodable before pretraining: Negative controls for probing frozen Brain-MRI foundation models, 2026. URL https://arxiv.org/abs/2608.10295. arXiv:2608.10295v2 [cs.CV].
[11] Marzieh Zare. A negative-control protocol for clinical EEG foundation-model benchmarks: Dataset identity and external-cohort stress testing, 2026. URL https://arxiv.org/abs/2607.24519. arXiv:2607.24519 [cs.LG].
[12] Ye Tao, Bradley T. Baker, Yu Wu, Anand D. Sarwate, Sandeep Panta, Sergey Plis, and Vince D. Calhoun. Batch effects in brain foundation model embeddings, 2026. URL https://arxiv.org/abs/2604.14441. arXiv:2604.14441 [eess.SP].
[13] Elodie Germani, Fatima Zeineddine, Charbel Mourad, and Shadi Albarqouni. When multi-institutional dataset aggregation masks shortcut-like behavior in foundation models for medical imaging. Medical Image Analysis, page 104258, 2026. doi: 10.1016/j.media.2026.104258.
[14] Giang Nguyen, Raghav Mehta, Emma A. M. Stanley, Tian Xia, Thi Hao Nguyen, Hieu Pham, and Ben Glocker. Benchmarking the robustness of foundation models for mammography under domain shift, 2026. URL https://arxiv.org/abs/2607.10358. arXiv:2607.10358 [cs.CV].
[15] Edwin D. de Jong, Eric Marcus, and Jonas Teuwen. Current pathology foundation models are unrobust to medical center differences, 2025. URL https://arxiv.org/abs/2501.18055. arXiv:2501.18055 [cs.CV].
[16] Jonah Kömen, Edwin D. de Jong, Julius Hense, Hannah Marienwald, Jonas Dippel, Philip Naumann, Eric Marcus, Lukas Ruff, Maximilian Alber, Jonas Teuwen, Frederick Klauschen, and Klaus-Robert Müller. Towards robust foundation models for digital pathology, 2025. URL https://arxiv.org/abs/2507.17845. arXiv:2507.17845 [cs.CV].
[17] Rafael Navarro-González, Santiago Aja-Fernández, Álvaro Planchuelo-Gómez, and Rodrigo de Luis-García. Cross-Scanner Reliability of Brain MRI Foundation Model Embeddings: A Travelling-Heads Study, 2026. URL https://www.medrxiv.org/content/10.64898/2026.03.23.26348808v2. Preprint.
[18] Julia Anna Mielcarz, Daniel Klaaby, and Mostafa Mehdipour Ghazi. Do 3D Medical Foundation Models See Through MRI Artifacts? A Controlled Study of Representation Robustness, 2026. URL https://arxiv.org/abs/2608.06613. arXiv:2608.06613 [cs.CV]. ECCV 2026 Workshop on Artificial Intelligence for Medical 3D Vision.
[19] Benjamin Muller, Yanai Elazar, Benoît Sagot, and Djamé Seddah. First align, then predict: Understanding the cross-lingual ability of multilingual BERT. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics (EACL), pages 2214–2231, 2021. URL https://aclanthology.org/2021.eacl-main.189.
[20] Ameet Deshpande, Partha Talukdar, and Karthik Narasimhan. When is BERT multilingual? isolating crucial ingredients for cross-lingual transfer. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL), pages 3610–3623, 2022. URL https://aclanthology.org/2022.naacl-main.264.
[21] Jonah Kömen, Hannah Marienwald, Jonas Dippel, and Julius Hense. Do histopathological foundation models eliminate batch effects? A comparative study, 2024. URL https://arxiv.org/abs/2411.05489. arXiv:2411.05489 [cs.CV]. AIM-FM Workshop at NeurIPS 2024.
[22] Tony Xu, Sepehr Hosseini, Chris Anderson, Anthony Rinaldi, Rahul G. Krishnan, Anne L. Martel, and Maged Goubran. A generalizable 3D framework and model for self-supervised learning in medical imaging. npj Digital Medicine, 8:639, 2025. doi: 10.1038/s41746-025-02035-w.
[23] Haoyu Wang, Sizheng Guo, Jin Ye, et al. SAM-Med3D: Towards General-Purpose Segmentation Models for Volumetric Medical Images. In Computer Vision – ECCV 2024 Workshops, Lecture Notes in Computer Science, pages 51–67. Springer, 2025. doi: 10.1007/978-3-031-91721-9_4.
[24] Kaouther Mouheb, Gonzalo Esteban Mosquera Rojas, Juancito van Leeuwen, Stefan Klein, and Esther E. Bron. Do medical foundation models generalize on the African brain?, 2026. URL https://arxiv.org/abs/2607.28771. arXiv:2607.28771 [cs.CV].
[25] Mehmet Yigit Avci, Pedro Borges, Virginia Fernandez, Natalia Glazman, Paul Wright, Mehmet Yigitsoy, Sebastien Ourselin, and Jorge Cardoso. Metadata supervised imaging representations for modelling and controlling acquisition variability, 2026. URL https://arxiv.org/abs/2607.11295. arXiv:2607.11295 [cs.CV].
[26] Qinqin Yang, Firoozeh Shomal-Zadeh, and Ali Gholipour. Harmonization in Magnetic Resonance Imaging: A Survey of Acquisition, Image-level, and Feature-level Methods, 2025. URL https://arxiv.org/abs/2507.16962. arXiv:2507.16962 [eess.IV]. Published in Medical Image Analysis (2026).
[27] W. Evan Johnson, Cheng Li, and Ariel Rabinovic. Adjusting batch effects in microarray expression data using empirical Bayes methods. Biostatistics, 8(1):118–127, 2007. doi: 10.1093/biostatistics/kxj037.
[28] Jean-Philippe Fortin, Nicholas Cullen, Yvette I. Sheline, et al. Harmonization of cortical thickness measurements across scanners and sites. NeuroImage, 167:104–120, 2018. doi: 10.1016/j.neuroimage.2017.11.024.
[29] Shauli Ravfogel, Yanai Elazar, Hila Gonen, Michael Twiton, and Yoav Goldberg. Null It Out: Guarding Protected Attributes by Iterative Nullspace Projection. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7237–7256. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.647. URL https://aclanthology.org/2020.acl-main.647/.
[30] Nora Belrose, David Schneider-Joseph, Shauli Ravfogel, Ryan Cotterell, Edward Raff, and Stella Biderman. LEACE: Perfect linear concept erasure in closed form. In Advances in Neural Information Processing Systems 36 (NeurIPS 2023), 2023. doi: 10.48550/arXiv.2306.03819. URL https://arxiv.org/abs/2306.03819.
[31] Baochen Sun and Kate Saenko. Deep CORAL: Correlation Alignment for Deep Domain Adaptation. In Computer Vision – ECCV 2016 Workshops, pages 443–450. Springer, 2016. doi:10.1007/978-3-319-49409-8_35. URL https://doi.org/10.1007/978-3-319-49409-8_35.
[32] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-Adversarial Training of Neural Networks. Journal of Machine Learning Research, 17(59):1–35, 2016. URL https://jmlr.org/papers/v17/15-239.html.
[33] Nicola K. Dinsdale, Mark Jenkinson, and Ana I. L. Namburete. Deep learning-based unlearning of dataset bias for MRI harmonisation and confound removal. NeuroImage, 228:117689, 2021. doi: 10.1016/j.neuroimage.2020.117689. URL https://www.sciencedirect.com/science/article/pii/S1053811920311745.
[34] Leonhard Donle, Michael Phillips, Farieda Gaber, et al. FEATMAP: Targeted Correction of Acquisition Signatures Harmonizes Medical Foundation Model Embeddings and Enables Robust Task Generalization, 2026. URL https://www.biorxiv.org/content/10.64898/2026.07.02.736184v1. Preprint.
[35] Divyat Mahajan, Shruti Tople, and Amit Sharma. Domain generalization using causal matching. In Proceedings of the 38th International Conference on Machine Learning (ICML), volume 139 of Proceedings of Machine Learning Research, pages 7313–7324, 2021.
[36] Ali Zia and Farid Hazratian. Representation geometry as a diagnostic for out-of-distribution robustness, 2026. URL https://arxiv.org/abs/2602.03951. arXiv:2602.03951 [cs.LG].
[37] Ishaan Gulrajani and David Lopez-Paz. In search of lost domain generalization. In International Conference on Learning Representations (ICLR), 2021. URL https://openreview.net/forum?id=lQdXeXDoWtI.
[38] Guillaume Alain and Yoshua Bengio. Understanding intermediate layers using linear classifier probes. In International Conference on Learning Representations (ICLR), Workshop Track, 2017. URL https://arxiv.org/abs/1610.01644.
[39] Minh Sao Khue Luu, Margaret V. Benedichuk, Ekaterina I. Roppert, Roman M. Kenzhin, and Bair N. Tuchinov. A structured review and quantitative profiling of public brain MRI datasets for foundation model development. Journal of Imaging, 11(12):454, 2025. ISSN 2313-433X. doi: 10.3390/jimaging11120454. URL https://www.mdpi.com/2313-433X/11/12/454.
[40] Dominic LaBella, Maruf Adewole, Michelle Alonso-Basanta, et al. The ASNR-MICCAI Brain Tumor Segmentation (BraTS) Challenge 2023: Intracranial Meningioma, 2023. URL https://arxiv.org/abs/2305.07642.
[41] Dominic LaBella, Ujjwal Baid, Omaditya Khanna, et al. Analysis of the BraTS 2023 Intracranial Meningioma Segmentation Challenge, 2024. URL https://arxiv.org/abs/2405.09787.
[42] Dominic LaBella, Omaditya Khanna, Shan McBurney-Lin, et al. A multi-institutional meningioma MRI dataset for automated multi-sequence image segmentation. Scientific Data, 11(1):496, May 2024. ISSN 2052-4463. doi: 10.1038/s41597-024-03350-9. URL https://www.nature.com/articles/s41597-024-03350-9.
[43] Nazanin Maleki, Raisa Amiruddin, Ahmed W. Moawad, et al. Analysis of the MICCAI Brain Tumor Segmentation – Metastases (BraTS-METS) 2025 Lighthouse Challenge: Brain Metastasis Segmentation on Pre- and Post-treatment MRI, 2025. URL https://arxiv.org/abs/2504.12527.
[44] Maruf Adewole, Jeffrey D. Rudie, Anu Gbadamosi, et al. The Brain Tumor Segmentation (BraTS) Challenge 2023: Glioma Segmentation in Sub-Saharan Africa Patient Population (BraTS-Africa), 2023. URL https://arxiv.org/abs/2305.19369.
[45] Maruf Adewole, Jeffrey D. Rudie, Anu Gbadamosi, et al. The BraTS-Africa Dataset: Expanding the Brain Tumor Segmentation (BraTS) Data to Capture African Populations. Radiology: Artificial Intelligence, page e240528, April 2025. ISSN 2638-6100. doi: 10.1148/ryai.240528. URL http://pubs.rsna.org/doi/10.1148/ryai.240528.
[46] Endre Grøvik, Darvin Yi, Michael Iv, Elisabeth Tong, Daniel L. Rubin, and Greg Zaharchuk. BrainMetShare, 2020. URL https://aimi.stanford.edu/datasets/brainmetshare.
[47] Elena Filimonova, Augusto Leone, Francesco Carbone, et al. Glioblastoma MRI Dataset with Standardized Preprocessing, Expert-Validated Segmentation, and MGMT Profiling. Scientific Data, 13(1):1213, 2026. ISSN 2052-4463. doi: 10.1038/s41597-026-07953-2. URL https://www.nature.com/articles/s41597-026-07953-2. Data: OpenNeuro ds007045, https://doi.org/10.18112/openneuro.ds007045.v1.0.1.
[48] Spyridon Bakas, Chiharu Sako, Hamed Akbari, et al. Multi-parametric magnetic resonance imaging (mpMRI) scans for de novo Glioblastoma (GBM) patients from the University of Pennsylvania Health System (UPENN-GBM), 2021. URL https://www.cancerimagingarchive.net/collection/upenn-gbm/.
[49] Spyridon Bakas, Chiharu Sako, Hamed Akbari, et al. The University of Pennsylvania glioblastoma (UPenn-GBM) cohort: advanced MRI, clinical, genomics, & radiomics. Scientific Data, 9(1):453, July 2022. ISSN 2052-4463. doi: 10.1038/s41597-022-01560-7. URL https://www.nature.com/articles/s41597-022-01560-7.
[50] Žiga Lesjak, Alfia Galimzianova, Aleš Koren, Matej Lukin, Franjo Pernuš, Boštjan Likar, and Žiga Špiclin. A Novel Public MR Image Dataset of Multiple Sclerosis Patients With Lesion Segmentations Based on Multi-rater Consensus. Neuroinformatics, 16(1):51–63, January 2018. ISSN 1539-2791, 1559-0089. doi: 10.1007/s12021-017-9348-7. URL http://link.springer.com/10.1007/s12021-017-9348-7.
[51] Ali M. Muslim. Brain MRI Dataset of Multiple Sclerosis with Consensus Manual Lesion Segmentation and Patient Meta Information, March 2022. URL https://data.mendeley.com/datasets/8bctsm8jz7/1.
[52] Francesco Guarnera, Alessia Rondinella, Elena Crispino, Giulia Russo, Clara Di Lorenzo, Davide Maimone, Francesco Pappalardo, and Sebastiano Battiato. MSLesSeg: baseline and benchmarking of a new Multiple Sclerosis Lesion Segmentation dataset. Scientific Data, 12(1):920, May 2025. ISSN 2052-4463. doi: 10.1038/s41597-025-05250-y. URL https://www.nature.com/articles/s41597-025-05250-y.
[53] Moritz R. Hernandez Petzsche, Ezequiel De La Rosa, Uta Hanning, et al. ISLES 2022: A multi-center magnetic resonance imaging stroke lesion segmentation dataset. Scientific Data, 9(1):762, December 2022. ISSN 2052-4463. doi: 10.1038/s41597-022-01875-5. URL https://www.nature.com/articles/s41597-022-01875-5.
[54] Fernando Pérez-García, Roman Rodionov, Ali Alim-Marvasti, Rachel Sparks, John Duncan, and Sebastien Ourselin. EPISURG: a dataset of postoperative magnetic resonance images (MRI) for quantitative analysis of resection neurosurgery for refractory epilepsy, 2020. URL https://rdr.ucl.ac.uk/articles/dataset/EPISURG_a_dataset_of_postoperative_magnetic_resonance_images_MRI_for_quantitative_analysis_of_resection_neurosurgery_for_refractory_epilepsy/9996158/1.
[55] Daniel S. Marcus, Tracy H. Wang, Jamie Parker, John G. Csernansky, John C. Morris, and Randy L. Buckner. Open Access Series of Imaging Studies (OASIS): Cross-sectional MRI Data in Young, Middle Aged, Nondemented, and Demented Older Adults. Journal of Cognitive Neuroscience, 19(9):1498–1507, September 2007. ISSN 0898-929X, 1530-8898. doi: 10.1162/jocn.2007.19.9.1498. URL https://direct.mit.edu/jocn/article/19/9/1498/4427/Open-Access-Series-of-Imaging-Studies-OASIS-Cross.
[56] Daniel S. Marcus, Anthony F. Fotenos, John G. Csernansky, John C. Morris, and Randy L. Buckner. Open Access Series of Imaging Studies: Longitudinal MRI Data in Nondemented and Demented Older Adults. Journal of Cognitive Neuroscience, 22(12):2677–2684, December 2010. ISSN 0898-929X, 1530-8898. doi: 10.1162/jocn.2009.21407. URL https://direct.mit.edu/jocn/article/22/12/2677/4983/Open-Access-Series-of-Imaging-Studies-Longitudinal.
[57] Liviu Badea, Mihaela Onu, Tao Wu, Adina Roceanu, and Ovidiu Bajenaru. Exploring the reproducibility of functional connectivity alterations in Parkinson's disease. PLOS ONE, 12(11):e0188196, November 2017. ISSN 1932-6203. doi: 10.1371/journal.pone.0188196. URL https://dx.plos.org/10.1371/journal.pone.0188196.
[58] Randy L. Buckner, Joshua L. Roffman, Jordan W. Smoller, and Neuroinformatics Research Group. Brain Genomics Superstruct Project (GSP), May 2014. URL https://dataverse.harvard.edu/citation?persistentId=doi:10.7910/DVN/25833.
[59] IXI Dataset, n.d. URL https://brain-development.org/ixi-dataset/. Accessed 2025.
[60] Benjamin Puccio, James P Pooley, John S Pellman, Elise C Taverna, and R Cameron Crad-dock. The preprocessed connectomes project repository of manually corrected skull-stripped T1-weighted anatomical MRI data. Gigascience, 5(1), December 2016. ISSN 2047-217X. doi:10.1186/s13742-016-0150-5. URL https://academic.oup.com/gigascience/article/doi/10.1186/s13742-016-0150-5/2737425.
[61] The MONAI Consortium. MONAI: An open-source framework for deep learning in healthcare imaging, 2022. URL https://arxiv.org/abs/2211.02701.
[62] Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q. Weinberger. Densely Connected Convolutional Networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2017), 2017. doi: 10.48550/arXiv.1608.06993. URL https://arxiv.org/abs/1608.06993.
[63] Sihong Chen, Kai Ma, and Yefeng Zheng. Med3D: Transfer Learning for 3D Medical Image Analysis, 2019. URL https://arxiv.org/abs/1904.00625.
[64] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2016), 2016. doi: 10.48550/arXiv.1512.03385. URL https://arxiv.org/abs/1512.03385.
[65] Ali Hatamizadeh, Vishwesh Nath, Yucheng Tang, Dong Yang, Holger Roth, and Daguang Xu. Swin UNETR: Swin Transformers for Semantic Segmentation of Brain Tumors in MRI Images, 2022. URL https://arxiv.org/abs/2201.01266.
[66] Yucheng Tang, Dong Yang, Wenqi Li, Holger R. Roth, Bennett Landman, Daguang Xu, Vishwesh Nath, and Ali Hatamizadeh. Self-Supervised Pre-Training of Swin Transformers for 3D Medical Image Analysis. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR 2022), 2022. doi: 10.48550/arXiv.2111.14791. URL https://arxiv.org/abs/2111.14791.
[67] Fabian Pedregosa, Gaël Varoquaux, Alexandre Gramfort, et al. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
[68] Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In International Conference on Learning Representations (ICLR), 2017. URL https://arxiv.org/abs/1610.02136.
[69] Saurabh Garg, Sivaraman Balakrishnan, Zachary C. Lipton, Behnam Neyshabur, and Hanie Sedghi. Leveraging unlabeled data to predict out-of-distribution performance. In International Conference on Learning Representations (ICLR), 2022. URL https://arxiv.org/abs/2201.04234.
A Decodability After Removal
Table 7: Dataset and sequence decodability inside the training datasets, before and after each removal method, averaged over the leave-one-dataset-out splits (balanced accuracy). Chance: 0.06 for the dataset and 0.25 for the sequence. Adv.: adversarial. Rand.: removing 15 random directions, the control for LEACE.
| Representation | Before | Dataset after | Sequence after | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Dataset | Seq. | INLP | LEACE | CORAL | Adv. | INLP | LEACE | Rand. | CORAL | Adv. | |
| Handcrafted | 0.92 | 0.73 | 0.88 | 0.84 | 0.14 | 0.88 | 0.68 | 0.56 | 0.67 | 0.54 | 0.71 |
| Untrained CNN | 0.94 | 0.88 | 0.89 | 0.26 | 0.11 | 0.90 | 0.83 | 0.71 | 0.87 | 0.62 | 0.78 |
| MedicalNet | 0.94 | 0.86 | 0.91 | 0.10 | 0.02 | 0.87 | 0.80 | 0.67 | 0.81 | 0.58 | 0.70 |
| SwinUNETR | 0.91 | 0.83 | 0.87 | 0.10 | 0.03 | 0.85 | 0.78 | 0.59 | 0.79 | 0.56 | 0.69 |
| BrainIAC | 0.84 | 0.76 | 0.75 | 0.03 | 0.01 | 0.72 | 0.71 | 0.57 | 0.72 | 0.49 | 0.59 |
| BrainFM | 0.93 | 0.89 | 0.90 | 0.23 | 0.07 | 0.90 | 0.84 | 0.68 | 0.88 | 0.62 | 0.80 |
| 3DINO | 0.95 | 0.95 | 0.67 | 0.10 | 0.01 | 0.86 | 0.90 | 0.81 | 0.94 | 0.69 | 0.74 |
| SAM-Med3D | 0.93 | 0.92 | 0.87 | 0.05 | 0.01 | 0.84 | 0.87 | 0.74 | 0.88 | 0.64 | 0.75 |
B Label-Free Prediction of Transfer
Table 8: Label-free prediction of sequence transfer to a held-out dataset. Spearman correlation between each score and the measured balanced accuracy, across the ten held-out datasets within each representation (mean over 11 representations and controls), across all 110 representation-dataset pairs, and across the 11 representation means. ATC also misestimates the balanced accuracy by 0.25 on average.
| Score | Within representation | Pooled | Across representations |
|---|---|---|---|
| Average confidence [68] | 0.03 | 0.26 | 0.91 |
| ATC [69] | 0.01 | 0.11 | 0.68 |
| Cluster consistency (ours) | 0.37 | 0.27 | 0.11 |