Introduction
Pre-trained Vision-Language Models (VLMs) like CLIP have demonstrated remarkable zero-shot capabilities. However, adapting these models to specialized downstream tasks—such as fine-grained classification with limited data—remains a significant challenge. Existing adaptation techniques, or "adapters," often suffer from three primary limitations: modality isolation (treating text and vision separately), a "positive-only" bias (ignoring what an object is not), and structural neglect (ignoring relationships between different classes).
To address these issues, HeGraphAdapter introduces a novel framework that treats the relationship between images and text as a complex, multi-layered heterogeneous graph. By explicitly modeling both positive and negative prompts alongside visual features, the model achieves state-of-the-art performance in few-shot classification.
The HeGraphAdapter Framework
The core innovation is the construction of a unified graph consisting of three types of nodes: Visual Nodes (mean visual features of a class), Positive Text Nodes ("A photo of a {class}"), and Negative Text Nodes ("A photo of no {class}").
As shown in the architecture above, the model employs a Heterogeneous Graph Neural Network (HGNN) to facilitate message passing across six different edge types (e.g., visual-to-positive-text, positive-to-negative-text). This allows features to "cross-pollinate," enabling visual nodes to update their representations based on their similarity to positive prompts and their dissimilarity to negative ones. The process follows a hierarchical aggregation strategy:
- Negative node aggregation: Refines the concept of "what it isn't" based on visual and positive context.
- Positive node aggregation: Refines the class definition using updated negative and visual information.
- Visual node aggregation: Learns a "visual bias" to adapt the actual image features to the specific downstream dataset.
Experimental Results
HeGraphAdapter was evaluated on 11 benchmark datasets, ranging from general object recognition (ImageNet, Caltech101) to specialized domains (EuroSAT, FGVCAircraft).
Few-Shot Superiority
The model consistently outperformed state-of-the-art methods like CoOp, Tip-Adapter, and the original GraphAdapter. In few-shot settings (1, 2, and 4-shot), HeGraphAdapter exceeded the second-best methods by an average of 2.09%, 1.74%, and 1.28% respectively across all 11 datasets. On ImageNet (16-shot), it achieved a top-1 accuracy of 66.18%.
The Importance of "No"
A key insight from the study is the effectiveness of negative prompts. By learning what a "Wolf" is not, the model can more precisely define the boundaries for a "Husky." This contrastive approach significantly boosts the model's ability to distinguish between visually similar classes.
Generalization and Robustness
When trained on standard ImageNet and tested on out-of-distribution versions (e.g., ImageNet-Sketch, ImageNet-Adversarial), HeGraphAdapter demonstrated superior robustness compared to zero-shot CLIP and other tuning methods. Visualization via t-SNE plots confirms that HeGraphAdapter produces tighter, more distinct class clusters.
Conclusion
HeGraphAdapter demonstrates that modeling the interactions between visual and textual modalities as a heterogeneous graph is a powerful strategy for VLM adaptation. By incorporating negative constraints and cross-modal message passing, it overcomes the limitations of previous isolated adapters. While the model introduces some additional computational complexity, its significant gains in accuracy and robustness make it a compelling choice for few-shot multi-modal learning.
Summary updated