Skip to content

Multimodal eval (1/5): image requests, HF VLM path, OLMo-core VLM provider - #316

Merged
jason718 merged 12 commits into
mainfrom
jasonr/vision-split-1-multimodal-inference
Sep 17, 2026
Merged

jason718 merged 12 commits into
mainfrom
jasonr/vision-split-1-multimodal-inference

Conversation

@jason718

@jason718 jason718 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

First of five PRs splitting #278 into reviewable milestones.
Milestone: any VLM checkpoint — released HF or raw OLMo-core — can be prompted with images.
No tasks or benchmarks yet; those follow in #317 (framework + captioning) → #322 (pointing + counting) → #323 (image QA) → #324 (multi-image + docs).

Core plumbing

  • LMRequest.images and harness pass-through — tasks attach lazy image references (paths / picklable callables), providers resolve them at inference time
  • Image-request contract: providers declare supports_images; the harness rejects image requests aimed at a provider that cannot render them, so a vision task on a text provider fails loudly instead of scoring text-only completions (mock opts in so vision suites stay dry-runnable)
  • Provider kwargs passthrough in ProviderConfig.from_dict — unknown keys now reach the constructor for every provider kind, so a typo'd YAML key surfaces instead of being dropped silently (tested)
  • Completion prompts survive harness-injected system messages: both multimodal providers build chat turns via a shared chat_messages_for_request, which appends request.prompt as a user turn whenever no user turn exists

HF multimodal provider

huggingface.py gains an image-text-to-text path: AutoProcessor + AutoModelForImageTextToText, transformers-5 shims for the Molmo2 remote code, and fp32-weights/bf16-autocast matching mm_olmo's amp_bf16 numerics. Presets: molmo2-4b, molmo2-8b, molmo2-o-7b (all mirror mm_olmo's official eval settings). The text path is untouched: _init_text is the old constructor verbatim, and every shim runs only inside the multimodal init.

OLMo-core VLM provider — as a package

inference/providers/olmo_core_vlm/, split by responsibility:

module contents
checkpoint.py format detection (raw DCP / consolidated export / mm_olmo trainer), config building, weight loading + key remap, untied-LM-head load guard
preprocessing.py tokenizer / max-crops / max-length hints, Molmo2 image special tokens
cache.py cache-capable dense-SDPA backend; the decode attention mask is a module-level helper with direct tests (causal prefill, image or_mask, left padding, decode)
provider.py OlmoCoreVLMProvider — batched variable-length KV-cached decode loop

The split is AST-verified content-identical to the reviewed #278 code. A prompt exceeding max_length raises (multimodal prompts cannot be truncated without corrupting the image-token layout) rather than scoring an empty output. logprobs mirrors OlmoCoreProvider's boundary handling (per-request limits, empty/over-limit continuations) and emits token_id/bytes entries like the other providers.

Dependency isolation (the part to scrutinize)

The multimodal classes are in no ai2-olmo-core release (2.6.0 ships nn.vision but rejects vision-branch configs and lacks molmo2_loader), so the provider has its own opt-in extra, and the text side is untouched:

  • olmo_core extra: unchanged — ai2-olmo-core==2.4.0, with torchao==0.17.0 pinned explicitly so the conflicting fork below cannot drag it down
  • New olmo_core_vlm extra: ai2-olmo-core @ git+…OLMo-core.git@2dad929a (vision branch, pinned by SHA), declared conflicting with olmo_core/openhands — the two OLMo-cores can never coexist in one install. Beaker maps provider.kind=olmo_core_vlm to this extra
  • hf extra: + einops, torchvision (required at import by the Molmo2 remote code); + pycocotools/scipy arrive with the pointing family in Pointing + counting benchmarks (3/5) #322
  • The default vllm group is now self-contained rather than routed through the conflict-gated vllm extra — routed through the extra, uv 0.10 resolved the default group to nothing and uv sync silently installed no vllm
  • Resolution parity with main, verified per profile via uv export: default+olmo_core (the Beaker text-eval profile) is byte-identical to main's resolution; the CI profile differs only by pure additions; numpy/pandas/starlette are at main's exact versions
  • kind=olmo_core still auto-detects multimodal checkpoints (returns to the text path on any read error) but logs a WARNING steering to the explicit kind, since remote jobs must install the matching extra

