A Foundation Language-Image Model of the Retina (FLAIR): encoding expert knowledge in text supervision

Julio Silva-Rodríguez, Hadi Chakor, Riadh Kobbi, Jose Dolz, Ismail Ben Ayed

Abstract

Deep learning models for retinal imaging often struggle with domain shift and rare conditions due to their reliance on narrow, categorical supervision. We present FLAIR (Foundation LAnguage-Image model of the Retina), a vision-language foundation model that integrates expert clinical knowledge into the training loop. By replacing simple labels with descriptive, literature-based textual prompts, FLAIR achieves state-of-the-art generalization and zero-shot performance. Evaluated across a massive assembly of 38 datasets, FLAIR significantly outperforms generalist models like CLIP and specialized self-supervised networks like RETFound.

Introduction

While deep learning has shown promise in ophthalmology for tasks such as diabetic retinopathy (DR) grading and glaucoma detection, existing models are typically "narrow"—optimized for specific datasets and tasks. These models frequently fail when encountering domain shifts (e.g., different camera types) or rare pathologies. Generalist foundation models like CLIP have revolutionized computer vision but struggle in medical domains due to data scarcity and a lack of "expert eye" for fine-grained pathological features. FLAIR addresses these gaps by leveraging contrastive language-image pre-training (VLP) informed by expert clinical descriptions.

Methods

FLAIR utilizes a ResNet-50 vision encoder and a BioClinicalBERT text encoder. The core innovation is the mapping function $\pi_{EK}$, which translates standard categorical labels into rich, descriptive textual prompts derived from clinical literature and community standards (e.g., the American Academy of Ophthalmology). For instance, instead of the label "Mild DR," the model is supervised with the description "only a few microaneurysms are present."

The FLAIR framework: dataset assembly, contrastive pretraining with expert knowledge, and downstream adaptation.

The model was trained on a "super-dataset" of 288,307 images from 38 open-access sources. During pre-training, FLAIR learns to align visual features with these expert-designed textual embeddings. This allows for robust zero-shot classification on new tasks by comparing query images to expert prompts.

Key Insights: Text as "Rich" Supervision

Categorical labels are often mathematically "poor," providing no semantic context regarding why an image belongs to a specific class. In contrast, descriptive text provides a semantic roadmap, linking global diagnoses to local lesions. Expert knowledge naturally encodes clinical hierarchies; by describing "venous beading" as a hallmark of "Severe DR," the model learns the underlying clinical relationships.

Comparison of disease-feature associations: FLAIR (right) correctly aligns clinical signs like venous beading with severe DR, unlike standard CLIP (left).

As shown in the chord diagrams, generalist models like CLIP often fail to associate specific clinical features with their corresponding diagnoses. FLAIR's expert-informed supervision ensures that the model captures the fine-grained details necessary for accurate clinical assessment.

Results and Generalization

FLAIR demonstrates superior generalization across various benchmarks:

  • Domain Shift: On tasks involving significant domain shift, FLAIR achieved an Average Class Accuracy (ACA) of ~74%, vastly outperforming CLIP (~31%) and BiomedCLIP (~39%).
  • Comparison to Self-Supervision: FLAIR outperformed RETFound (a state-of-the-art self-supervised model) by a margin of +12% in linear probing, despite RETFound's larger architecture.
  • Zero-Shot Performance: For diseases unseen during training, FLAIR-πEK achieved an average accuracy of 68.3%, compared to 33.2% for standard CLIP. In specific categories like Macular Hole, it achieved near-perfect zero-shot accuracy.

Conclusion

FLAIR represents a significant advancement in retinal foundation models by demonstrating that "clinical common sense" encoded in text can be more reliable than patterns learned from biased, small-scale datasets. While the model's performance is sensitive to prompt quality, it sets a new standard for robust, expert-aligned medical AI. Future work will explore the use of Large Language Models (LLMs) to automate the generation of these expert descriptors and address the fine-tuning trade-offs in out-of-distribution adaptation.

Summary updated

BibTeX
@article{silvarodriguez2023foundation,
  author = {Julio Silva-Rodríguez and Hadi Chakor and Riadh Kobbi and Jose Dolz and Ismail Ben Ayed},
  title = {{A Foundation Language-Image Model of the Retina (FLAIR): encoding expert knowledge in text supervision}},
  journal = {Medical Image Analysis},
  year = {2023},
}
Figure