Skip to content

Add Molmo2-4B image-QA + PixMo-Cap dense-caption eval support - #219

Merged
jason718 merged 4 commits into
visionfrom
royg/molmo2-imgqa-eval
Jun 23, 2026
Merged

jason718 merged 4 commits into
visionfrom
royg/molmo2-imgqa-eval

Conversation

@uwGZQ

@uwGZQ uwGZQ commented Jun 18, 2026 •

Copy link
Copy Markdown

Summary

Adds evaluation support for the released HF checkpoint allenai/Molmo2-4B in olmo-eval —
the 11 image-QA benchmarks (ChartQA, VQA2, DocVQA, InfoVQA, TextVQA, RealWorldQA, MMMU,
MathVista, CountBench, PixMo-Count, AI2D), PixMo-Cap dense captioning, and a separate
image-pointing family (PixMo-Points-Eval v3 + SACoGold) — aligned to the official
mm_olmo reference so the framework reproduces mm_olmo / the Molmo2 paper numbers on the same
weights. Draft: more launch/convenience scripts will follow in subsequent commits.

The model weights are identical to mm_olmo's, so this work targets only the eval pipeline
(load, precision, prompts, metrics).

Reproduction vs. Molmo2-4B (paper)

Real GPU runs of this branch against the Molmo2-4B line of the paper table. Reproduced
metrics come from each run's metrics.json primary metric (all values in %):

Benchmark (split) Metric Molmo2-4B (paper) This PR (repro)
AI2D (test) MC acc, transparent labels 95.6 95.69
ChartQA (test) relaxed acc 86.0 86.16
DocVQA (test) ANLS (RRC server) 87.8 92.4 †
InfoVQA (test) ANLS (RRC server) 78.6 78.4 †
TextVQA VQA score 85.0 84.93
VQA v2.0 (val) VQA score 86.6 85.88
RealWorldQA score 75.4 75.42
MMMU (val) score 50.9 50.89
MathVista (testmini) acc, gpt-4-0613 extraction 56.7 56.20
CountBench acc 93.9 94.08
PixMo-Count (test) acc 88.1 88.15

All directly-scored benchmarks land within ~0.7 pt of the paper. Notes:

Image-pointing family (vs. mm_olmo)

Point-in-mask scoring (f1, 0–1) reproduced against mm_olmo's own Molmo2-4B runs
(fp32 + bf16 autocast, max_crops=24):

Benchmark Primary metric mm_olmo This PR (repro)
PixMo-Points-Eval v3 (test) f1 0.8290 0.8314
SACoGold (test) weighted f1 0.6922 0.6909

All 18 SACoGold metrics (precision/recall/f1 × all/single/low/med/high-freq buckets + weighted
primaries) land within 0.0025 of mm_olmo.

