MedCLIP: Contrastive Learning from Unpaired Medical Images and Text

Zifeng Wang, Zhenbang Wu, Dinesh Agarwal, Jimeng Sun · DOI

Abstract

Contrastive Language-Image Pre-training (CLIP) has demonstrated remarkable success in general computer vision, yet its application to the medical domain is hindered by data scarcity and the prevalence of false negatives in clinical datasets. We present MedCLIP, a novel framework that adapts contrastive learning for medical imaging by decoupling image-text pairs and incorporating domain-specific knowledge. By replacing traditional contrastive loss with a semantic matching loss, MedCLIP achieves state-of-the-art performance while utilizing significantly less data than previous methods.

Introduction

Vision-text pre-training has revolutionized the ability of models to perform zero-shot tasks and learn robust representations. However, the medical domain presents unique challenges that prevent the direct application of standard CLIP-like frameworks. First, medical datasets are orders of magnitude smaller than the 400-million-pair datasets used for general models. Second, the standard InfoNCE loss used in contrastive learning assumes that any image and text not explicitly paired are "negatives." In medicine, this assumption is often false; two different patients may share identical clinical findings (e.g., pneumonia), leading the model to incorrectly penalize similar semantic representations. MedCLIP addresses these bottlenecks through combinatorial data scaling and knowledge-guided supervision.

Methodology

Decoupling Images and Texts

Unlike traditional frameworks that require strictly paired image-report data, MedCLIP treats images and text reports as independent pools. During training, the model samples batches of images and texts separately. This decoupling allows the model to leverage image-only datasets with labels alongside text-only reports, effectively expanding the training signal through combinatorial matching. This approach mitigates the data scarcity issue by allowing the model to learn from the relationship between any image and any text within a batch.

Knowledge-Driven Semantic Matching Loss

To resolve the "False Negative Trap," MedCLIP replaces the binary match/no-match objective with a soft semantic similarity target. The authors utilize MetaMap, a tool that maps medical text to the Unified Medical Language System (UMLS), to extract clinical entities from both reports and labels.

Instead of forcing the model to push apart embeddings from different patients, MedCLIP calculates a similarity matrix based on these extracted clinical entities. If an image and a report both describe "pleural effusion," they are assigned a high semantic similarity score regardless of their original pairing. The model is then trained to align the cosine similarity of its visual and textual embeddings with this knowledge-based similarity matrix.

Architecture

MedCLIP employs a Swin Transformer as the vision backbone and BioClinicalBERT as the text encoder. This combination ensures that both the visual features and the medical nomenclature are processed by architectures optimized for their respective domains.

Experimental Results

Data Efficiency and Zero-Shot Performance

MedCLIP demonstrates extraordinary data efficiency. The model, when trained on only 20,000 samples, outperformed the previous state-of-the-art model, GLoRIA, which required 200,000 samples. On the CheXpert-5x200 benchmark, MedCLIP-ViT achieved a zero-shot accuracy of 0.594, significantly higher than ConVIRT (0.418) and GLoRIA (0.432).

Generalization to Novel Classes

One of the most striking findings was MedCLIP’s performance on a COVID-19 dataset. Despite having no COVID-positive images in its pre-training data, the model achieved over 0.80 accuracy. This success was driven by the model's ability to process text prompts describing COVID-19 symptoms, such as "ground-glass opacity." This indicates that MedCLIP learns underlying medical semantics rather than simple label associations.

Fine-Tuning and Retrieval

In supervised fine-tuning tasks, MedCLIP maintained its lead over existing models, suggesting that its pre-trained representations are more robust and transferable. Furthermore, in image-to-text retrieval tasks, MedCLIP achieved a Precision@10 of 0.50, outperforming GLoRIA’s 0.46.

Discussion and Limitations

While MedCLIP represents a significant step forward, it is not without limitations. The system’s reliance on MetaMap for building the similarity matrix introduces a dependency on the accuracy of entity extraction; failures in catching negations (e.g., "no pneumonia") can lead to inaccurate supervision. Additionally, like its predecessors, MedCLIP is sensitive to the phrasing of text prompts during zero-shot inference. Future work is required to address the non-smooth, anisotropic distribution of embeddings and to expand the framework beyond chest X-rays to other modalities such as MRI and CT scans.

Conclusion

MedCLIP redefines medical vision-language pre-training by shifting from rigid image-text pairing to a flexible, knowledge-driven semantic matching approach. By leveraging medical ontologies to denoise the contrastive objective, MedCLIP achieves superior performance with a fraction of the data, paving the way for more efficient and scalable medical AI systems.

Summary updated

BibTeX
@inproceedings{wang2022medclip,
  author = {Zifeng Wang and Zhenbang Wu and Dinesh Agarwal and Jimeng Sun},
  title = {{MedCLIP: Contrastive Learning from Unpaired Medical Images and Text}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-main.256},
}
Figure