Runner fixes (from running this at scale)

  • Eager tqdm.get_lock() before parallel task preparation (lazily-created class lock races)
  • --secret-env mappings satisfy required_secrets validation (previously only the user-scoped secret was accepted)
  • olmo_core_vlm in _SEQUENTIAL_ONLY, package-override normalization for both OLMo-core kinds, mm_olmo unpickle shim is idempotent

Testing

Everything below runs on CPU with no API keys:

uv sync --frozen
uv run ruff check src/ tests/ && uv run ruff format --check src/ tests/
uv run --frozen --no-group vllm ty check src/ alembic/     # what CI runs
uv run pytest tests/ --ignore=tests/integration -q         # 2,335 passed

Targeted suites: harness image pass-through + supports_images rejection (tests/core/harness/test_harness.py), HF multimodal shims (tests/providers/test_huggingface_multimodal.py), provider unit tests incl. key-remap regression, unpickle-shim idempotence, decode-mask cases, split-vocab embedding equivalence, logprob boundaries, untied-head guard, and chat_messages_for_request (tests/providers/test_olmo_core_provider.py).

GPU verification: checkpoint load + image pointing + text generation through the declared olmo_core_vlm extra (no overrides); out-of-band vs mm_olmo on real checkpoints — prompt construction token-exact (765/765 input_ids), KV-cached decode token-identical to uncached. End-to-end: the full stack ran caption/pointing/counting on a fresh stage-1 checkpoint on Beaker (5 tasks, 8,831 instances, zero failures).

Review history

Three rounds, all findings addressed with fixes + tests: 7 from @undfined (shim idempotence, logprob boundaries, package normalization, embedding memory, batching allowlist, mask-helper extraction, field placement), 2 from @abhishekraok (installable extra, completion-prompt preservation), 7 from @gregorybchris's review agent (image-request contract, silent skip, lock fork, reroute warning, kwargs test, timeout parsing, logprob fields).

Type of Change

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

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Part of #278 (tracking). Next: #317 — vision task framework + captioning.

@jason718 jason718 changed the title Multimodal inference: image requests, HF VLM path, OLMo-core VLM provider (1/5) Multimodal eval: image requests, HF VLM path, OLMo-core VLM provider (1/5) Aug 25, 2026
@jason718 jason718 changed the title Multimodal eval: image requests, HF VLM path, OLMo-core VLM provider (1/5) Multimodal eval (1/5): image requests, HF VLM path, OLMo-core VLM provider Aug 25, 2026
@jason718 jason718 self-assigned this Aug 25, 2026

@undfined undfined 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.

See inline comments.

@undfined undfined 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.

Some suggestions before merging, but overall looks great!

@jason718
jason718 requested review from AkshitaB, abhishekraok, gregorybchris and undfined and removed request for undfined September 1, 2026 03:32
@jason718
jason718 force-pushed the jasonr/vision-split-1-multimodal-inference branch from 281ec08 to 97914ad Compare September 6, 2026 15:11
@jason718

jason718 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@abhishekraok @gregorybchris @AkshitaB Please help me review this.

@abhishekraok abhishekraok 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.

Two issues found in the multimodal inference paths. Validation: 74 targeted CPU tests passed; full GPU generation was not tested.

@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.

Looks great overall, and thank you for the thorough responses to the earlier round. I verified every one of Tyler's seven findings and Abhishek's two against the current branch: the find_spec guard, the logprob boundary handling, the split embedding lookup, both allowlists, the package normalization, the extracted mask helper, the olmo_core_vlm extra, and the chat_messages_for_request helper are all present with the tests described. Ruff, ty, and the unit suite (2193 passed) are clean on my machine.

I found two issues that I think should be fixed before merge, both in the "infrastructure failure becomes a score" class, plus a lockfile change worth confirming. The rest are non-blocking.

Blocking

  1. src/olmo_eval/common/types/base.py:234
    LMRequest.images is a shared contract, but only the two multimodal providers read it. vllm, vllm_server, litellm, olmo_core, and mock ignore the field, so a vision task run against a text provider produces text-only completions and scores them as a normal run. I reproduced this with MockProvider: a CHAT request carrying images=("/nonexistent/cat.png",) returns a canned answer with no error. Once the tasks in #317 onward land, -m <text model> -t molmo2_imageqa reports Success with meaningless numbers. Please make providers that do not support images raise a clear ValueError when request.images is set (a check in InferenceProvider keyed on a supports_images attribute would cover all of them), and add a test. Rejecting at planning time would be even better, since the run then fails before any model loads.

  2. src/olmo_eval/inference/providers/olmo_core_vlm/provider.py:692
    A prompt that exceeds max_length is skipped with metadata["skipped"] = "prompt_too_long" and an empty output. The runner scores that empty output like any other, so a long-prompt instance becomes a zero rather than a recorded failure, and the hard-failure gate never sees it. The text OlmoCoreProvider has no equivalent silent path. Could this raise instead, so the runner records the instance in scoring_errors and the failure rate reflects it? If skipping is the intended contract, the runner needs to count skipped outputs as failures, and that belongs in the same change.

