Skip to content

Vision task framework + captioning benchmarks (2/5) - #317

Merged
jason718 merged 5 commits into
mainfrom
jasonr/vision-split-2-framework-captioning
Sep 19, 2026
Merged

jason718 merged 5 commits into
mainfrom
jasonr/vision-split-2-framework-captioning

Conversation

@jason718

@jason718 jason718 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Second of five PRs splitting #278 (after #316, now merged). Milestone: the evals/vision/ package exists and its first family — PixMo-Cap dense captioning, GPT-judge scored — runs end to end. Based directly on main.

The evals/vision/ package

evals/vision/
├── tasks/base.py       # VisionTask — consolidated instance caching + image-attached requests
├── scoring/
│   ├── prompts.py           # mm_olmo prompt families: 43 seeded pointing templates, style prefixes
│   ├── prompt_templates.py  # vendored mm_olmo question templates (caption, count, ...)
│   └── judges.py            # dense-caption GPT judge (charxiv + math_vista join in #323)
├── benchmarks/dense_caption.py   # `dense_caption`, `dense_caption_captioner`
└── data/
    ├── images.py       # lazy image references (picklable across worker processes)
│   └── paths.py        # $MOLMO_DATA_DIR resolution, fail-fast when missing (path rebasing lands with its first consumer in #322)

Registration mirrors evals/tasks: one from . import vision line in evals/__init__.py, explicit benchmark imports inside the package.

Two amendments to the reviewed layout sketch, for sign-off:

  1. benchmarks/ holds flat modules, not per-benchmark directories — 17 of the 19 benchmarks are single files, and shared parsers (mmmu_parsing serves mmmu, mmmu_pro and multi-image) belong in scoring/.
  2. Vision scorers are not re-exported through common/scorers/__init__.py — that module is imported by evals/tasks/common/base.py (every task in the repo), so an eager re-export from evals.vision.scoring.* creates a package cycle.

VisionTask

ImageQATask, PointingTask, MultiImageQATask and DenseCaptionEval on the vision branch carried byte-identical instance/request mechanics; VisionTask consolidates them. Subclasses implement _build_instances and optionally _attach_images, which returns lazy references (paths / picklable callables) so the parent process never decodes pixels; providers resolve them at inference time. No runner code is touched. config.limit is left to the runner's seeded random sample, exactly as for text tasks (dense caption applies its own index-stable limit while building, because its seeded prompt depends on the raw line index).

Task identity + config

  • TaskConfig.prompt_templates / system_prompt_style land here with their first consumer, serialized in to_dict (with a test that changing either changes the task hash); the -o allowlist picks them up via main's derived mechanism (Derive the accepted -o task override names from TaskConfig #367)
  • DenseCaptionJudgeScorer.to_dict emits only type/name/model — cache location and mode are machine-local and no longer perturb the task hash (test: hash is identical with DENSE_CAPTION_EVAL_DIR redirected)
  • required_secrets=("OPENAI_API_KEY",) on both captioning tasks — beaker never mounted the judge's key before. The launcher resolves it as the user-scoped secret {beaker-username}_OPENAI_API_KEY (existing convention; the launch error names the exact beaker secret write command when it is missing)
  • Unknown system_prompt_style values raise; num_samples > 1 is rejected (the judge protocol is defined for one sample)

Dense-caption metrics + judge

  • One parameterized DenseCaptionMetric whose compute_instance stores its own field (None when that judge side is invalid); the avg primary has no exact per-instance decomposition and stores nothing. Regression tests poison the scorer channel.
  • Legacy 0–100 scale kept, display format pinned to raw (the viewer no longer renders 40.0 as 4000%)
  • GPT/cache failures propagate to the runner's structured scoring_errors instead of silently shrinking the valid-example denominator; only unparseable judge replies are per-example invalid
  • Two mm_olmo parity decisions are documented in place as deliberate: the end-anchored Not Stated regex and scoring only the judge lines returned — both are how every published Molmo2 dense-caption number was produced
  • Judge cache follows DENSE_CAPTION_EVAL_DIR ($DENSE_CAPTION_EVAL_DIR/gpt4-cache)

Ai2 data paths

