A dataset of clinically similar image pairs from citation-linked case reports for medical image retrieval
Authors: Guy Shmueli, Keno K. Bressem, Tom Hope
Organizations: School of Computer Science and Engineering, The Hebrew University of Jerusalem, Jerusalem, Israel · National Center for Tumor Diseases West, Essen, Germany · Institute of Artificial Intelligence in Medicine, University Hospital Essen, Essen, Germany · Department of Diagnostic and Interventional Radiology, School of Medicine and Health, Technical University of Munich, Munich, Germany · Department of Diagnostic and Interventional Radiology and Neuroradiology, University Hospital Essen, Essen, Germany · Allen Institute for AI, Seattle, WA, USA
Retrieving images of patients clinically similar to a given patient can support diagnosis, teaching and research. Training and evaluating retrieval systems requires knowing which images of different patients show the same finding, and existing datasets are small or narrow in scope. We construct PMC-PaIR, a dataset of 86,144 pairs of clinically similar images from 56,013 open-access PubMed Central case reports, which often document rare or challenging presentations. We develop an approach that follows citations, which often link case reports of similar patients. To determine what two linked cases share clinically, it prompts large language models to generate and answer hierarchical questions, from modality to diagnosis and findings, and to match images by caption using the answers. Experts find the pairs highly accurate, and this question-guided approach finds twice as many correct pairs as direct matching. Fine-tuning BiomedCLIP on PMC-PaIR improves retrieval in all modality, anatomy and diagnosis categories tested, for image-only queries and image queries with a short text naming the finding. We release the dataset and the automated pipeline, which can extend PMC-PaIR as new case reports are published.
Figures & tables
Fig. 1: Construction of PMC-PaIR and the two retrieval tasks. Cases whose source articles are linked by a citation form case pairs (left), of which 122,365 were annotated. For each case pair, language models that read only text (1) state why report A cites report B, (2) ask comparative questions that move from imaging modality and organ system to diagnosis and specific findings, (3) answer them from the case descriptions and (4) match images whose captions describe the same modality, anatomy and type of abnormality, recording descriptors of what they share. After post-processing, 86,144 image pairs remained (right). In the two retrieval tasks (bottom), abbreviated i2i and (i+t)2i, each test image serves as a query, either alone or with the descriptions of its pairs, and the other test images, except those linked to it only indirectly, are ranked to retrieve the images paired with it. Models are listed in Table 1, and the prompts are given at the end of Methods. The example in steps 1–4 is the case pair 14 , 15 of Table 2, with abridged text and schematic images. The retrieval example is the query of Fig. 2, with images reproduced, cropped, from the source articles of the query, its positive and the other test images shown, 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 under the licenses given in the legend of Fig. 2. CT, computed tomography; MRI, magnetic resonance imaging.
Fig. 2: Example of image-only retrieval. a , Test query 5748087_1_2 , a CT image of a splenic artery aneurysm, and its only positive, the single image paired with it in PMC-PaIR. The image-only (i2i) model does not use the pair description shown. b , c , The five highest-ranked candidates of pretrained BiomedCLIP ( b ) and of the fine-tuned i2i model ( c ), labeled with the finding they show. Fine-tuning moved the positive, marked in c , from rank 29 to rank 1 among 7,844 candidates. The query was chosen for illustration. Images are reproduced, some cropped, from the source articles of the query, 16 the positive 17 and the candidates showing an adrenal pheochromocytoma, 18 a splenic laceration, 19 a gastric tumor, 20 an accessory spleen, 21 an aortic thrombus 22 and a contained aortic rupture, 23 under the Creative Commons Attribution 4.0 license ( https://creativecommons.org/licenses/by/4.0/ ), except the last, which is reproduced under the Creative Commons Attribution 3.0 license ( https://creativecommons.org/licenses/by/3.0/ ). CT, computed tomography.
Processing step
Count
Selected cases
138,103
Candidate case pairs
159,388
Excluded: full-text XML or figure files unavailable
2,669
Excluded: a case had no retained captioned figure
31,969
Excluded: a case had no case description
353
Excluded: citation link not confirmed
2,032
Table 1: Inputs, outputs and models of the annotation. Counts are given after each processing step, and the exclusion rows give the case pairs removed by each selection criterion, applied in the order shown. All models are OpenAI models, and the reasoning-effort setting controls how much internal reasoning a model performs before answering.
Stage
Item
Content
Stage 4 input
Caption of 9899453_1_1 (case A)
T2-weighted and diffusion-weighted MRI findings of paraspinal and epidural abscesses, together with follow-up changes.
Caption of 4023003_1_3 (case B)
Contrast-enhanced T1-weighted MRI showing paraspinal collections with thick enhancing walls and extension into the spinal canal.
Stages 2 and 3
Level 1: modality and organ system
Was spinal MRI the key test identifying paraspinal muscle infection with epidural extension in both cases? Yes. MRI identified paraspinal muscle infection with contiguous epidural abscess extension in both cases.
Level 2: diagnostic category
Are both cases classified as pediatric paraspinal muscle infection complicated by spinal epidural abscess? Yes. Both describe a pediatric muscle abscess complicated by spinal epidural abscess.
Level 3: specific findings
Did both cases show MRI findings supporting an abscess rather than diffuse cellulitis alone? Yes. Case A shows diffusion-weighted epidural/posterior spinal canal findings consistent with an abscess. Case B shows intramuscular fluid collections with thick enhancing walls.
Stage 4 output
pair_id
9899453_1_1 , 4023003_1_3
Table 2: Inputs and outputs of citation-guided hierarchical image-pair annotation (CHIPA) for one case pair. Case A 14 and case B 15 describe children with paraspinal muscle infection complicated by spinal epidural abscess. One of the questions generated at each level is shown with its answer. Captions are paraphrased, and descriptors are reproduced from the model output. The image-level labels of 9899453_1_1 are derived from its three positive pairs, all of which have the descriptors shown. MRI, magnetic resonance imaging.
Fig. 3: Partitioning by article groups. a , Positive pairs link images, each tagged with the number of its source article, into connected components. Because images C and D come from the same source article (article 1) but lie in different components, their components are merged into one article group without adding a pair. b , Whole article groups are assigned to the training, validation and test partitions in proportions of 80:10:10 by number of groups, so that no positive pair or source article spans two partitions. Images are schematic.
File
Format
Contents
image_pairs.json
JSON
86,144 positive pairs with shared modality, anatomy and diagnosis descriptors
image_labels.jsonl
JSONL
Modality, anatomy and diagnosis labels of 86,893 images
label_taxonomy.json
JSON
Label categories and mapping rules
case_pair_citations_eligible.json
JSON
Citation contexts and citation-intent analyses of 121,831 case pairs
case_pair_questions_answers_eligible.jsonl
JSONL
Generated questions and answers for 121,831 case pairs
images_captions_001.zip to images_captions_004.zip
ZIP
86,825 images (JPEG) and their captions (text)
Table 3: Files in the PMC-PaIR data record.
Measure
Category
Count (%)
Modality labels
CT
40,327 (46.4)
MRI
20,104 (23.1)
Radiography
13,459 (15.5)
Anatomy labels
Thorax/respiratory
12,851 (14.8)
Musculoskeletal
12,127 (14.0)
Vasculature
11,827 (13.6)
Table 4: Composition of PMC-PaIR. Percentages for labels and for positive pairs per image are relative to all 86,893 images, including the 68 whose files are withheld, and those for publication years to the 56,013 source articles. Label rows show the three most frequent categories of each field, with display names (for example, Mass/lesion for mass_or_lesion ). An image can carry several labels per field.
Top five candidates of the fine-tuned (i+t)2i model
17 randomly sampled CT test queries with heart or vasculature labels; 85 query–candidate pairs; one board-certified radiologist
Radiologist-rated Hit@5: modality 17/17 (100.0%; 80.5–100.0); anatomy 17/17 (100.0%; 80.5–100.0); diagnosis 12/17 (70.6%; 44.0–89.7); all three 11/17 (64.7%; 38.3–85.8)
Table 5: Summary of manual validation. Percentages are followed by exact 95% confidence intervals (CIs). Relative recall is the number of correct pairs a workflow proposed divided by the number of correct pairs proposed by either workflow. Radiologist-rated Hit@5 is the proportion of queries for which at least one of the five highest-ranked candidates matched the query in the stated attribute or attributes. (i+t)2i, image-plus-text retrieval.
Fig. 4: Manual review of image pairs and image-level labels. a , Consensus ratings of a medical physicist and a resident physician for 163 randomly sampled pairs. Modality, anatomy and diagnosis were rated separately, and the overall rating is No if any attribute is rated No and otherwise equals the diagnosis rating. b , Ratings of the labels of the 320 images in these pairs, with the overall rating derived in the same way. Bars and numbers give the percentage of pairs or images with each rating, and error bars give exact (Clopper–Pearson) 95% confidence intervals, computed separately for each rating.
Setting
i2i
(i+t)2i
Text input
None
Pair descriptions of up to 256 tokens
Trained parameters
Image encoder, with layer-wise learning-rate decay of 0.75
Text encoder and image encoder except blocks 1–8
Loss
InfoNCE, temperature 0.10
Image–image (weight 0.3) and image–text (weight 0.6) triplet-ranking losses, margin 0.09, over the mean score of up to four highest-scoring eligible negatives
Negatives
Eligible images in the batch
Images and descriptions in the batch; batches assembled with mined hard negatives
Augmentation
Crop jitter, brightness and contrast jitter, rotation of up to 5 ∘
Crop jitter
Batch size
128 anchor–positive pairs
128 image pairs
Table 6: Fine-tuning settings for the two retrieval tasks. i2i, image-only retrieval; (i+t)2i, image-plus-text retrieval. Both models use three 224×224 crops per image, the AdamW optimizer, bfloat16 mixed precision, gradient clipping at 1.5, and 200 warm-up steps followed by cosine learning-rate decay scheduled over the maximum number of epochs. Checkpoints were selected by validation Recall@10.
Configuration
Metric
Pretrained
Fine-tuned
Difference (95% CI)
i2i
Recall@10 (%)
14.62
20.15
5.53 (4.61 to 6.55)
Hit@10 (%)
21.47
28.31
6.84 (5.73 to 8.09)
MRR
0.111
0.143
0.033 (0.027 to 0.039)
Median rank
65
37
(i+t)2i
Recall@10 (%)
20.53
31.62
11.09 (9.89 to 12.38)
Hit@10 (%)
29.68
42.98
13.30 (12.07 to 14.66)
Table 7: Retrieval performance on the 8,096 test queries. i2i, image-only queries; (i+t)2i, image-plus-text queries. Hit@10 is the proportion of queries with at least one positive among the ten highest-ranked candidates, Recall@10 the mean fraction of positives found among them, MRR the mean reciprocal rank of the first positive and median rank the median rank of the first positive. Each fine-tuned model (training seed 42) is compared with pretrained BiomedCLIP queried in the same way. Differences are fine-tuned minus pretrained values, computed before rounding, with 95% confidence intervals (CIs) from a cluster bootstrap over test article groups.
Fig. 5: Change in Hit@10 with fine-tuning across label categories of the test queries. Hit@10 is the proportion of queries with at least one positive among the ten highest-ranked candidates. a , Image-only queries, i2i. b , Image-plus-text queries, (i+t)2i. For the queries that carry each label, points show the fine-tuned minus pretrained Hit@10, in percentage points, with 95% confidence intervals from 5,000 paired cluster-bootstrap resamples of article groups. The difference over all test queries is 6.84 percentage points for i2i and 13.30 for (i+t)2i. Columns on the left give the number of queries ( n ) and article groups in each category, and numbers on the right give Hit@10 (%) of the pretrained and fine-tuned models. Categories with at least 140 queries from at least 20 article groups are shown. A query can carry several labels per field, and intervals are not adjusted for multiple comparisons.