BioViL-T is a domain-specific vision-language model designed to analyze chest X-rays (CXRs) and radiology reports. It was trained using a temporal multi-modal pre-training procedure, which distinguishes it from its predecessor model (BioViL). In detail, BioViL-T takes advantage of the temporal structure between data points, resulting in improved downstream performance on multiple benchmarks, while using the same training dataset as its predecessor. In particular, the resultant model displays significant improvement in embedding temporal information present in the image and text modalities (see results), as well as in the joint space. The canonical model can be adapted to both single- and multi-image downstream applications including: natural language inference, phrase-grounding, image/text classification, and language decoding.
The corresponding BERT language model is trained in two stages: First, we pretrain CXR-BERT-general from a randomly initialized BERT model via Masked Language Modeling (MLM) on PubMed abstracts and clinical notes from the publicly-available MIMIC-III and MIMIC-CXR. The general model can be fine-tuned for research in other clinical domains by adjusting the parameters specific to the target domain. In the second stage, BioViL-T is continually pretrained from CXR-BERT-general using a multi-modal pre-training procedure by utilising radiology reports and sequences of chest X-rays. We utilise the latent representation of [CLS] token to align text and image embeddings.
| Model | Model identifier on openmind | Vocabulary | Note |
|---|---|---|---|
| CXR-BERT-general | microsoft/BiomedVLP-CXR-BERT-general | PubMed & MIMIC | Pretrained for biomedical literature and clinical domains |
| CXR-BERT-specialized | microsoft/BiomedVLP-CXR-BERT-specialized | PubMed & MIMIC | Static pretraining for the CXR domain |
| BioViL-T | microsoft/BiomedVLP-BioViL-T | PubMed & MIMIC | Static & temporal pretraining for the CXR domain |
The image model is jointly trained with the text model in a multi-modal contrastive learning framework. It's a hybrid image encoder composed of a Vision Transformer and ResNet-50, where the latter is used as backbone network to extract features from images at each time point. The transformer is included in the design to aggregate and compare image features extracted across the temporal dimension. The joint image and text model, namely BioViL-T, can be used in phrase grounding applications as shown in this python notebook example. Additionally, please check the MS-CXR benchmark for a more systematic evaluation of joint image and text models in phrase grounding tasks.
This model is intended to be used solely for (I) future research on visual-language processing and (II) reproducibility of the experimental results reported in the reference paper.
The primary intended use is to support AI researchers building on top of this work. CXR-BERT and its associated models should be helpful for exploring various clinical NLP & VLP research questions, especially in the radiology domain.
Any deployed use case of the model --- commercial or otherwise --- is currently out of scope. Although we evaluated the models using a broad set of publicly-available research benchmarks, the models and evaluations are not intended for deployed use cases. Under unprecedented conditions, the models may make inaccurate predictions and display limitations, which may require additional mitigation strategies. Therefore, we discourage use of the model for automated diagnosis or in a medical device. Please refer to the associated paper for more details.
Here is how to use this model to extract radiological sentence embeddings and obtain their cosine similarity in the joint space (image and text):
import argparse
import torch
from openmind import AutoModel, AutoTokenizer
device = "npu:0"
# Load the model and tokenizer
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--model_name_or_path",type=str,help="Path to model",default=None,)
args = parser.parse_args()
return args
args = parse_args()
model_path = args.model_name_or_path
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModel.from_pretrained(model_path, trust_remote_code=True).to(device)
# Input text prompts (e.g., reference, synonym, contradiction)
text_prompts = ["There is no pneumothorax or pleural effusion",
"No pleural effusion or pneumothorax is seen",
"The extent of the pleural effusion is constant."]
# Tokenize and compute the sentence embeddings
tokenizer_output = tokenizer.batch_encode_plus(batch_text_or_text_pairs=text_prompts,
add_special_tokens=True,
padding='longest',
return_tensors='pt').to(device)
embeddings = model.get_projected_text_embeddings(input_ids=tokenizer_output.input_ids,
attention_mask=tokenizer_output.attention_mask).to(device)
# Compute the cosine similarity of sentence embeddings obtained from input text prompts.
sim = torch.mm(embeddings, embeddings.t())
print(sim)
The presented model achieves state-of-the-art results in radiology natural language inference by leveraging semantics and discourse characteristics at training time more efficiently. The experiments were performed on the RadNLI and MS-CXR-T benchmarks, which measure the quality of text embeddings in terms of static and temporal semantics respectively. BioViL-T is benchmarked against other commonly used SOTA domain specific BERT models, including PubMedBERT and CXR-BERT. The results below show that BioViL-T has increased sensitivity of sentence embeddings to temporal content (MS-CXR-T) whilst better capturing the static content (RadNLI).
| MS-CXR-T | MS-CXR-T | RadNLI (2 classes) | RadNLI (2 classes) | |
|---|---|---|---|---|
| Accuracy | ROC-AUC | Accuracy | ROC-AUC | |
| PubMedBERT | 60.39 | .542 | 81.38 | .727 |
| CXR-BERT-General | 62.60 | .601 | 87.59 | .902 |
| CXR-BERT-Specialized | 78.12 | .837 | 89.66 | .932 |
| BioViL-T | 87.77 | .933 | 90.52 | .947 |
The novel pretraining framework yields also better vision-language representations. Below is the zero-shot phrase grounding performance obtained on the MS-CXR benchmark dataset, which evaluates the quality of image-text latent representations.
| Vision–Language Pretraining Method | MS-CXR Phrase Grounding (Avg. CNR Score) | MS-CXR Phrase Grounding (mIoU) |
|---|---|---|
| BioViL | 1.07 +- 0.04 | 0.229 +- 0.005 |
| BioViL-L | 1.21 +- 0.05 | 0.202 +- 0.010 |
| BioViL-T | 1.33 +- 0.04 | 0.240 +- 0.005 |
Additional experimental results and discussion can be found in the corresponding paper, "Learning to Exploit Temporal Structure for Biomedical Vision–Language Processing", CVPR'23.
This model was developed using English corpora, and thus can be considered English-only.
The training dataset contains only medical images and reports acquired from an intensive-care-unit (ICU), where longitudinal images are often collected within range of hours or at most few days. As a result, the models may show reduced performance in analyzing consecutive images acquired over longer periods of time (e.g. years) where significant anatomical variations are observed between the scans.
Please refer to the corresponding paper, "Learning to Exploit Temporal Structure for Biomedical Vision–Language Processing", CVPR'23 for additional details on the model training and evaluation.