The Weka defaults behind MOLMO_DATA_DIR / DENSE_CAPTION_EVAL_DIR remain for now so Ai2 launches need no extra flags, but a missing root now fails fast with the variable named rather than reading a nonexistent path. Their removal per the #153/#276 convention is tracked in #381 (linked from the module docstrings).

Verification

  • 2,730 instances, matching the mm_olmo-validated runs; the full stack later ran this task end to end on Beaker (2,730/2,730, zero failures)
  • Judge unit tests; prompt-family tests include an mm_olmo parity guard (MM_OLMO_ROOT, skipped when absent)
  • Full suite green; lint/format/ty clean

Review history

Tyler's 10 findings (per-instance metric storage, exception swallowing, cache dir, task hash, lazy images, Not Stated parity, partial-response parity, display scale, multi-sample aggregation, style validation) and the review agent's 9 (scorer to_dict vs hash, Weka defaults, runner-side limit, load_instance_image delegation, pixmo_cap alias, allowlist rebase, the untested --secret-env launcher tweak — removed rather than tested, stale comment, public style-set names) are all addressed in the current head.

Type of Change

  • New feature (non-breaking change that adds functionality)

Checklist

Part of #278 (tracking). Next: #322 — pointing + counting.

@jason718
jason718 force-pushed the jasonr/vision-split-2-framework-captioning branch 2 times, most recently from 94a37f0 to 1345105 Compare September 1, 2026 11:09
@jason718 jason718 self-assigned this Sep 2, 2026
@jason718
jason718 force-pushed the jasonr/vision-split-2-framework-captioning branch 2 times, most recently from 2f9a116 to 4a612ad Compare September 6, 2026 15:17
@jason718
jason718 force-pushed the jasonr/vision-split-2-framework-captioning branch from 3be662e to 38794ad Compare September 10, 2026 21:07

@gregorybchris gregorybchris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review was generated by an agent following REVIEW_GUIDE.md. It is not from a human reviewer. Reply in the PR thread and a maintainer will follow up.

Looking good! I verified all ten of Tyler's earlier findings against the branch: the parameterized DenseCaptionMetric with its own compute_instance and disabled fallback, the removed try/except in the judge, the cache directory derived from DENSE_CAPTION_EVAL_DIR, both prompt fields in TaskConfig.to_dict with the hash test, lazy image references plus _result_request, the ValueError on unknown styles, the num_samples > 1 rejection, and the raw display format. The two parity-preserving decisions on the "Not Stated" regex and partial judge responses are documented in place, which matches how this repo handles bug-compatible ports. Ruff, ty, and the unit suite (2234 passed) are clean locally.

Three things I think should be addressed before merge, then some smaller items.

Blocking

  1. src/olmo_eval/evals/vision/scoring/judges.py:286
    DenseCaptionJudgeScorer.cache_dir is a dataclass field, and Metric.to_dict serializes scorer instances with asdict, so the cache path is part of the task hash. I reproduced it: dense_caption hashes to b55f93d3... by default and 7eeccc5e... with DENSE_CAPTION_EVAL_DIR=/tmp/x. The same eval on Weka and on a laptop therefore gets different artifact names and different stored configs, while cache_only and recompute also leak into the hash. Only model is output-affecting. Please give the scorer a to_dict that emits type, name, and model, and add a test asserting the hash is independent of the cache settings. The same fix is needed for the CharXiv and MathVista scorers in #323, where the effect is worse.

  2. src/olmo_eval/evals/vision/data/paths.py:12, benchmarks/dense_caption.py:40, scoring/judges.py:27
    Three Weka paths ship as source defaults. Tyler asked in #153 and #276 that runner and task code not carry Ai2 paths; the two options he accepted were a generic default that Ai2 users override at launch, or naming the task as internal and filing a follow-up. The cheapest version here: keep the env vars, drop the Weka literals to None, and raise a clear error naming MOLMO_DATA_DIR / DENSE_CAPTION_EVAL_DIR when they are unset and the data is not found. The Weka values then live in the README and the Beaker launch docs. If you would rather defer, please file the issue and link it from the module docstrings.

  3. src/olmo_eval/evals/vision/tasks/base.py:33
    VisionTask.instances applies limit by taking the first N. Every other task leaves limit to the runner, which draws a seeded random sample (runners/asynq/preparation.py:60), so -o limit=100 means a random sample for text tasks and the first hundred lines for all 25 vision tasks. The dense-caption justification (the raw line index drives the seeded prompt) is specific to that task, and it already applies its own limit. Could the base class drop the slice and let the runner sample, unless prefix-limit is intended for the whole family, in which case the divergence should be documented on VisionTask?