Changes

  • HF multimodal provider (inference/providers/huggingface.py)
    • transformers-5 load shims for the Molmo2 remote code: strip the processor's
      optional-attribute kwargs, and recover a missing cache_position during generation
      (Molmo2's remote code targets transformers 4.57.x). Both are import-defensive and scoped
      to the model load — no effect on other models.
    • fp32 weights + bf16 autocast path (new autocast_dtype arg) to match mm_olmo's
      amp_bf16 numerics; defensively guarded so mocked-torch CPU tests stay green.
    • pickle-safe lazy HF-image decode (module-level fn + functools.partial) so the
      multimodal path works under the multiprocess runner.
    • images travel on the new LMRequest.images field, forwarded through the harness
      (harness/harness.py) and consumed only by the multimodal provider.
  • molmo2-4b preset (common/constants/models.py): dtype=float32,
    autocast_dtype=bfloat16, max_crops=24.
  • MathVista (evals/tasks/math_vista.py): default to the official gpt-4-0613 answer
    extraction (matching mm_olmo); math_vista:offline retains the API-free heuristic.
  • PixMo-Cap dense caption (evals/tasks/dense_caption.py, common/image_qa/): faithful
    per-example seeded long_caption prompt (the 23 GENERAL_PROMPTS_V1 templates, picked
    by the same RNG mm_olmo uses) instead of one hardcoded question; GPT judge unchanged.
  • Image-pointing family (common/pointing.py, common/scorers/pointing.py,
    evals/tasks/common/pointing_base.py, evals/tasks/pixmo_points_eval.py,
    evals/tasks/sa_co_gold.py): two mm_olmo pointing benchmarks
    (pixmo_points_eval ← PixMoPointsEval3Config/SegmentionPointingEval,
    sa_co_gold_subset ← SACoGoldSubset/SACoGoldPointEvaluator) run on the HF checkpoint.
    Both ask "Point to <thing>." and score point-in-mask precision/recall/f1 by maximum
    bipartite matching over decoded COCO-RLE masks, bucketed by GT instance count; SACoGold takes
    the max over 3 annotators with weighted primaries. Distinct base class / scorer / metrics —
    the image-QA modules are untouched.
  • AI2D (evals/tasks/ai2d.py): add the transparent-label variant alongside opaque
    (opaque stays primary).
  • GPT-judge cache (common/scorers/dense_caption_judge.py): auto-create the cache dir
    before the atomic write (fixes a crash on a fresh MATHVISTA_GPT_CACHE_DIR).
  • Suites (evals/suites/molmo2.py): molmo2_imageqa (11 tasks, averaged),
    molmo2_imageqa_caption (12, display-only), and molmo2_pointing (2 pointing tasks,
    averaged on f1).
  • Env (pyproject.toml / uv.lock): declare Molmo2's remote-code deps einops and
    torchvision, plus pycocotools (+ an explicit scipy pin) for the pointing scorer, in the
    existing hf extra (no version bumps, no other group touched; the only new uv.lock resolve
    is pycocotools).
  • Tests: multimodal provider, image-QA request construction, dense-caption prompt parity,
    and CPU-only pointing tests (mask geometry, bipartite scoring, metric buckets, prompt
    builders); existing scorer/harness tests updated to match.

Verification

  • ruff check / ruff format --check clean; ty check clean (pre-existing residuals only);
    pytest tests/ --ignore=tests/integration → 1755 passed, 5 skipped.

uwGZQ and others added 4 commits June 10, 2026 10:50
…e-push

# Conflicts:
#	src/olmo_eval/common/image_qa/vqa_normalization.py
#	src/olmo_eval/common/scorers/dense_caption_judge.py
#	src/olmo_eval/common/scorers/image_qa.py
#	src/olmo_eval/evals/tasks/countbench_qa.py
#	src/olmo_eval/evals/tasks/dense_caption.py
#	src/olmo_eval/evals/tasks/vqa2.py
#	tests/core/test_dense_caption_judge.py
Evaluate the released HF allenai/Molmo2-4B (11 image-QA benchmarks +
PixMo-Cap dense caption) inside olmo-eval, aligned to the mm_olmo
reference. No uv env / version changes beyond declaring Molmo2 remote-code
deps (einops, torchvision) in the existing `hf` extra.

- huggingface provider: transformers-5 load shims for Molmo2 remote code
  (strip optional-attribute processor kwargs; recover generation
  cache_position) + fp32-weights/bf16-autocast path (autocast_dtype) to
  match mm_olmo's amp_bf16 numerics; pickle-safe lazy HF image decode.
- molmo2-4b preset: dtype=float32 + autocast_dtype=bfloat16, max_crops=24.
- math_vista: default to the official gpt-4-0613 extraction; add
  math_vista:offline for the API-free heuristic.
- dense_caption: faithful per-example seeded long_caption prompt (23
  templates) instead of a single hardcoded question; auto-create GPT cache.
- ai2d: add the transparent-label variant alongside opaque (primary).
- evals/suites/molmo2.py: molmo2_imageqa (11) + molmo2_imageqa_caption (12).
- tests for the multimodal provider, image-QA requests, and prompt parity.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds a separate image-pointing eval family for the released HF Molmo2-4B,
distinct from the 11 image-QA tasks (its own base class, scorer, metrics,
suite, and doc; the image-QA modules are untouched). Ports two mm_olmo
benchmarks run on the HF checkpoint:

- pixmo_points_eval  (mm_olmo PixMoPointsEval3Config / SegmentionPointingEval)
- sa_co_gold_subset  (mm_olmo SACoGoldSubset / SACoGoldPointEvaluator)

Both ask "Point to <thing>." and score point-in-mask precision/recall/f1 by
maximum bipartite matching, bucketed by GT instance count; SACoGold takes the
max over 3 annotators with weighted primaries. New modules: common/pointing.py
(COCO-RLE mask decode + bipartite scoring), common/scorers/pointing.py,
evals/tasks/common/pointing_base.py (PointingTask + PointingMetric +
pointing_metrics), the two task modules, the molmo2_pointing suite, and
CPU-only tests. pycocotools (+ explicit scipy) added to the hf extra; the
uv.lock diff is only pycocotools. Reuses generic helpers by import only.

Verified vs mm_olmo (Molmo2-4B, fp32+bf16 autocast, max_crops=24):
SACoGold weighted f1 0.6909 vs 0.6922 (all 18 metrics within 0.0025);
PixMo-Points f1 0.8314 vs 0.8290. Full suite: 1755 passed, 5 skipped.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017rWjjwFXMM556pd4ixrQ96
@jason718
jason718 marked this pull request as ready for review June 22, 2026 20:38
@jason718
jason718 merged commit d765728 into vision Jun 23, 2026
1 check passed
@jason718
jason718 deleted the royg/molmo2-imgqa-eval branch June 23, 2026 06:54
jason718 pushed a commit that referenced this pull request Jun 23, 2026
* new vision tasks

* Add Molmo2-4B image-QA + PixMo-Cap dense-caption eval support

Evaluate the released HF allenai/Molmo2-4B (11 image-QA benchmarks +
PixMo-Cap dense caption) inside olmo-eval, aligned to the mm_olmo
reference. No uv env / version changes beyond declaring Molmo2 remote-code
deps (einops, torchvision) in the existing `hf` extra.

- huggingface provider: transformers-5 load shims for Molmo2 remote code
  (strip optional-attribute processor kwargs; recover generation
  cache_position) + fp32-weights/bf16-autocast path (autocast_dtype) to
  match mm_olmo's amp_bf16 numerics; pickle-safe lazy HF image decode.
- molmo2-4b preset: dtype=float32 + autocast_dtype=bfloat16, max_crops=24.
- math_vista: default to the official gpt-4-0613 extraction; add
  math_vista:offline for the API-free heuristic.
- dense_caption: faithful per-example seeded long_caption prompt (23
  templates) instead of a single hardcoded question; auto-create GPT cache.
- ai2d: add the transparent-label variant alongside opaque (primary).
- evals/suites/molmo2.py: molmo2_imageqa (11) + molmo2_imageqa_caption (12).
- tests for the multimodal provider, image-QA requests, and prompt parity.

* Add image-pointing eval family (PixMo-Points-Eval v3 + SACoGold)

Adds a separate image-pointing eval family for the released HF Molmo2-4B,
distinct from the 11 image-QA tasks (its own base class, scorer, metrics,
suite, and doc; the image-QA modules are untouched). Ports two mm_olmo
benchmarks run on the HF checkpoint:

- pixmo_points_eval  (mm_olmo PixMoPointsEval3Config / SegmentionPointingEval)
- sa_co_gold_subset  (mm_olmo SACoGoldSubset / SACoGoldPointEvaluator)

Both ask "Point to <thing>." and score point-in-mask precision/recall/f1 by
maximum bipartite matching, bucketed by GT instance count; SACoGold takes the
max over 3 annotators with weighted primaries. New modules: common/pointing.py
(COCO-RLE mask decode + bipartite scoring), common/scorers/pointing.py,
evals/tasks/common/pointing_base.py (PointingTask + PointingMetric +
pointing_metrics), the two task modules, the molmo2_pointing suite, and
CPU-only tests. pycocotools (+ explicit scipy) added to the hf extra; the
uv.lock diff is only pycocotools. Reuses generic helpers by import only.

Verified vs mm_olmo (Molmo2-4B, fp32+bf16 autocast, max_crops=24):
SACoGold weighted f1 0.6909 vs 0.6922 (all 18 metrics within 0.0025);
PixMo-Points f1 0.8314 vs 0.8290. Full suite: 1755 passed, 5 skipped.
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.

2 participants