docs: add VLMEvalKit evaluation guide, input conditions, reproducibility notes

#2
Files changed (1) hide show
  1. README.md +129 -4
README.md CHANGED
@@ -32,16 +32,115 @@ Items are built from open-access PubMed Central case reports. Imaging findings
32
  are withheld from the question context, so a model that ignores the image cannot
33
  recover the answer from the text alone.
34
 
 
 
 
 
35
  ## Files
36
 
37
- | File | Task | Items |
38
- |---|---|---|
39
- | `diagnosis/diagnosis_opened.tsv` | T1 forward diagnosis, ranked differential | 300 |
40
- | `evidence_verification/evidence_verification_opened_FULL609.tsv` | T2 evidence verification, open-ended | 608 |
41
 
42
  Images are embedded in the `image` column as a JSON list of base64 strings, so
43
  the files are self-contained.
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ## Reading the files
46
 
47
  Use a CSV parser with quoting enabled. Do not split on newlines: most records
@@ -55,6 +154,32 @@ t2 = pd.read_csv('evidence_verification/evidence_verification_opened_FULL609.tsv
55
  sep='\t', dtype=str) # 608 rows
56
  ```
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  ## Notes
59
 
60
  **Not for clinical use.** A score here is not evidence of clinical safety or
 
32
  are withheld from the question context, so a model that ignores the image cannot
33
  recover the answer from the text alone.
34
 
35
+ > MRareBench is a separate benchmark from `junzhin/MMrarebench`. The two differ
36
+ > in tracks, item counts, and evaluation protocol. Scores are not comparable
37
+ > across them.
38
+
39
  ## Files
40
 
41
+ | File | Task | Items | Columns |
42
+ |---|---|---:|---:|
43
+ | `diagnosis/diagnosis_opened.tsv` | T1, forward diagnosis, ranked differential | 300 | 9 |
44
+ | `evidence_verification/evidence_verification_opened_FULL609.tsv` | T2, evidence verification, open-ended | 608 | 14 |
45
 
46
  Images are embedded in the `image` column as a JSON list of base64 strings, so
47
  the files are self-contained.
48
 
49
+ ## Input conditions
50
+
51
+ Each track is evaluated under several input conditions. A condition changes only
52
+ what the model is shown. The items, the reference answers, and the scoring code
53
+ are identical across conditions within a track, so comparing two conditions
54
+ isolates one source of performance.
55
+
56
+ **T1, diagnosis**
57
+
58
+ | Dataset name | Imaging findings text | Image |
59
+ |---|---|---|
60
+ | `MRareBench_Diagnosis` | withheld | shown |
61
+ | `MRareBench_Diagnosis_FD` | disclosed | shown |
62
+ | `MRareBench_Diagnosis_TO` | withheld | withheld |
63
+
64
+ **T2, evidence verification**
65
+
66
+ | Dataset name | Diagnosis given | Image |
67
+ |---|---|---|
68
+ | `MRareBench_EvidenceVerif` | yes | shown |
69
+ | `MRareBench_EvidenceVerif_TO` | yes | withheld |
70
+ | `MRareBench_EvidenceVerif_NoDx` | no | shown |
71
+
72
+ Three contrasts follow from these conditions:
73
+
74
+ - `Δ_sub = FD − LC` measures how much of the answer the withheld findings text
75
+ would have supplied. A large value indicates textual leakage.
76
+ - `Δ_vis = LC − TO` measures how much the image itself contributes.
77
+ - `Δ_grd = Img − Txt` measures grounding on T2, the gap between reporting
78
+ evidence with the image and reporting it without.
79
+
80
+ Contrast metrics are more stable than absolute scores across reruns. Run-to-run
81
+ drift is largely common-mode and cancels in the difference.
82
+
83
+ ## Evaluation with VLMEvalKit
84
+
85
+ MRareBench ships as a dataset module for
86
+ [VLMEvalKit](https://github.com/open-compass/VLMEvalKit). The module implements
87
+ prompt construction, deterministic scoring, and the LLM-judge rubric for both
88
+ tracks. This repository holds the data only. The evaluation code lives in
89
+ VLMEvalKit, which keeps a single source of truth for scoring.
90
+
91
+ The upstream integration is under review. Until it lands, install from the fork
92
+ that carries the module:
93
+
94
+ ```bash
95
+ git clone https://github.com/junzhin/VLMEvalKit_official.git VLMEvalKit
96
+ cd VLMEvalKit && pip install -e .
97
+ ```
98
+
99
+ ### Running
100
+
101
+ The module resolves data local-first. Point `LMUData` at a directory that
102
+ already holds the files under `MRareBench/`, and nothing is downloaded:
103
+
104
+ ```
105
+ $LMUData/MRareBench/diagnosis/diagnosis_opened.tsv
106
+ $LMUData/MRareBench/evidence_verification/evidence_verification_opened_FULL609.tsv
107
+ ```
108
+
109
+ Point `LMUData` at an empty directory instead, and the module fetches the same
110
+ two files from this repository on first use.
111
+
112
+ ```bash
113
+ export LMUData=/path/to/LMUData
114
+ export OPENAI_API_KEY=... # used by the judge, and by API-served models
115
+
116
+ python run.py --data MRareBench_Diagnosis --model <model> --judge gpt-5.4-mini --mode all
117
+ python run.py --data MRareBench_EvidenceVerif --model <model> --judge gpt-5.4-mini --mode all
118
+ ```
119
+
120
+ Substitute any of the six dataset names above for `--data`. All names within a
121
+ track read the same TSV, so switching conditions costs no extra download.
122
+
123
+ Omitting `--judge` runs inference and the judge-free metrics only. On T1 that
124
+ still yields the headline Recall and rank metrics, which are computed by matching
125
+ against the reference diagnosis and its aliases. On T2 it yields the
126
+ deterministic `det_*` metrics but not the rubric score.
127
+
128
+ To resume an interrupted run, add `--reuse --reuse-aux all`. Per-item results are
129
+ checkpointed, so completed items are skipped rather than re-inferred.
130
+
131
+ ### What is scored
132
+
133
+ **T1** is judge-free at its core. The model returns a ranked list of ten
134
+ diagnoses. Scoring reports `recall@{1,3,5,10}`, `MRR`, and `MR`, the mean rank of
135
+ the first hit. An optional judge adds complementary per-dimension scores.
136
+
137
+ **T2** asks the model to report the evidence visible in the images. The headline
138
+ metric `t2_hierarchical_required_recall` comes from an LLM judge that marks each
139
+ required evidence point as present or absent, then gates cross-image and
140
+ diagnostic credit on the visual level below it. A parallel family of `det_*`
141
+ metrics scores the same predictions without a judge, by lexical and embedding
142
+ overlap against the reference rationale.
143
+
144
  ## Reading the files
145
 
146
  Use a CSV parser with quoting enabled. Do not split on newlines: most records
 
154
  sep='\t', dtype=str) # 608 rows
155
  ```
