MRareBench / README.md
junzhin's picture
docs: add VLMEvalKit evaluation guide, input conditions, reproducibility notes (#2)
f592aef
|
Raw
History Blame Contribute Delete
7.08 kB
---
license: cc-by-nc-4.0
task_categories:
- visual-question-answering
language:
- en
tags:
- medical
- rare-disease
- multimodal
- benchmark
size_categories:
- n<1K
configs:
- config_name: T1_diagnosis
data_files:
- split: train
path: diagnosis/diagnosis_opened.tsv
sep: "\t"
- config_name: T2_evidence_verification
data_files:
- split: train
path: evidence_verification/evidence_verification_opened_FULL609.tsv
sep: "\t"
---
# MRareBench: A Multimodal Rare-Disease Benchmark for Evidence–Diagnosis Correspondence
Benchmark data accompanying the paper, released for review.
Items are built from open-access PubMed Central case reports. Imaging findings
are withheld from the question context, so a model that ignores the image cannot
recover the answer from the text alone.
> MRareBench is a separate benchmark from `junzhin/MMrarebench`. The two differ
> in tracks, item counts, and evaluation protocol. Scores are not comparable
> across them.
## Files
| File | Task | Items | Columns |
|---|---|---:|---:|
| `diagnosis/diagnosis_opened.tsv` | T1, forward diagnosis, ranked differential | 300 | 9 |
| `evidence_verification/evidence_verification_opened_FULL609.tsv` | T2, evidence verification, open-ended | 608 | 14 |
Images are embedded in the `image` column as a JSON list of base64 strings, so
the files are self-contained.
## Input conditions
Each track is evaluated under several input conditions. A condition changes only
what the model is shown. The items, the reference answers, and the scoring code
are identical across conditions within a track, so comparing two conditions
isolates one source of performance.
**T1, diagnosis**
| Dataset name | Imaging findings text | Image |
|---|---|---|
| `MRareBench_Diagnosis` | withheld | shown |
| `MRareBench_Diagnosis_FD` | disclosed | shown |
| `MRareBench_Diagnosis_TO` | withheld | withheld |
**T2, evidence verification**
| Dataset name | Diagnosis given | Image |
|---|---|---|
| `MRareBench_EvidenceVerif` | yes | shown |
| `MRareBench_EvidenceVerif_TO` | yes | withheld |
| `MRareBench_EvidenceVerif_NoDx` | no | shown |
Three contrasts follow from these conditions:
- `Δ_sub = FD − LC` measures how much of the answer the withheld findings text
would have supplied. A large value indicates textual leakage.
- `Δ_vis = LC − TO` measures how much the image itself contributes.
- `Δ_grd = Img − Txt` measures grounding on T2, the gap between reporting
evidence with the image and reporting it without.
Contrast metrics are more stable than absolute scores across reruns. Run-to-run
drift is largely common-mode and cancels in the difference.
## Evaluation with VLMEvalKit
MRareBench ships as a dataset module for
[VLMEvalKit](https://github.com/open-compass/VLMEvalKit). The module implements
prompt construction, deterministic scoring, and the LLM-judge rubric for both
tracks. This repository holds the data only. The evaluation code lives in
VLMEvalKit, which keeps a single source of truth for scoring.
The upstream integration is under review. Until it lands, install from the fork
that carries the module:
```bash
git clone https://github.com/junzhin/VLMEvalKit_official.git VLMEvalKit
cd VLMEvalKit && pip install -e .
```
### Running
The module resolves data local-first. Point `LMUData` at a directory that
already holds the files under `MRareBench/`, and nothing is downloaded:
```
$LMUData/MRareBench/diagnosis/diagnosis_opened.tsv
$LMUData/MRareBench/evidence_verification/evidence_verification_opened_FULL609.tsv
```
Point `LMUData` at an empty directory instead, and the module fetches the same
two files from this repository on first use.
```bash
export LMUData=/path/to/LMUData
export OPENAI_API_KEY=... # used by the judge, and by API-served models
python run.py --data MRareBench_Diagnosis --model <model> --judge gpt-5.4-mini --mode all
python run.py --data MRareBench_EvidenceVerif --model <model> --judge gpt-5.4-mini --mode all
```
Substitute any of the six dataset names above for `--data`. All names within a
track read the same TSV, so switching conditions costs no extra download.
Omitting `--judge` runs inference and the judge-free metrics only. On T1 that
still yields the headline Recall and rank metrics, which are computed by matching
against the reference diagnosis and its aliases. On T2 it yields the
deterministic `det_*` metrics but not the rubric score.
To resume an interrupted run, add `--reuse --reuse-aux all`. Per-item results are
checkpointed, so completed items are skipped rather than re-inferred.
### What is scored
**T1** is judge-free at its core. The model returns a ranked list of ten
diagnoses. Scoring reports `recall@{1,3,5,10}`, `MRR`, and `MR`, the mean rank of
the first hit. An optional judge adds complementary per-dimension scores.
**T2** asks the model to report the evidence visible in the images. The headline
metric `t2_hierarchical_required_recall` comes from an LLM judge that marks each
required evidence point as present or absent, then gates cross-image and
diagnostic credit on the visual level below it. A parallel family of `det_*`
metrics scores the same predictions without a judge, by lexical and embedding
overlap against the reference rationale.
## Reading the files
Use a CSV parser with quoting enabled. Do not split on newlines: most records
contain newline characters inside their text fields, so the physical line count
far exceeds the record count.
```python
import pandas as pd
t1 = pd.read_csv('diagnosis/diagnosis_opened.tsv', sep='\t', dtype=str) # 300 rows
t2 = pd.read_csv('evidence_verification/evidence_verification_opened_FULL609.tsv',
sep='\t', dtype=str) # 608 rows
```
Decoding an image:
```python
import base64, io, json
from PIL import Image
images = json.loads(t1.iloc[0]['image'])
img = Image.open(io.BytesIO(base64.b64decode(images[0])))
```
## Reproducibility notes
**Check the inference failure rate before reading any score.** Requests that
carry images occasionally fail at the API layer, and a failed request is recorded
as a wrong answer. In our runs the rate stayed near 1% and appeared only in
image-bearing conditions; the text-only conditions had none. The failures
concentrate on a fixed handful of multi-image items whose payloads are large.
Inspect `infer_fail_rate` in the result summary. A non-zero value calls for a
rerun with `--reuse --reuse-aux all` to fill the gaps.
**`temperature=0` does not give bit-identical reruns.** The nondeterminism sits
on the serving side: batching boundaries, nondeterministic kernels, MoE routing,
and silent model-snapshot updates. Absolute scores drift by one to three points
between runs of the same model. The contrast metrics drift less, because the
same shift enters both terms and cancels.
## Notes
**Not for clinical use.** A score here is not evidence of clinical safety or
diagnostic validity.
Source articles are open access and carry their own per-article licenses.