dataset: add Mars-VL-Pairs bidirectional retrieval - #5148
dataset: add Mars-VL-Pairs bidirectional retrieval#5148tommasocerruti wants to merge 10 commits into
Conversation
| query_ids = [f"query-{key}" for key in keys] | ||
| corpus_ids = [f"corpus-{key}" for key in keys] |
There was a problem hiding this comment.
You can keep query and corpus without prefixes to simplify a bit
| is_beta=True, | ||
| ) | ||
| k_values = (1, 3, 5, 10, 20, 100, 1000, _FROZEN_PAIRS) | ||
| _top_k = _FROZEN_PAIRS |
There was a problem hiding this comment.
| _top_k = _FROZEN_PAIRS |
There was a problem hiding this comment.
We need this to rank the full gallery, as the official benchmark does, without it, MTEB only retrieves the top 1,000 results.
| }, | ||
| is_beta=True, | ||
| ) | ||
| k_values = (1, 3, 5, 10, 20, 100, 1000, _FROZEN_PAIRS) |
There was a problem hiding this comment.
| k_values = (1, 3, 5, 10, 20, 100, 1000, _FROZEN_PAIRS) | |
| k_values = (1, 3, 5, 10, 20, 100, 1000) |
I don't think it would be useful, because it will always output 1
There was a problem hiding this comment.
True for recall, but MRR@2247 is not always 1, since it depends on the correct match’s rank. I’ll compute full-gallery MRR separately so we don’t generate unnecessary metrics at 2247
There was a problem hiding this comment.
Pull request overview
Adds Mars-VL-Pairs as a new bidirectional (text↔image) Any2Any retrieval benchmark in MTEB/MOEB, backed by a frozen Hugging Face dataset revision and accompanied by a construction/audit script plus basic task-level tests and descriptive stats.
Changes:
- Introduces
MarsVLPairsT2IRetrievalandMarsVLPairsI2TRetrievalwith a full-gallery MRR main score (mrr_at_2247) derived from a shared frozen pair table. - Adds a dataset-freezing/auditing pipeline (
scripts/data/mars_vl_pairs/create_data.py) and documentation for reproducing the frozen dataset build. - Registers tasks, adds unit tests, and commits descriptive statistics JSONs for both directions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_tasks/test_mars_vl_pairs.py | Adds unit tests to verify shared IDs/qrels and the full-gallery MRR scoring hook. |
| scripts/data/mars_vl_pairs/README.md | Documents how to construct, audit, and push the frozen Mars-VL-Pairs dataset. |
| scripts/data/mars_vl_pairs/create_data.py | Implements the auditing, recovery, validation, and freeze-to-HF workflow for image bytes + provenance. |
| mteb/tasks/retrieval/eng/mars_vl_pairs.py | Adds the two new retrieval tasks and shared loader/scoring logic. |
| mteb/tasks/retrieval/eng/init.py | Exports/registers the new tasks in the English retrieval task set. |
| mteb/descriptive_stats/Image/Any2AnyRetrieval/MarsVLPairsT2IRetrieval.json | Adds descriptive statistics for the T→I task split. |
| mteb/descriptive_stats/Image/Any2AnyRetrieval/MarsVLPairsI2TRetrieval.json | Adds descriptive statistics for the I→T task split. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| full_gallery_mrr = mrr(qrels, results, (_FROZEN_PAIRS,))[f"MRR@{_FROZEN_PAIRS}"] | ||
| return {f"mrr_at_{_FROZEN_PAIRS}": fmean(full_gallery_mrr)} |
There was a problem hiding this comment.
Won't mrr automatically compute across all top_k values?
There was a problem hiding this comment.
top_k controls how many results are retrieved, while k_values controls which MRR scores are calculated. Since k_values stops at 1000, we need to calculate MRR@2247 separately.
There was a problem hiding this comment.
You can just set k_values to include _FROZEN_PAIRS and this also would solve #5148 (comment)
There was a problem hiding this comment.
That would remove the need for the separate MRR calculation, but _top_k is inherited from the base class as 1000 and isn’t recalculated when a task overrides k_values, so only 1000 results would still be retrieved. We would therefore still need _top_k = 2247 and it would also bring back recall_at_2247 = 1 which I removed based on your earlier feedback
There was a problem hiding this comment.
If this is metric from paper, then better to use it
There was a problem hiding this comment.
Agree, done.
|
|
||
|
|
||
| class _MarsVLPairsRetrieval(AbsTaskRetrieval): | ||
| _top_k = _FROZEN_PAIRS |
There was a problem hiding this comment.
You shoudn't change private values
There was a problem hiding this comment.
Got it. The official benchmark computes MRR over all 2247 candidates, and MTEB only retrieves 1000 by default, so matches below rank 1000 would be missing, making the score differ from the official protocol. I used _top_k because the current retrieval task API doesn't expose a public way to change this limit. So I see two options:
- Keep
_top_k = 2247to follow the official protocol. - Use MRR@1000, following MTEB’s default but differing from the paper.
Would you prefer the second option, or is there another supported way to request full-gallery retrieval?
There was a problem hiding this comment.
Can you remove _top_k = _FROZEN_PAIRS? Also would be easier to just add k_values explicitly to classes, rather than inherit from other class
There was a problem hiding this comment.
These two requests conflict with the current API: reproducing the paper requires ranking all 2,247 candidates, but removing _top_k = 2247 makes MTEB retrieve only 1,000. In that case, mrr_at_2247 would not reproduce the paper’s metric. I moved k_values into both classes, but kept _top_k = 2247 for correctness. Is there another supported way to request all 2,247 results?
|
@Samoed It overwrites the existing |
|
I run and got these results
Can you investigate score difference? |
# Conflicts: # mteb/abstasks/retrieval.py
Summary
Adds
MarsVLPairsT2IRetrievalandMarsVLPairsI2TRetrieval, bidirectional scientific-caption↔Mars-image retrieval. It fills a MOEB gap: MTEB has no planetary-science retrieval task.Data and metrics
Uses expert-validated
refined_captionfromSUSTech/Mars-VL-Pairs@1cac8885e481256d3752ad0d3a0f8f9681c5f206. Frozen data:Cerru02/Mars-VL-Pairs-MTEB@f0084ab0ba2f584b15dc72a82502b38ee490f58d.Recovered 2,249/2,287 images: 2,203 direct, 1 HTTPS, 42 Wayback, and 3 Wikimedia; 38 were unavailable. Removed the lower-resolution item from two resize-equivalent pairs, leaving 2,247 unique one-to-one pairs with provenance. The source declares CC-BY-4.0; external-image rights may vary.
Both tasks rank the full gallery with main score
mrr_at_2247.Results (%)
The paper reports Qwen T→I 16.97/33.45/22.55/62 and I→T 15.96/33.71/22.24/47 on all 2,287 pairs. Our 2,247-pair run uses MTEB prompts, so it is metric-equivalent, not an exact protocol reproduction.
Dataset checklist
mtebpackage.Qwen/Qwen3-VL-Embedding-2B(multimodal substitute for the text-only suggestion).Validation
6,724 practical tests, Ruff, typos, mypy, media decoding, ID/qrel integrity, and descriptive-stat checks pass.
Closes #4955
Related to #4842