TL;DR
This paper introduces L2C, a novel method for Few-Shot Test-Time Domain Adaptation (FSTT-DA) that enhances CLIP's capabilities by learning directly from input image data. L2C complements CLIP's frozen features with a parallel network and refines text embeddings, achieving significant performance gains on challenging benchmarks, especially with smaller backbones.
What Problem Does This Paper Address?
Deep learning models often struggle when the distribution of test data differs from the training data, a phenomenon known as domain shift. Few-Shot Test-Time Domain Adaptation (FSTT-DA) aims to address this by adapting a pre-trained model to a new, unseen target domain using only a few unlabeled examples at test time. Existing methods often leverage powerful models like CLIP, which have strong out-of-distribution (OOD) generalization. However, these methods typically rely on adapting CLIP's existing feature space, which can be limiting, especially when using less powerful backbones (like ViT-B/16) or when the target domain significantly deviates from CLIP's training data. This can lead to performance drops on complex, real-world datasets. The paper tackles this by proposing a method that learns directly from the input space to capture dataset-specific knowledge that CLIP might miss.
Methods
The core of L2C lies in its approach to complement CLIP's frozen features and adapt them to new domains.
- Complementing Visual Features with CPNet: L2C introduces a parallel module called CPNet, which operates alongside CLIP's image encoder. CPNet learns dataset-specific visual knowledge directly from the input space. It uses a "revert attention" mechanism to focus on learning information that CLIP might not capture, effectively complementing CLIP's generalized features. This approach avoids modifying CLIP's internal layers, making it suitable for black-box scenarios.
- Enhancing Text Features: Recognizing that text features also need adaptation, L2C employs a two-pronged strategy:
- Greedy Text Ensemble: To improve the discrimination between class embeddings, L2C uses a greedy ensemble strategy to select text prompt templates that maximize "inter-dispersion" (making class embeddings more distinct).
- Lightweight Refinement: A small refinement module further enhances this inter-dispersion using a uniformity loss. This pre-processing step makes text features more neutral across domains before adaptation.
- Domain-Aware Fusion (DAF): To adapt both visual and text features to the target domain, L2C generates a "domain prompt" using a learned domain cache and the CPNet. This prompt then guides a domain-aware fusion module (DAF) that cross-attends between the prompt, complemented visual features, and refined text features, effectively adapting them to the specific target domain.
Datasets
The paper evaluates L2C on several large-scale benchmarks:
- DomainNet: A dataset comprising 6 domains with 345 classes, used for evaluating classification performance.
- WILDS: A collection of challenging real-world benchmarks known for significant domain shifts and data imbalances. This includes:
- iWildCam: For classification.
- Camelyon17: For classification.
- FMoW: For classification.
- PovertyMap: Used for regression, demonstrating the framework's versatility.
Key Insights and Ideas
- Learning from Input Space is Crucial: The paper strongly advocates for learning directly from the input image space (via CPNet) to capture dataset-specific knowledge, rather than solely relying on adapting CLIP's pre-existing feature representations. This is particularly effective for weaker backbones.
- Text Features Matter for Adaptation: Adapting text features, not just visual ones, is vital for effective domain adaptation. Enhancing text feature discrimination through ensemble and refinement significantly boosts performance.
- Black-Box Compatibility: L2C's design, especially CPNet and the gradient-free domain prompt computation, makes it suitable for black-box scenarios where direct access to model weights is not possible.
- Efficiency Gains: By discarding the text encoder after the initial prompt ensemble and using a lightweight CPNet, L2C achieves efficiency comparable to or better than existing methods, especially in inference.
Key Results
L2C demonstrates strong performance across various benchmarks:
- WILDS Benchmarks:
- iWildCam: Achieved +5.1% improvement in F1 score with ViT-B/16 compared to VDPG.
- FMoW: Achieved +3.1% improvement in WC Acc with ViT-B/16 compared to VDPG.
- Overall, L2C substantially outperforms previous approaches on WILDS, particularly with the less capable ViT-B/16 backbone.
- DomainNet: L2C achieved average gains of +1.4% (ViT-B/16) and +2.2% (ViT-L/14) over VDPG, surpassing SOTA in 4/6 and 5/6 domains.
- Regression Task (PovertyMap): The method also shows positive correlation and significant performance boosts for regression tasks.
Limitations and Future Work
- Network Size: The authors acknowledge that if a downstream dataset significantly diverges from CLIP's pre-training, the CPNet might require a larger network to capture the excluded knowledge. However, they argue that the trade-off between computational demand and performance remains favorable compared to previous methods.
- Future Work: The paper suggests exploring more sophisticated domain prompt computation and fusion strategies. Further investigation into the optimal architecture for CPNet based on dataset complexity is also implied.
Summary updated