This blog post summarizes the paper "Revisiting Continuity of Image Tokens for Cross-domain Few-shot Learning," published at ICML 2025.
TL;DR
Counter-intuitively, breaking the spatial "smoothness" of an image helps Vision Transformers (ViTs) generalize better to distant domains. By disrupting image token continuity during training, the authors force models to ignore large, domain-specific patterns and instead focus on smaller, highly transferable features, achieving state-of-the-art results in Cross-Domain Few-Shot Learning (CDFSL).
What Problem Does This Paper Address?
Vision Transformers (ViTs) are powerhouses in computer vision, but they suffer from a "domain gap" problem. A ViT trained on ImageNet (source domain) often fails when applied to specialized, data-scarce tasks like medical imaging or satellite analysis (target domains).
Most existing solutions try to align features or use complex meta-learning. This paper takes a different route by looking at the input tokens. ViTs divide images into patches (tokens). While the self-attention mechanism is technically insensitive to the order of these tokens, we usually add "positional embeddings" to maintain spatial continuity. The authors ask: Does this spatial continuity actually help or hinder the model when the target domain looks nothing like the source?
Methods
The authors propose a method called ReCIT (Revisiting Continuity of Image Tokens), which consists of a two-stage training strategy designed to "break" the model's reliance on holistic, domain-specific shapes.
-
Warm-Up Spatial-Domain Disruption: Instead of jumping straight into total chaos, the model starts by learning from images divided into "pseudo-patches" of varying sizes (from $1 \times 1$ to $14 \times 14$) that are randomly shuffled. This encourages the model to start recognizing internal information within patches rather than just the global structure.
-
Balanced Frequency-Domain Disruption: To further strip away domain-specific "styles" (like the specific lighting of a lab or the blue of an ocean), the authors move to the frequency domain. They cluster image patches based on visual similarity and model their amplitude distributions as Gaussians. They then re-sample and re-assign these amplitudes across patches. This ensures the disruption is diverse and prevents the model from latching onto consistent background textures.
Key Insights and Ideas
- The Continuity Paradox: As shown above, the authors found that disrupting token continuity (e.g., shuffling patches) causes a massive performance drop on the source domain (ImageNet) but only a marginal drop on target domains (like X-rays).
- Large vs. Small Patterns: The "aha moment" is that continuity primarily helps a model learn large spatial patterns (the "whole fish"). These large patterns are usually domain-specific and don't transfer well. Small patterns (textures, edges within a patch) are much more universal.
- Reducing the Gap via Chaos: By intentionally breaking the "whole fish" during training, the model is forced to become an expert at "fish scales" and "fins." Since "scales" might look like "skin lesions" or "cells," the domain gap effectively shrinks.
- CKA Similarity: Using Centered Kernel Alignment (CKA), the authors quantitatively proved that disrupting continuity actually increases the feature similarity between the source and target domains, as illustrated in the chart above.
Datasets
The researchers used a standard but challenging benchmark for CDFSL:
- Source Domain: miniImageNet (general natural objects).
- Target Domains (Distant):
- CropDiseases (Agricultural)
- EuroSAT (Satellite imagery)
- ISIC2018 (Skin lesion dermoscopy)
- ChestX (Chest X-rays)
These target datasets represent extreme domain shifts where traditional "ImageNet-style" features (like the shape of a dog's ear) are useless.
Key Results
ReCIT consistently outperformed state-of-the-art (SOTA) methods across all benchmarks:
- 1-Shot Accuracy: On the difficult ChestX dataset, ReCIT achieved 23.27% (without finetuning), surpassing previous methods like AttnTemp and CD-CLS.
- 5-Shot Accuracy: On EuroSAT, ReCIT reached 91.58% (with finetuning), setting a new high bar for the field.
- Qualitative Perception: Attention maps (heatmaps) show that while baseline models focus on a single large central object, ReCIT-trained models attend to multiple smaller, discriminative patterns scattered throughout the image, leading to a "broader perceptual field."
Limitations and Future Work
- Source Domain Trade-off: There is a "no free lunch" aspect; disrupting continuity leads to a slight decrease in performance on the original source domain (miniImageNet). The model becomes a better generalist but a slightly worse specialist for the original data.
- Computational Complexity: The balanced frequency-domain disruption involves clustering and Gaussian modeling, which adds some overhead to the training pipeline compared to simple patch shuffling.
- Future Directions: The authors suggest this "continuity-breaking" philosophy could be applied beyond few-shot learning to fields like domain generalization and incremental learning, where robust, low-level feature extraction is critical.
Summary updated