Abstract
Standard CLIP models align individual images with captions but often lack the geometric structure—such as vector arithmetic—necessary for relational reasoning. We introduce PC-CLIP (Pairwise Comparison CLIP), a finetuning approach that aligns text descriptions of visual differences between images with the vector differences in their embeddings. By leveraging synthetic data generated by Large Language Models (LLMs), PC-CLIP learns to capture the relational structure of the visual world. Our results demonstrate significant improvements in attribute ranking and fine-grained classification, effectively distilling LLM common sense into a vision-language embedding space.
Introduction
While CLIP is a cornerstone of modern vision-language tasks, its embedding space does not natively support reasoning about changes or relative attributes. In purely linguistic models, analogies like "King - Man + Woman ≈ Queen" hold true, but CLIP struggles with similar relational tasks. This leads to two primary weaknesses: attribute blindness, where the model cannot rank images by relative features (e.g., "which animal is larger?"), and fine-grained confusion, where it fails to distinguish between semantically similar classes like a crab and a lobster.
Methods
PC-CLIP addresses these limitations by teaching the model the "geometry of differences" through a three-step pipeline:
- Synthetic Data Generation: Using LLaMA2-13B, the authors generate descriptions of visual differences between pairs of image captions from the COCO dataset (e.g., "What is the visual difference between an image of a clock on a building and a wall of clocks?").
- PC-CLIP Finetuning: The CLIP text encoder is finetuned using a contrastive loss to align the embedding of the LLM-generated difference description with the vector subtraction of the two corresponding image embeddings ($g(I_1) - g(I_2)$).
- Comparative Prompting: At inference time, if the model is uncertain between two classes, it uses an LLM-generated difference description to "nudge" the class prompt embedding, enhancing the separation between similar categories.
Datasets and Evaluation
The primary model was trained on approximately 560,000 synthetic comparisons derived from the COCO dataset. Evaluation was conducted across a diverse suite of benchmarks, including attribute ranking (AwA2, CIFAR100, CUB, Flowers102), zero-shot classification (SUN397, EuroSAT), and retrieval tasks (Flickr30k).
Key Results
PC-CLIP demonstrates substantial improvements in reasoning about relative attributes. On the CIFAR100 attribute ranking task, PC-CLIP achieved 67.44% accuracy, a significant jump from vanilla CLIP’s 54.92%, which is near-random for this binary task.
Beyond attribute ranking, the model saw absolute gains in zero-shot classification, such as a +2.2% improvement on the EuroSAT satellite imagery dataset. The "Comparative Prompting" technique proved particularly effective for fine-grained tasks, yielding a +9.38% boost on the Flowers102 dataset.
Discussion and Conclusion
The success of PC-CLIP highlights that the text encoder is the key to unlocking relational knowledge in vision-language models. By aligning difference descriptions with vector space, the model becomes better at interpreting complex, relational prompts. This approach demonstrates that LLM "common sense" can be distilled into multimodal embeddings without the need for expensive manual labeling. Future work may explore scaling this method to millions of images or using multimodal models to generate even more precise difference descriptions.
Summary updated