Non-blocking

  1. uv.lock
    The lock now carries two torchao entries, 0.15.0 and 0.17.0, where main has only 0.17.0. The 0.15.0 entry appears to have come in with the git-pinned OLMo-core resolution. Please confirm which extras resolve to which version, in particular that the text olmo_core extra still gets 0.17.0, and note it in the description. If the text path moved to 0.15.0, that is a core numeric dependency change and deserves the small parity canary we ask for on dependency bumps.

  2. src/olmo_eval/inference/__init__.py:135
    kind=olmo_core now sniffs the checkpoint and silently constructs OlmoCoreVLMProvider. On Beaker, BACKEND_OPTIONAL_GROUPS["olmo_core"] installs the 2.4.0 extra, which has no olmo_core.nn.vision, and the two extras are declared conflicting, so this route can only fail at worker init there. Locally it works only when the user happened to install the VLM extra. It also makes the provider class depend on on-disk content rather than declared config. I would drop the sniffing and raise a clear error that names kind=olmo_core_vlm, or at minimum log at WARNING when the reroute happens.

  3. src/olmo_eval/inference/providers/config.py:242
    ProviderConfig.from_dict now forwards every unknown key into kwargs for every provider kind, not just the multimodal ones. Previously a typo in a YAML provider block was dropped; now it reaches the constructor and either raises there (vLLM) or is absorbed by **kwargs (HF passes it to from_pretrained). That is arguably better, but it is a behavior change for all providers with no test. Please add a from_dict test and mention the change in the description.

  4. src/olmo_eval/runners/asynq/monitoring.py:20
    OLMO_EVAL_PROVIDER_INIT_TIMEOUT is parsed at import time with a bare float(), so a bad value fails on import of the monitoring module far from the cause, and the variable is not documented anywhere in the stack, including the README section in #324. Could it be read inside wait_for_provider_init with a clear error, and documented?

  5. src/olmo_eval/inference/providers/olmo_core_vlm/provider.py:818
    The logprob entries here carry only token and logprob. HuggingFaceProvider and the text OlmoCoreProvider also emit token_id and bytes, and ngram_copying reads bytes. Could this match the other providers?

  6. src/olmo_eval/inference/providers/huggingface.py:539 and olmo_core_vlm/provider.py:652
    Both multimodal paths .strip() the generated text; the HF text path does not. If the strip mirrors mm_olmo, a one-line comment saying so would help. If not, it changes what the scorers see.

  7. src/olmo_eval/inference/providers/huggingface.py:96
    _patch_processor_optional_attribute_kwargs replaces ProcessorMixin.__init__ process-wide, so it affects any other processor loaded in the same process. It is idempotent and guarded, which is good. Worth a sentence in the docstring about the blast radius.

  8. Branch base
    The stack is based on 254e2c22, four commits behind main, and the "Rebase on main; regenerate the lock" commit did not actually move the base. This PR merges cleanly, but the lock was regenerated against the old base, so please rebase before merging.

Nits

  • Nit: checkpoint.py:42 has a dangling comment ("Default tokenizer for Molmo2-family models...") with no constant under it.
  • Nit: checkpoint.py:261 and :425 tell users to pin provider.package=...OLMo-core.git@vision; that is superseded by the olmo_core_vlm extra this PR adds.
  • Nit: preprocessing.py:17 has an empty if TYPE_CHECKING: pass.
  • Nit: infrastructure.py:129 adds ai2/holmes to WEKA_CLUSTERS, which is unrelated to this PR.
  • Nit: the description still lists TaskConfig.prompt_templates / system_prompt_style under core plumbing; those moved to #317.

Before merge

Items 1 and 2, a confirmation on item 3, and a rebase onto current main. After that, feel free to merge once CI is green. Items 4 through 10 can be follow-ups if you prefer; if so, please file an issue for item 4 so the olmo_core auto-route does not get forgotten.

