Abstract
The Contrastive Language-Image Pre-Training (CLIP) model excels in few-shot learning by aligning visual and textual representations. Our study shows that template-sample similarity (TSS), defined as the resemblance between a text template and an image sample, introduces bias. This bias leads the model to rely on template proximity rather than true sample-to-category alignment, reducing both accuracy and robustness in classification. We present a framework that uses empty prompts, textual inputs that convey the idea of "emptiness" without category information. These prompts capture unbiased template features and offset TSS bias. The framework employs two stages. During pre-training, empty prompts reveal and reduce template-induced bias within the CLIP encoder. During few-shot fine-tuning, a bias calibration loss enforces correct alignment between images and their categories, ensuring the model focuses on relevant visual cues. Experiments across multiple benchmarks demonstrate that our template correction method significantly reduces performance fluctuations caused by TSS, yielding higher classification accuracy and stronger robustness.
Introduction
Contrastive Language-Image Pre-Training (CLIP) has established itself as a cornerstone for zero-shot and few-shot visual recognition. By mapping images and text into a shared embedding space, CLIP allows for classification via natural language prompts like "a photo of a [CLASS]". However, this approach suffers from a systemic flaw known as Template-Sample Similarity (TSS) bias.
The generic portion of a prompt—the template—often possesses an inherent similarity to certain image types that is independent of the actual object category. For instance, a satellite image might naturally align more closely with the string "a photo of a..." than a close-up portrait does. In few-shot scenarios, where data is scarce, the model frequently exploits this template proximity as a shortcut rather than learning genuine semantic features. This "attention bias" results in misclassifications and reduced robustness across different prompt variations.
Proposed Method: Decoupling Template Bias
To address TSS bias, we propose a two-stage framework that leverages "empty prompts" to isolate and neutralize the influence of text templates.
1. Empty Prompt Generation
We curated a set of 25 terms representing "emptiness" (e.g., "None", "Hollow", "Null"). By embedding these into standard templates, we create "empty prompts" that encapsulate the textual characteristics of the template without any category-specific information.
2. Pre-training Initialization
Before task-specific fine-tuning, the CLIP model undergoes an initialization phase. Using an unsupervised loss, we ensure that the similarity between any given image and the set of empty prompts is uniform. This process effectively "zeros out" the template's prior influence on the visual encoder.
3. Few-shot Fine-tuning Calibration
During the few-shot learning phase, we employ Parameter-Efficient Fine-Tuning (PEFT) via LoRA. To maintain the debiasing effect, we introduce a Template Bias Calibration Loss ($L_{tb}$) alongside the standard cross-entropy loss ($L_{ce}$). This dual-loss objective forces the model to focus on discriminating between actual classes while remaining invariant to template-induced noise.
Experimental Results
The framework was evaluated across 11 diverse benchmarks, including ImageNet, EuroSAT (satellite imagery), and specialized datasets like Oxford Pets and Flowers102.
Performance and Robustness
Our method consistently outperformed state-of-the-art baselines such as LoRA-CLIP and MaPLe, achieving an average improvement of 1.5 points across all datasets. The gains were particularly pronounced in extreme low-data regimes; for example, on the EuroSAT 1-shot task, accuracy improved from 72.3% to 78.4%.
Crucially, the method significantly enhances robustness. As shown in the right panel of the figure above, while standard fine-tuning performance fluctuates wildly depending on the choice of template, our "decoupled" model maintains high and stable accuracy regardless of the specific phrasing used. We successfully reduced the residual correlation between template similarity and accuracy from ~0.2 in standard LoRA to near zero (-0.05).
Conclusion
Template-Sample Similarity is a significant yet often overlooked source of bias in CLIP-based few-shot learning. By utilizing empty prompts to decouple template features from class semantics, our framework provides a robust solution that improves both accuracy and consistency. While the benefits are most significant in low-shot settings, future work will explore the scalability of this debiasing approach to larger vision-language models and automated prompt engineering pipelines.
Summary updated