Why not just use invariant features?

Stable features and image detail offer different information. The challenge is teaching a predictor to use both without taking shortcuts. MaskGen combines a frozen feature extractor with channel masking during training. No test-time adaptation is needed.

See how masking works

Image
Image
Original intensities
Frozen extractor
1
2
3
4
5
6
Stable representation channels
SegmentorLearn from available channels

During training, whole input channels are randomly masked. At inference, all channels are available.

Schematic subset of channels; this is not a live segmentation model. Masking removes channels, not spatial image patches.

Why combine both sources?

Representation-only training can discard useful image information. Concatenation alone can still encourage dependence on the image. The paper analyzes when view masking prevents the stable source from being ignored; its assumptions and conditions matter.

Read the analysis and assumptions.

Explore the evidence

Choose a shift and training-data setting. Use the published examples alongside the measured scores.

Published results · selected methods
Test Dice, mean ± standard error. Selected methods from Tables 1–2.
Dataset / settingERMGIN+IPAMaskGen
AMOS / all-data57.4 ± 1.766.5 ± 0.867.5 ± 0.9
AMOS / five-shot5.4 ± 137.8 ± 1.553.4 ± 1.4
BraTS / all-data38.9 ± 1.844.7 ± 1.646.2 ± 1.6
CoW / all-data24.6 ± 1.537.6 ± 1.947.8 ± 1.3
CoW / five-shot18.2 ± 1.323.8 ± 1.740.3 ± 1.5
HVSMR / all-data63.6 ± 364.7 ± 2.665.8 ± 3.4
HVSMR / five-shot40.4 ± 3.844.5 ± 3.846.3 ± 3.8
PanDG / all-data25.3 ± 2.550.3 ± 1.446 ± 1.9
Prostate / all-data83 ± 0.784.1 ± 0.684.7 ± 0.5
Prostate / five-shot27.8 ± 527.9 ± 5.164.2 ± 4.4

Experimental protocol and full comparisons ↗. Five-shot uses five source-domain training subjects; BraTS and PanDG were not evaluated in this setting.

Add it to a training loop

The predictor receives the image and frozen features together. Channel dropout is active only during training.

# feature_extractor is frozen and in evaluation mode.
with torch.no_grad():
    features = feature_extractor(images)

inputs = torch.cat([images, features], dim=1)
inputs = F.dropout3d(inputs, p=mask_rate, training=predictor.training)
prediction = predictor(inputs)
loss = loss_fn(prediction, labels)

Illustrative core only; use the implementation for preprocessing, augmentation, and training configuration. At inference, use the same frozen extractor and all input channels.

Practical considerations

The extractor adds computation at training and inference. Representation quality and masking rate remain relevant choices. Consult the runtime analysis and implementation details for the evaluated configuration.

Read the abstract

We present MaskGen, a simple and theoretically-grounded approach for domain generalization in 3D biomedical image segmentation. Modern segmentation models degrade sharply under shifts in modality, disease severity, clinical sites, and other factors, creating brittle models that limit reliable deployment. Existing domain generalization methods rely on extreme augmentations, mixing domain statistics, or architectural redesigns, yet incur significant implementation overhead and yield inconsistent performance across biomedical settings. MaskGen instead proposes a principled learning strategy with minimal overhead that leverages both source-domain image intensities and domain-stable foundation model representations to train robust segmentation models. As a result, MaskGen achieves strong gains in both fully supervised and few-shot segmentation across a broad range of shifts in biomedical studies. Unlike prior approaches, MaskGen is architecture- and loss-agnostic, compatible with standard augmentation pipelines, computationally lightweight, and tackles arbitrary anatomical regions. Our implementation is publicly available.

BibTeX

@inproceedings{diaz2026maskgen,
  title     = {Why Invariance is Not Enough for Biomedical Domain
               Generalization and How to Fix It},
  author    = {Diaz, Sebo and Golland, Polina and
               Adalsteinsson, Elfar and Dey, Neel},
  booktitle = {Advances in Neural Information Processing Systems},
  year      = {2026},
  url       = {https://arxiv.org/abs/2604.02564}
}