@jason718

Copy link
Copy Markdown
Contributor Author

All seven items addressed in f411948 (blocking) / description (notes):

1 (blocking) — providers now declare supports_images and the harness rejects image requests aimed at a provider that cannot render them, with an error naming provider.kind=olmo_core_vlm. HF sets it from its multimodal mode, the VLM provider sets it, and the mock opts in deliberately so vision suites stay dry-runnable. Tests: TestImageRequestRejection (reject / pass / text-unaffected).

2 (blocking) — the prompt_too_long silent skip is gone: a multimodal prompt exceeding max_length now raises with the lengths named, mirroring the text provider's budget error, so the runner records it and the failure gate sees it. (Multimodal prompts can't be truncated without corrupting the image-token layout, so failing is the only honest option.)

3 — good catch, and it was actually worse than two entries: uv had unified both conflict forks on the git pin's torchao==0.15.0, silently downgrading the text extra from main's 0.17.0. The olmo_core extra now pins torchao==0.17.0; verified per extra via uv export (0.17.0 / 0.15.0) and noted in the description.

4 — the reroute now logs a WARNING naming the explicit kind, and the README steers to provider.kind=olmo_core_vlm first, with the Beaker failure mode spelled out. Kept the detection itself: it is load-bearing for existing local workflows.

5 — behavior kept (a typo surfacing in the provider beats silent dropping), now tested (TestProviderConfigKwargsPassthrough) and noted in the description.

6 — OLMO_EVAL_PROVIDER_INIT_TIMEOUT is read at use time with an error that names the variable, and documented in the README's multimodal section (this stack's PR 5).

7 — VLM logprob entries now carry token_id and bytes like the other providers.

Full suite at the stack tip: 2,419 passed; lint/format/ty clean.

@jason718
jason718 force-pushed the jasonr/vision-split-1-multimodal-inference branch from f411948 to 4ff30fc Compare September 13, 2026 19:58
…provider