Non-blocking

  1. src/olmo_eval/evals/vision/data/images.py:45
    load_instance_image duplicates common.images.resolve_image and has no caller in this PR; its only consumer arrives in #323. Either land it with that consumer or have it delegate to resolve_image.

  2. src/olmo_eval/evals/vision/benchmarks/dense_caption.py:279
    register_variant("dense_caption", "pixmo_cap") registers an alias with no overrides. Variants in this repo describe a format or metric modifier, so dense_caption:pixmo_cap reads as if it changes something. Suggest dropping it or documenting why the alias is needed.

  3. src/olmo_eval/cli/utils.py:130
    This hand-maintained allowlist conflicts with main, which added strip_thinking in #361 (the stack is based four commits behind). #367 proposes deriving the list from TaskConfig, which would remove the need for this edit entirely. A rebase is needed regardless.

  4. src/olmo_eval/cli/beaker/launch.py:579
    Letting an explicit --secret-env mapping satisfy a required secret is a reasonable change, but it is untested and unrelated to vision. Please add a small test for it.

  5. src/olmo_eval/evals/vision/benchmarks/dense_caption.py:171
    The comment "A missing scorer dependency scores every instance zero rather than failing" is no longer true after the exception-handling fix; an ImportError now propagates. Please update it so the next reader does not rely on it.

  6. src/olmo_eval/evals/vision/scoring/prompts.py
    _NO_PREFIX_STYLES and _STYLE_PREFIX_STYLES are underscore-private but imported by dense_caption.py. Either export them or give them public names.

Nits

  • Nit: tests/evals/vision/test_prompts.py:62 hard-codes /root/mm_olmo; an env var (MM_OLMO_ROOT) would let others run the parity guard.
  • Nit: VisionTask.dependencies = ["pillow"] and DenseCaptionEval.dependencies = ["pillow", "openai"] restate the base entry; consider extending rather than replacing.

Before merge

Items 1 through 3 (or, for item 2, a filed follow-up issue and the fail-fast error), plus the rebase from item 6. Then merge once CI is green. Thanks for the careful work on the earlier round.

@jason718
jason718 force-pushed the jasonr/vision-split-2-framework-captioning branch 8 times, most recently from bafc948 to 5c68033 Compare September 17, 2026 03:54
@jason718

Copy link
Copy Markdown
Contributor Author

