Rank2Replace: VLM-Ranked Slot Replacement for Out-of-Distribution Generalization

Bo-Han Feng, Keng-Te Liao, Shou-De LinarXiv 2026 · arXiv

TL;DR

Rank2Replace is a novel training-time augmentation strategy that transfers task-specific knowledge from large Vision-Language Models (VLMs) to small, efficient predictors. By ranking object-centric image "slots" by relevance and replacing low-ranking incidental cues (like backgrounds) with content from other images, it effectively disrupts spurious correlations and significantly boosts out-of-distribution (OOD) generalization without requiring expensive environment labels.

What Problem Does This Paper Address?

Deep learning models are notorious for taking shortcuts. An image classifier might learn to identify a "waterbird" not by its beak or feathers, but simply because there is water in the background. These spurious correlations lead to high accuracy on standard datasets but catastrophic failure when the environment shifts (e.g., seeing a waterbird on a forest floor).

Existing solutions for out-of-distribution (OOD) generalization often fall into two camps:

  1. Environment-aware methods: These require "group labels" (e.g., knowing which images have "water" backgrounds), which are rarely available in real-world settings.
  2. Generic augmentations: Methods like Mixup or Cutout are task-agnostic and might inadvertently destroy the very evidence needed for classification.

The authors ask: How can we use the vast semantic knowledge of VLMs to guide small models toward task-relevant evidence and away from incidental cues?

Methods

Rank2Replace introduces a three-stage pipeline for VLM-guided data augmentation:

  1. Slot Extraction: A frozen, pretrained object-centric extractor (like FT-DINOSAUR) decomposes an image into several "slots"—embeddings that represent distinct objects, parts, or background regions.
  2. Task-Guided Ranking: A VLM (e.g., Qwen3-VL) receives these slot images along with a task description (e.g., "classify bird species"). It ranks the slots from most relevant (the bird) to least relevant (the sky or water).
  3. Rank-Dependent Corruption: During training, the system follows a "Top-preserving" schedule. It keeps the high-ranking slots of a "recipient" image but replaces its low-ranking slots with same-rank slots from a random "donor" image.
The Rank2Replace pipeline: (1) Extracting slots, (2) Ranking with a VLM, (3) Augmenting via replacement, and (4) Efficient inference.

Crucially, the original label is retained. This forces the small predictor (usually a simple MLP) to ignore the changing incidental cues and rely solely on the preserved task-relevant evidence.

Datasets

The authors evaluated the method across four diverse datasets known for challenging distribution shifts:

  • Waterbirds: Classifying landbirds vs. waterbirds against land/water backgrounds.
  • CelebA: Predicting hair color (blond vs. non-blond) where gender is a strong spurious cue.
  • MetaShift: A natural-image dataset for evaluating contextual shifts (e.g., cats in different indoor/outdoor settings).
  • NICO++: A large-scale benchmark for domain generalization with 60 classes across various environments (e.g., "autumn," "dim lighting").

Key Insights and Ideas

  • VLMs as Semantic Guides: While VLMs are too slow for real-time inference, they are excellent "teachers" during training. Rank2Replace uses them to identify what to augment, rather than just how to augment.
  • Ranking is Essential: The authors found that replacing slots based on VLM rankings significantly outperformed random replacement or ranking by simple metrics like mask area. The VLM successfully prioritizes "clear evidence" at the front of the ranking.
  • Compatibility: Rank2Replace isn't just a standalone method; it's a "plug-and-play" augmentation. It can be combined with existing OOD objectives like Invariant Risk Minimization (IRM) to achieve even higher robustness.
  • VLM-Free Inference: By using permutation-invariant architectures (like Set Transformers or Deep Sets), the model can be trained with VLM guidance but deployed without the VLM. This maintains high efficiency for real-world applications while retaining the benefits of semantic guidance.

Key Results

Rank2Replace outperformed 14 different OOD baselines in macro-averaged metrics.

  • Accuracy Gains: On the default configuration, it reached 80.43% average-group accuracy and 65.28% worst-group accuracy (WGA). This is a massive jump over standard Cross-Entropy training, which managed only 47.77% WGA.
  • Synergy with IRM: When combined with IRM, the performance climbed to 72.68% WGA, the highest reported in the study.
  • Efficiency: Using a Set Transformer allowed for inference speeds of ~2.4 ms/image—over 50x faster than direct prediction using the VLM itself, while achieving superior accuracy.
Comparison of Rank2Replace against various baselines across different datasets.

Limitations and Future Work

  • Extractor Dependence: The method relies on the quality of the initial slot extractor. If the extractor fails to segment the task-relevant object into its own slot, the VLM cannot rank it effectively.
  • Human-Authored Prompts: Currently, the task descriptions and evidence criteria for the VLM are human-authored. Automating this "task-discovery" phase could make the pipeline more scalable.
  • Fixed Slot Count: The study primarily uses a fixed number of slots ($K=7$). Exploring dynamic slot counts or hierarchical slot representations could be a promising future direction.

In summary, Rank2Replace demonstrates that we don't need to choose between the "intelligence" of large foundation models and the "efficiency" of small predictors. By using the former to semantically curate the training data of the latter, we can build models that are both fast and truly robust.

Summary updated

Abstract

Spurious correlations can give image predictors high in-distribution accuracy but poor generalization under distribution shift. We introduce $\textbf{Rank2Replace}$, which transfers knowledge of task-relevant evidence from pretrained vision--language models (VLMs) to small predictors through training-time augmentation for out-of-distribution (OOD) generalization. The VLM ranks object-centric slots by task relevance and guides rank-dependent replacement with same-rank slot embeddings from another image. This augmentation retains the original image's label, encouraging reliance on preserved task evidence as incidental cues change, and supports combination with existing OOD methods. Across four datasets and six splits under shared frozen slot embeddings, the default cross-entropy configuration reaches macro-averaged average-group and worst-group accuracies of $80.43\%$ and $65.28\%$ without environment labels or dataset-specific replacement tuning. Slot corruption improves both macro-averaged metrics for all fourteen OOD training methods. Combining it with slot ranking and IRM reaches $81.96\%$ and $72.68\%$. Controlled ablations support the ranking and replacement design, with gains across five ranking VLMs and six extractor--predictor combinations. Permutation-invariant predictors further improve both macro-averaged metrics over their unaugmented counterparts while using VLM guidance only during training for efficient inference.
BibTeX
@misc{feng2026rank,
  author = {Bo-Han Feng and Keng-Te Liao and Shou-De Lin},
  title = {{Rank2Replace: VLM-Ranked Slot Replacement for Out-of-Distribution Generalization}},
  year = {2026},
  eprint = {2611.25834},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.25834},
}
Figure