First of five PRs splitting the vision branch (#278) into milestones. This one
makes any VLM checkpoint promptable with images; the benchmarks follow.

Requests carry images (`LMRequest.images`) and the harness passes them through.
The prompt family (`prompt_templates` / `system_prompt_style`) is a task config
field settable per run, because mm_olmo derives the prompt from settings recorded
in each checkpoint's own config.

The HuggingFace provider gains an image-text-to-text path with transformers-5
shims for the Molmo2 remote code and fp32/bf16-autocast numerics matching
mm_olmo, and loads consolidated OLMo-core exports by converting weights
in-memory to the released layout.

The new OLMo-core VLM provider runs raw MultimodalLM checkpoints in three
on-disk formats, decoded with a batched variable-length KV cache. It lands as a
package split by responsibility (checkpoint / conversion / preprocessing /
cache / provider), content-identical to the reviewed #278 code by AST
comparison.

Also the operational fixes that running this at scale required: an env override
for the 900s provider-init ceiling, an eager tqdm lock before parallel task
preparation, and the missing extras mapping for the new provider kind.

Co-authored-by: Ziqi Gao (Roy) <[email protected]>
Add `molmo2-8b` and `molmo2-o-7b` presets mirroring the validated 4B eval
settings (fp32 weights + bf16 autocast, max_crops=24 — mm_olmo evaluates the
whole family with the same protocol).

Collapse the provider-init timeout override to a single expression; the
env var is the point, the wrapper wasn't.
Per review on the split PR:

- The mm_olmo unpickle shim consults sys.modules before find_spec, which raises
  ValueError once the shim (registered with __spec__ = None) is installed —
  repeat provider construction in one process crashed before.
- logprobs mirrors OlmoCoreProvider's boundary handling: the limit resolves
  from request.max_length, an empty continuation returns an empty zero-logprob
  result, an over-limit continuation raises instead of failing inside gather,
  and the context truncates only after those checks.
- The split-vocab embedding does a two-table lookup instead of caching a
  concatenated copy of the whole embedding matrix (~2.5 GB at the 8B size).
- Package overrides for provider.kind=olmo_core_vlm normalize like olmo_core
  (version shorthand, git-URL binding, bundled-extra replacement), and the
  kind joins the sequential-only batching allowlist so a streaming config
  fails validation rather than serializing behind the provider lock.
- The cached-decode SDPA mask construction is a module-level helper with
  direct tests for causal prefill, or_mask reopening and alignment, and
  left-padding semantics.
- The unused TaskConfig prompt-family fields move out of this PR; they land
  with their first consumer.

Tests: shim called twice, mask cases above, split-vocab lookup vs a
concatenated table, and logprob boundaries (empty / at-limit / over-limit /
per-request / non-positive).
The max_model_len/max_length alias resolver was a verbatim copy of the one in
olmo_core_utils; reuse it, with the provider name parameterized for its error
messages. Inline the single-caller _select_token delegate.
~3 of 4 Beaker loads of the untied 8B checkpoint returned the embedding table
as the LM head — every other tensor correct, output noise, score at chance,
nothing raised. The guard rejects a load whose untied head is bit-identical to
the embeddings. Also picks up ai2/holmes in WEKA_CLUSTERS (#330).
…tem messages

No ai2-olmo-core release supports this provider yet: 2.6.0 ships the vision
classes but rejects vision-branch training configs (`flex` backend,
`masked_dropout`) and lacks molmo2_loader; 2.4.0 has none of it. The provider
gets its own `olmo_core_vlm` extra pinned to a vision-branch commit, so the
declared installation works while the text provider's `olmo_core` pin stays
untouched (the extras conflict, and beaker jobs map the provider kind to the
new extra). Attention-backend values are rewritten in the raw config before
enum coercion, and the molmo2_loader imports fail with an actionable message
under an incompatible install. Verified by a GPU smoke through the declared
extra: checkpoint load, image pointing, and text-only generation.

Completion requests keep their prompt when the harness injects a system
message: both providers now build chat turns via chat_messages_for_request,
which appends the prompt as a user turn whenever no user turn exists, instead
of letting a non-empty messages tuple displace the question.
…fork

- Providers declare `supports_images` and the harness rejects image requests
  aimed at a provider that cannot render them, so a vision task on a text
  provider fails loudly instead of scoring text-only completions. The mock
  provider opts in deliberately to keep vision suites dry-runnable.
- A multimodal prompt that exceeds max_length now raises (mirroring the text
  provider's budget error) instead of scoring an empty "skipped" output that
  the failure gate never saw.
- The text `olmo_core` extra pins torchao==0.17.0: the conflicting
  git-pinned VLM extra requires 0.15.0, and without the pin uv unified both
  resolution forks on 0.15.0 — a silent downgrade of the text provider's
  numeric stack from main. `uv export` per extra confirms 0.17.0 / 0.15.0.
- The kind=olmo_core multimodal reroute logs a WARNING naming
  provider.kind=olmo_core_vlm (remote jobs must install the matching extra).
- OLMO_EVAL_PROVIDER_INIT_TIMEOUT is read at use time with an error that
  names the variable, instead of a bare float() at import.
- VLM logprob entries carry token_id and bytes like the other providers
  (ngram_copying reads bytes).
- ProviderConfig.from_dict kwargs passthrough gets the missing test.
The vllm dependency group was declared as `olmo-eval[vllm]`, and the vllm
extra participates in the declared conflicts — uv 0.10 gates a conflicting
extra's edges behind opt-in markers, so once the olmo_core_vlm conflict pairs
reshaped the fork structure, the default group resolved to nothing and
`uv sync --frozen` silently installed no vllm at all. The group now lists the
vllm requirements directly, so default installs (local dev, beaker text jobs)
keep vllm regardless of conflict structure.

Also re-locks from main's lockfile as the base, which removes the incidental
floating-version drift earlier from-scratch locks introduced (numpy, pandas,
starlette are back at main's versions; the default+olmo_core profile is now
byte-identical to main's resolution).
Direct DCP loads under storage contention were the only consumer, and the
right fix for those is consolidating the checkpoint before eval (tracked in
a follow-up issue) rather than a per-launch timeout knob. monitoring.py is
back to main's version.
Its only production consumer is vLLM serving, which lands separately; here
it was a third route between the two providers plus a filesystem sniff on
every text-provider init. The VLM provider still loads consolidated exports
natively.
@jason718
jason718 force-pushed the jasonr/vision-split-1-multimodal-inference branch from 82221c5 to 4b6870e Compare September 17, 2026 03:50
@jason718
jason718 merged commit 35ecf49 into main Sep 17, 2026
10 checks passed
@jason718
jason718 deleted the jasonr/vision-split-1-multimodal-inference branch September 17, 2026 04:14
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.

4 participants