156
 
157
+ Decoding an image:
158
+
159
+ ```python
160
+ import base64, io, json
161
+ from PIL import Image
162
+
163
+ images = json.loads(t1.iloc[0]['image'])
164
+ img = Image.open(io.BytesIO(base64.b64decode(images[0])))
165
+ ```
166
+
167
+ ## Reproducibility notes
168
+
169
+ **Check the inference failure rate before reading any score.** Requests that
170
+ carry images occasionally fail at the API layer, and a failed request is recorded
171
+ as a wrong answer. In our runs the rate stayed near 1% and appeared only in
172
+ image-bearing conditions; the text-only conditions had none. The failures
173
+ concentrate on a fixed handful of multi-image items whose payloads are large.
174
+ Inspect `infer_fail_rate` in the result summary. A non-zero value calls for a
175
+ rerun with `--reuse --reuse-aux all` to fill the gaps.
176
+
177
+ **`temperature=0` does not give bit-identical reruns.** The nondeterminism sits
178
+ on the serving side: batching boundaries, nondeterministic kernels, MoE routing,
179
+ and silent model-snapshot updates. Absolute scores drift by one to three points
180
+ between runs of the same model. The contrast metrics drift less, because the
181
+ same shift enters both terms and cancels.
182
+
183
  ## Notes
184
 
185
  **Not for clinical use.** A score here is not evidence of clinical safety or