↓ Skip to main content

LLaVA-Med: a vision-language model for medicine

·1099 words·6 mins
Yenjia Chen
Author
Yenjia Chen
Deep learning, medical AI, data science, and mathematics.

Deep learning has shown promising performance on a range of medical tasks. In classification, for example, physicians can combine model outputs with their own experience to inform diagnosis. Yet many common models produce just one output for an image, such as classification logits or a segmentation mask.

A medical image can contain much more information. Some findings may relate to the target task without being its main focus—for example, an organ may show inflammation rather than a malignant tumor. Others may be unrelated to the original question but still warrant follow-up. Microsoft’s LLaVA-Med: Training a large language-and-vision assistant for biomedicine in one day, published in 2023, combines language and vision to help describe the contents of medical images.

LLaVA-Med is a conversational vision-language model. Given an image, users can ask questions or request a description, much like chatting with ChatGPT. General-purpose multimodal models available at the time of this article, such as Google Bard, could also process images and text, but their answers could be unreliable because they lacked specialized medical knowledge. This paper presents an efficient training approach that adapts existing open-source models using medical data, reporting promising results after 15 hours of training on eight 40 GB A100 GPUs.

An example of image-based medical conversation from Table 2 of the paper

Features and contributions
#

The main features and contributions can be summarised as follows:

  • A large, diverse dataset of medical figure-caption pairs.
  • Open-ended instruction-following data generated with GPT-4.
  • Two-stage training: biomedical concept alignment followed by end-to-end instruction tuning.
  • Affordable development costs and an approach that can transfer to other domains.
  • Low-cost serving, with inference possible on consumer GPUs.

Biomedical visual instruction-following data
#

The two training stages require different datasets. The source is PMC-15M, a collection of 15 million image-text pairs extracted from PubMed Central. Each pair contains an image and its corresponding caption.

For stage 1, the authors randomly sample 600,000 pairs to help align visual and language representations with biomedical concepts. They call this biomedical concept alignment data. Training uses single-turn instructions, as illustrated below.

Single-turn instructions used for biomedical concept alignment

Here, X_q denotes the question, X_v the image, and X_c its caption. The model describes the image using either a brief description or a detailed description.

For stage 2, the authors sample 60,000 pairs and prepare multi-turn conversations. The images cover five modalities: chest X-rays, CT, MRI, histopathology, and gross pathology. Because the source dataset does not include multi-turn image-based conversations, GPT-4 generates them from the captions.

Crucially, GPT-4 did not see the images in this process. It received captions and prompts asking it to respond as though it could see the image, generating two or three turns of questions and answers from a visual perspective. Figure 4 illustrates this procedure. The resulting dataset is called biomedical instruction-tuning data.

Generation of multi-turn conversations with GPT-4, from Figure 4

Training approach
#

Training has two stages. Biomedical concept alignment runs for one epoch, followed by three epochs of end-to-end instruction tuning, as shown in Figure 3. Additional fine-tuning can then be performed for downstream tasks.

The two-stage training approach, from Figure 3

The approach does not depend on a special architectural trick and can be applied to other vision-language architectures. In stage 1, the model predicts image captions while the image encoder and language model remain frozen. Only the projection matrix after the image encoder is updated, with the aim of aligning visual concepts with word embeddings.

In stage 2, the language model also participates in training using the GPT-4-generated multi-turn conversations. The authors report strong zero-shot performance on some visual question answering (VQA) datasets after this stage.

Experimental results
#

The authors evaluate the medical chatbot in two ways. First, they construct a validation set of 193 questions, including conversations and detailed image descriptions, and use GPT-4 to score the responses. Table 1 compares LLaVA-Med with LLaVA, a model trained only on stage 1, and models trained with different amounts of data. Even with 10,000 examples, LLaVA-Med outperforms LLaVA in this evaluation, and additional data further improves performance.

Comparison on the medical conversation evaluation, from Table 1

The second evaluation uses three medical VQA datasets:

  • VQA-RAD: 315 radiology images and 3,515 question-answer pairs generated by clinicians.
  • SLAKE (Semantically-Labeled Knowledge-Enhanced dataset for medical VQA): 642 radiology images and more than 7,000 question-answer pairs created by experienced physicians.
  • PathVQA: 4,998 pathology images and 32,799 question-answer pairs.

Questions are divided into open-ended and closed-ended categories. Open-ended answers are evaluated by the proportion of ground-truth tokens appearing in the generated answer; closed-ended answers are evaluated using accuracy. Table 3 shows promising results for LLaVA-Med in both categories.

Results on medical VQA datasets, from Table 3

Together with the paper’s ablation studies, these experiments suggest two main points:

  • Longer stage 1 training improves zero-shot transfer, but stage 1 alone is insufficient.
  • Instruction-following data is crucial for stage 2.

An additional case study
#

Although the training conversations use only English, the model demonstrates an ability to answer Chinese questions in the example shown in Table 6. The authors speculate that LLaMA may already have acquired some multilingual knowledge, making this transfer possible. Other existing models may not transfer to a different language as successfully in a zero-shot setting.

A Chinese-language medical conversation, from Table 6

Conclusion
#

  • LLaVA-Med is a large vision-language model focused on biomedicine.
  • GPT-4 is used to create medical visual instruction-following data. After further fine-tuning, LLaVA-Med surpasses other models on some evaluation metrics.
  • It still exhibits familiar limitations of large language models, including hallucinations and limited deep reasoning.

References
#

  1. Li, Chunyuan, Cliff Wong, Sheng Zhang, Naoto Usuyama, Haotian Liu, Jianwei Yang, Tristan Naumann, Hoifung Poon, and Jianfeng Gao. “LLaVA-Med: Training a large language-and-vision assistant for biomedicine in one day.” arXiv preprint arXiv:2306.00890 (2023).
  2. Microsoft LLaVA-Med repository