All nine items addressed in 8586d99 (now based directly on main after #316 merged):

1 (blocking) — DenseCaptionJudgeScorer.to_dict now emits only type/name/model, so cache location and mode no longer enter the task hash. Test: TestJudgeCacheSettingsOutsideTaskHash asserts the hash is identical with DENSE_CAPTION_EVAL_DIR redirected and that two scorers with different cache settings serialize identically. The same to_dict treatment goes to the CharXiv and MathVista scorers in #323.

2 (blocking) — took the deferral path you allowed: the Weka defaults stay (Ai2 launches keep working without three -e flags), but a missing MOLMO_DATA_DIR / DENSE_CAPTION_EVAL_DIR root now fails fast with the variable named, so a non-Ai2 run never silently reads a nonexistent path. Filed #381 for the removal per #153/#276, linked from both module docstrings.

3 (blocking) — VisionTask.instances no longer head-slices; config.limit is left to the runner's seeded sample exactly as for text tasks. Dense caption keeps its own index-stable limit while building (the seeded prompt depends on the raw line index), which is now the only place the family touches limit. Test: TestLimitLeftToRunner.

4 — load_instance_image now delegates to common.images.resolve_image. 5 — the no-op pixmo_cap alias is gone (no references anywhere in the stack). 6 — rebased; with #367's derived allowlist our cli/utils.py edits disappeared entirely. 7 — the --secret-env rule is a small unmapped_required_secrets helper with a test. 8 — stale comment replaced. 9 — NO_PREFIX_STYLES / STYLE_PREFIX_STYLES are public names now.

Nits: the parity guard reads MM_OLMO_ROOT (default unchanged); DenseCaptionEval.dependencies extends VisionTask.dependencies.

Tyler's ten threads on this PR were all answered with fixes in the previous round and are now marked resolved. Full suite 2,404 passed on this branch; lint/ty clean.

@jason718
jason718 force-pushed the jasonr/vision-split-2-framework-captioning branch 2 times, most recently from 93235c0 to 07fa709 Compare September 17, 2026 05:38
@jason718

Copy link
Copy Markdown
Contributor Author

Follow-up on item 7: rather than adding a test for the --secret-env launcher tweak, it's removed from this PR entirely (07fa709 rebuilds the branch without it) — it was unrelated to vision, and the existing convention already covers the need: task-required secrets resolve to the user-scoped {beaker-username}_OPENAI_API_KEY, and the launch error prints the exact beaker secret write command when it's missing. src/olmo_eval/cli/ is now untouched by this PR.

@jason718

Copy link
Copy Markdown
Contributor Author

Two more trims in a571402: _result_request (and its test) is gone — with lazy image references nothing heavy was being echoed through the result queue, so runners/asynq/processing.py is untouched by this PR again — and rebase_data_path moves to #322 with its first consumers. The runner and CLI are now byte-identical to main in this PR.

@gregorybchris gregorybchris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review was generated by an agent following REVIEW_GUIDE.md. It is not from a human reviewer. Reply in the PR thread and a maintainer will follow up.

Approving — this addresses everything from the last round, and the trims make it a much easier PR to read. One suggestion inline that I'd like to land with it.

I re-verified all nine items rather than taking the summary on trust:

  • Judge cache out of the task hash. dense_caption hashes to 0cd777dc53b9407e under the default root, DENSE_CAPTION_EVAL_DIR=/tmp/x, and /tmp/y. It was b55f93d3... / 7eeccc5e... before.
  • limit left to the runner, so the vision tasks now get the same seeded sample as the text tasks.
  • Weka paths: the fail-fast error names the variable, and #381 records the literals, the accepted options, and why the interim state is what it is. That's the deferral I offered, done properly.
  • Items 4, 5, 8, 9 and both nits all check out, and dropping the --secret-env tweak and _result_request rather than testing them was the right call — cli/ and runners/ are byte-identical to main now.

Locally: 2385 passed, 25 skipped; ruff, format and ty clean. CI is green.

Before merge

src/olmo_eval/evals/tasks/common/base.py:305 — to_dict emits prompt_templates and system_prompt_style unconditionally, so None enters the hashed JSON for every task in the repo and every existing task hash changes. Against main at 35ecf49e:

task main this PR
arc_easy 8738c56690bd51aa 5c1887295371d1a3
gsm8k 4f68bf90a407205a 1a55be898c78d3f1
hellaswag 0d3fbae973978310 d01e4aba2e1f2523
humaneval e90fac5e5d166beb b6e5ee3150759390
drop 61d76aaf976b7df2 ebc7997df6421be7

Every stored result stops matching new runs of the same config, and pairwise tooling can't line the two up. This is the convention the comment four lines below already describes for strip_thinking and the judge fields — "emitted only when set so that task hashes of runs without it are unchanged from before the field existed" — so it just needs the same treatment.

I applied the inline suggestion locally to check the cost: all five hashes return to their exact main values, and tests/evals/vision/ still passes 42/42, including TestPromptFamilyTaskIdentity. Both fields default to None even on dense_caption, so setting either one still changes the hash, and nothing about the vision tasks' identity changes. Worth a small regression test asserting a text task's hash is unaffected by the new fields, since nothing currently guards that.

Approving so this isn't gated on me — please push the suggestion (or an equivalent) and merge once CI is green.

@jason718

Copy link
Copy Markdown
Contributor Author

Thanks — and good catch on the hash regression; that one would have been expensive to notice after the fact.

Pushed your suggestion in 5dd87aa. Confirmed independently against main at 35ecf49e: all five hashes are back to their exact main values.

task this PR (before) now
arc_easy 5c1887295371d1a3 8738c56690bd51aa
gsm8k 1a55be898c78d3f1 4f68bf90a407205a
hellaswag d01e4aba2e1f2523 0d3fbae973978310
humaneval b6e5ee3150759390 e90fac5e5d166beb
drop ebc7997df6421be7 61d76aaf976b7df2

dense_caption identity still responds to both fields (both default to None, so TestPromptFamilyTaskIdentity keeps working). Added the guard you asked for as TestPromptFamilyFieldsAreOptIn: three text tasks must not carry either key in their serialized config, plus a companion assertion that opting in does add the key back and change the hash — so the test can't be satisfied by simply dropping the fields.

Vision suite 48 passed; the rest of the stack is re-rolled on top and I'll merge once CI is green.

@jason718
jason718 force-pushed the jasonr/vision-split-2-framework-captioning branch from 5dd87aa to d9c0501 Compare September 18, 2026 06:17
jason718 and others added 5 commits September 19, 2026 20:59
Second of five PRs splitting #278. Introduces the `evals/vision/` package —
tasks / scoring / benchmarks / data, per the layout proposed in review — and
lands the first family in it: PixMo-Cap dense captioning, GPT-judge scored.

`VisionTask` consolidates the instance caching, limit handling and image-attached
request construction that every vision family previously reimplemented; families
override only how instances are built and which images attach. Dense caption
applies its limit inside instance building so the raw-line index driving its
seeded prompt never shifts, which the base's slice then leaves untouched.

The prompt-family machinery (mm_olmo's 43 seeded pointing templates, the style
prefixes, and the caption templates) lives in `scoring/prompts*`; the judge in
`scoring/judges`. Vision scorers are deliberately not re-exported through
`common/scorers/__init__.py`: that module is imported by every task via
`tasks/common/base.py`, so an eager re-export from `evals.vision` would create a
package cycle.

Both captioning tasks now declare `required_secrets=("OPENAI_API_KEY",)` — the
judge always needed the key, but beaker never mounted it, so remote runs failed
at scoring time.

Registration mirrors `evals/tasks`: one `from . import vision` in
`evals/__init__.py`, with the benchmark imports explicit inside the package.

Co-authored-by: Ziqi Gao (Roy) <[email protected]>
…t data roots

- DenseCaptionJudgeScorer.to_dict emits only type/name/model, so the cache
  location and mode no longer enter the task hash (same eval hashed
  differently per machine before).
- VisionTask leaves config.limit to the runner's seeded sample, as text tasks
  do, instead of a first-N slice; dense caption keeps its own index-stable
  limit while building.
- Missing MOLMO_DATA_DIR / DENSE_CAPTION_EVAL_DIR roots fail fast with the
  variable named; removal of the Ai2 defaults is tracked in #381.
- load_instance_image delegates to the shared resolver; the no-op pixmo_cap
  alias is gone; the style sets are public names; the --secret-env rule is a
  tested helper; stale dependency comment fixed; parity guard reads
  MM_OLMO_ROOT.
CI runners cannot stat under /root, so Path.exists() raised PermissionError
at collection instead of skipping.
Requests now carry lazy image references, so nothing heavy is echoed back
through the result queue and the strip bought nothing; the runner is
untouched again. rebase_data_path has no consumer until the pointing family
and moves there.
Unconditional emission put None into the hashed config for every task in the
repo, changing every existing task hash (arc_easy 8738c566 -> 5c188729, and
so on) so stored results no longer matched new runs of the same config. Follow
the convention already used for strip_thinking and the judge fields; setting
either field still changes the hash, which the vision identity test covers.
@jason718
jason718 force-pushed the jasonr/vision-split-2-framework-captioning branch from d9c0501 to fa4c5ad Compare September 19, 2026 20:59
@jason718
jason718 merged commit e1e1688 into main Sep 19, 2026
10 checks passed
@jason718
jason718 deleted the jasonr/vision-split-2-framework-captioning branch September 19, 2026 21:44
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