Skip to content

feat: add MultihopSpatial task#1402

Merged
kcz358 merged 1 commit into
EvolvingLMMs-Lab:mainfrom
youngwanLEE:add-multihopspatial-task
Jul 21, 2026
Merged

feat: add MultihopSpatial task#1402
kcz358 merged 1 commit into
EvolvingLMMs-Lab:mainfrom
youngwanLEE:add-multihopspatial-task

Conversation

@youngwanLEE

@youngwanLEE youngwanLEE commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add MultihopSpatial (ECCV'26), a benchmark for multi-hop compositional spatial reasoning with visual grounding (4,500 test samples, 1–3 hops, ego/exo viewpoints).
  • Each sample requires both a correct multiple-choice answer and a bounding box, exposing the "lucky guess" gap where MCQ accuracy is high but grounding is poor.
  • Reports mcq_acc, avg_iou (over MCQ-correct samples), and acc@50iou (both MCQ-correct and IoU ≥ 0.5).

In scope

  • New task under lmms_eval/tasks/multihopspatial/ (multihopspatial.yaml, utils.py).
  • One line in docs/advanced/current_tasks.md under "7. Spatial & Grounding Tasks".
  • Loads from the HF Hub dataset etri-vilab/MultihopSpatial (benchmark config, image-embedded parquet).

Out of scope

  • No changes to any existing task, model, or shared utility.
  • No new dependencies.

Validation

  • python -m lmms_eval --model vllm --model_args model=etri-vilab/MultiHopSpatial-Qwen3-VL-4B-Instruct --tasks multihopspatial --batch_size 128 | sample size: N=4500 | key metrics: mcq_acc=63.87, acc50iou=50.76, avg_iou=68.95 | result: pass
  • python -m lmms_eval --model vllm --model_args model=Qwen/Qwen3-VL-4B-Instruct --tasks multihopspatial --batch_size 128 | sample size: N=4500 | key metrics: mcq_acc=37.91, acc50iou=25.87, avg_iou=61.34 | result: pass
  • Also verified with the qwen3_vl (transformers) backend; black --line-length 240 and isort pass.

Risk / Compatibility

  • No breaking changes; purely additive (new task + one doc line).

Type of Change

  • Bug fix (non-breaking change)
  • New feature
  • New benchmark/task
  • New model integration
  • Breaking change
  • Documentation update
  • Refactoring (no functional changes)

Uniform evaluation protocol

A single prompt is used for every model, asking for a normalized-0–1 xyxy box as {"bbox_2d": [...]}. To keep comparison fair, the parser normalizes coordinate scale uniformly (a 0–1000 output is divided by 1000), so no model is disadvantaged by its native scale; axis order is taken as xyxy as prompted (no per-model accommodation).

Copilot AI review requested due to automatic review settings July 21, 2026 00:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the new MultihopSpatial benchmark task to lmms_eval, enabling evaluation of multi-hop spatial reasoning with both multiple-choice answering and bounding-box grounding metrics.

Changes:

  • Introduces multihopspatial task configuration (HF dataset wiring + metric definitions).
  • Adds task-specific prompting, MCQ parsing, bbox parsing, IoU scoring, and metric aggregation utilities.
  • Updates the “Spatial & Grounding Tasks” docs list to include MultihopSpatial.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
lmms_eval/tasks/multihopspatial/utils.py Implements prompt formatting, prediction parsing (MCQ + bbox), IoU computation, and metric aggregation for the task.
lmms_eval/tasks/multihopspatial/multihopspatial.yaml Registers the task against the HF dataset and hooks the task utilities + metrics into lmms-eval.
docs/advanced/current_tasks.md Adds MultihopSpatial to the documented list of spatial/grounding tasks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +110 to +126
m = re.search(
r'"bbox_2d"\s*:\s*\[\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\]',
response_text,
)
if m is None:
m = re.search(
r"Bounding Box:\s*\[\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\]",
response_text,
re.IGNORECASE,
)
if m is not None:
bbox = [float(m.group(i)) for i in range(1, 5)]
else:
found = re.findall(r"\[\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\]", response_text)
if found:
bbox = [float(v) for v in found[0]]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed. The coordinate regex is now a well-formed float pattern (\d*\.?\d+) and the float() conversion is wrapped in try/except, so malformed model output (e.g. 1.2.3, ..) returns None instead of raising. Normal parsing (including 0-1000 auto-rescale and shorthand decimals like .5) is unchanged, so the reported numbers are unaffected.

Comment on lines +178 to +180
if union <= 0:
return 0.0
return round(inter / union, 4)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept intentionally. The 4-decimal rounding mirrors the reference implementation these reported numbers were produced with, so the task reproduces the paper's Acc@50IoU / Avg IoU exactly. Dropping it would make the lmms-eval numbers diverge slightly from the published ones. The borderline-flip case requires an IoU in [0.49995, 0.5), which is negligible in practice, so I've left it as-is for reproducibility.

MultihopSpatial evaluates multi-hop compositional spatial reasoning with
visual grounding. Each sample is a multiple-choice question paired with a
bounding box that localizes the answer, so a model must both pick the correct
choice and localize it - exposing the "lucky guess" gap where MCQ accuracy is
high but grounding is poor.

Metrics: mcq_acc, avg_iou (over MCQ-correct samples), and acc50iou (both
MCQ-correct and IoU >= 0.5). A single prompt is used for every model, asking
for a normalized-0-1 xyxy box; the parser normalizes 0-1000 outputs uniformly
so no model is disadvantaged by its native coordinate scale.

Dataset: https://huggingface.co/datasets/etri-vilab/MultihopSpatial
@youngwanLEE
youngwanLEE force-pushed the add-multihopspatial-task branch from d023388 to 780da78 Compare July 21, 2026 00:22
@kcz358
kcz358 merged commit 3dd17ca into EvolvingLMMs-Lab:main Jul 21, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants