Skip to content

[Do not merge] OLMo 3.5 stage-1 evaluation: olmo_core_vlm for OLMoDDP/KDA checkpoints (our working branch) - #458

Draft
jason718 wants to merge 20 commits into
mainfrom
jasonr/olmo-core-vlm-olmo35
Draft

jason718 wants to merge 20 commits into
mainfrom
jasonr/olmo-core-vlm-olmo35

Conversation

@jason718

@jason718 jason718 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Not for merge. This is the olmo-eval branch our OLMo 3.5 multimodal evaluations run from: every stage-1 eval job of the OLMo 3.5 vision work installs this branch's head (2f383bc7). It is the olmo-eval counterpart of allenai/Olmo-core#916 and allenai/scaling-ladders#83, opened so the code is visible and reviewable in one place. Pieces that are ready go upstream in their own PRs.

What it adds (provider olmo_core_vlm)

  1. OLMo 3.5 document-layout checkpoints (bb04ea9a). Checkpoints from OLMo-core's vision-alignment and mixed-midtraining recipes (Kimi Delta Attention plus a few attention layers, latent MoE, OLMoDDP) are detected from their config and get the plain-document prompt they train on, causal image attention, bf16 weights without autocast, the run's dolma2 tokenizer with the Molmo2 image tokens, and batched decoding without a KV cache (KDA has none). Check: bridge step 500 reproduces its training validation CE through this path (2.0240 vs 2.0241).
  2. Blackwell fallback (3473125c). torch 2.10's grouped_mm has no sm_10x kernel, so on B300 the MoE expert matmul runs as a per-expert loop with torch < 2.13.
  3. SwiGLU int32 overflow guard (f6eb9fbd). OLMo-core's routed-expert swiglu_valid_prefix Triton kernel addresses its input with int32 offsets, so any inference forward above 65,536 tokens (uncached decoding of long OCR outputs at 16 rows × 4,097 positions) crashed with an illegal memory access or returned garbage. The provider splits such calls into row chunks; outputs are identical. The kernel is shared text-side code, so it is reported to the text team rather than changed in OLMo-core.
  4. Bounded recompilation (2f383bc7). Uncached decoding changes the token count every step, and two Triton kernels specialize on it. The provider pads the SwiGLU rows to power-of-two windows and fixes fla's conv1d autotune key. 400 of 400 forwards bit-identical; median decode step 570 vs 697 ms at 16 rows (about 20% faster); the Triton cache stays at about 1.5 GB per job instead of growing every step.
  5. Stage-1 prompts and OCR tasks (ed568fd4, 6f36c83f, 01613d83 and earlier). Stage-1 checkpoints (-o prompt_templates=none -o system_prompt_style=style_and_length_v2) see exactly their training prompts (bare long_caption:, OCR tags, point_count: <label>), and CC-OCR / OmniDocBench default to their English subsets. These predate the final version of Add olmOCR-bench, CC-OCR multi-scene and OmniDocBench v1.5/v1.6 #412 on main; see below.

How the jobs use it

ladders/olmoe3/multimodal/eval_stage1.sh in allenai/scaling-ladders#83 exports the OLMoDDP checkpoint with OLMo-core's export_multimodal_olmoddp.py, then runs olmo-eval beaker launch with provider.kind=olmo_core_vlm and provider.package set to the OLMo-core commit that #83 pins (#916's head). Moving that pin from 5a5c49587 to #916's head was checked on one B300: greedy tokens identical on 6 of 6 olmOCR pages and 6 of 6 caption images, first-forward logits hash identical.

Results produced with it (complete stage-1 protocol, 2026-10-07 to 10-09)

Metric Molmo2 stage-1, best (Qwen3-4B) 14T alignment endpoint 14T + mixed MT (a), old LRs (a) v2, agreed LRs (b) v2, no alignment
Caption avg 57.7 37.9 50.1 47.5 27.3
PixMo-Points F1 81.5 19.0 55.5 53.4 35.9
SA-Co Gold 4k F1 83.7 70.3 80.6 74.9 57.4
PixMo-Count val 91.3 31.5 75.6 68.1 34.3
olmOCR-Bench 54.0 28.4 41.7 42.6 28.0
CC-OCR multi-scene en (macro F1) 79.2 43.1 64.5 61.7 19.0

Why not for merge

🤖 Generated with Claude Code

Qwen3-VL's published results decode with presence_penalty=1.5, which the
sampling params could not express. It is passed through to vLLM (offline and
server), which support it natively, and implemented for the HuggingFace
provider as a logits processor with the same semantics: every token already
present in the generated output, not the prompt, is penalized once. The
request trace records the penalty value rather than the processor object,
which cannot cross the result queue.
Three document-OCR benchmarks that hand the model a page image and grade what
it writes back, each scored the way its leaderboard is.

olmocr_bench runs the 7,019 unit tests of olmOCR-bench through the official
`olmocr` scorer, pinned to the release behind the published numbers, and
reports the mean of the eight category pass rates. Pages ship as PDFs and are
rasterized to a 2048px longest side. Math tests render with KaTeX in headless
Chromium, which is verified, and installed if missing, before inference.

cc_ocr_multi_scene is CC-OCR's multi-scene OCR track with the official
evaluator vendored: per-image F1 of the word (Chinese: character) multiset,
averaged within and then across its 13 sub-datasets.

omnidocbench (v1.6) and omnidocbench_v15 run each version's pinned official
evaluator out of process, once per task: it is not importable as a library,
and its matching changes between versions. Per-page results are stored on
each response and the page averages are checked against the evaluator's own
summary. Provisioning imports the evaluator before inference, and pins around
dependencies it would otherwise turn into silent zeros (filelock, the GUI
OpenCV build, scikit-image). The v1.6 matcher runs with a deeper recursion
limit, and an evaluation failure reports NaN metrics instead of discarding
the run's predictions. CDM needs a LaTeX toolchain, so each version also has
a `_no_cdm` variant.

The instruction follows the checkpoint's prompt family, as for the pointing
and captioning tasks. Validated on Qwen3-VL-4B: olmOCR-bench 79.3 (published
79.2) and OmniDocBench v1.5 text edit 0.054 (published 0.055).
A stage-1 checkpoint (-o prompt_templates=none -o
system_prompt_style=style_and_length_v2) now sees exactly its OLMo-core
stage-1 training prompt, the style tag alone (OLMo-core #875):

* dense_caption_captioner, and dense_caption under the stage-1 family, send
  the bare `long_caption:` instead of `long_caption 65:` (the change in
  #401); default_inference_len is gone.
* The OCR tasks send the task's OCR tag instead of `text_sft: <instruction>`:
  olmocr_bench and OmniDocBench `olmocr:`, CC-OCR `textocr:`. Under
  prompt_templates=none the question is empty, as for a caption. The
  default (instruction-tuned) prompt is unchanged: the benchmark's
  instruction.

English-only variants, same official scoring on a subset:
cc_ocr_multi_scene_en (the 8 sub-datasets without `zh`, 2,000 images;
macro_f1 averages over them) and an `_en` variant of each OmniDocBench task
(pages annotated `english`: 755 of v1.6, 628 of v1.5). New suite `ocr_en`:
olmocr_bench, cc_ocr_multi_scene_en, omnidocbench_en.

11 new tests; tests/evals/vision and tests/evals/suites: 304 passed.
The v1.6 evaluator matches pages and scores tables in worker threads that
fork a helper process per LaTeX conversion and table, and abandons threads
that pass the page timeout. A fork from those threads can leave loguru's
at-fork lock held forever, which hung Molmo2-4B's evaluation with no output
for over 16 hours. Starting the helpers from a fork server avoids forking the
threaded process; re-scoring saved Qwen3-VL-4B predictions gives identical
per-page values except two pages the fork path had zeroed.
A hung evaluator held the run until the job's own limit and lost every
generated page with it. Past a 12h cap (OMNIDOCBENCH_EVAL_TIMEOUT_S) the
evaluation now fails like any other evaluator error: NaN metrics, with the
predictions written for rescoring.
The CDM tasks used to stop before inference when pdflatex, ImageMagick 7,
Ghostscript or Node.js was missing, which left Beaker runs on the _no_cdm
variants and formula scores to a separate local step. They now install
whatever is missing (TeX Live scheme-small with CDM's packages, the
ImageMagick 7 AppImage with a pngalpha PDF delegate, Node.js, Ghostscript
from apt) and render a test formula through the same template CDM uses, so
a broken toolchain fails the job up front instead of scoring formulas zero.
Stage-1 checkpoints (-o prompt_templates=none) get the bare lower-cased label,
point_count: <label>, which is what they train on; the default stays the
released templated question (uber_model_v2), and an unknown family is refused.
Moved here from #401, which is closed in favour of this PR.
Beaker's image lacks the system libraries the ImageMagick AppImage links
against (harfbuzz, fontconfig, freetype, fribidi, X11), so the render check
stopped the job; they are now installed from apt with Ghostscript. TeX Live
comes from a fixed mirror first, since mirror.ctan.org redirects to random
mirrors and some serve certificate chains that do not verify, and downloads
retry.
Moves the olmo_core_vlm extra from 2dad929a to the current vision head,
which adds OLMo-core#875 (Molmo2 stage-1 data and prompts). That OLMo-core's
attention backends take a sinks argument (#872), which the provider's KV-cache
backend rejected, failing every multimodal request; it now accepts it and
refuses it only together with a KV cache. A test pins the cached backend's
forward to the parent's parameters.
CDM follows the renderer: Ghostscript 10.02 (Ubuntu 24.04's apt package)
moved a v1.6 formula score by 0.2 points against Ghostscript 9.55. The job
now installs the runtime the v1.6 README lists as verified (TeX Live 2025
from the frozen tlnet-final repository, ImageMagick 7.1.1-47, Ghostscript
9.55.0) unless those exact versions are already on PATH, adds the pieces
v1.5's CDM README requires (xelatex with xeCJK, the Source Han Sans SC
font, Node.js 16.13.1), and checks each version's own formula template
renders before inference.
How the CDM tasks set up their toolchain at job start, the versions each
release pins, what the setup needs (network, apt), the environment
variables, and a Beaker launch example.
Molmo2 models read English only, so the default task names now run the
English subsets: cc_ocr_multi_scene the 8 English sub-datasets, and the
four omnidocbench tasks the pages annotated english. The whole benchmarks
move to _full variants (cc_ocr_multi_scene_full, omnidocbench_full,
omnidocbench_no_cdm_full, omnidocbench_v15_full,
omnidocbench_v15_no_cdm_full), which keep the per-language text-edit
slices; the English tasks drop them, since they would read 0.0. The ocr
suite follows the defaults, and ocr_full replaces ocr_en for every
language. The _en names are gone, and the prompt tests use the new names.
Restores the naming before b865b2c: each benchmark is either the full
benchmark (cc_ocr_multi_scene, omnidocbench, ...) or its English part
(cc_ocr_multi_scene_en, omnidocbench_en, ...), with suites ocr and ocr_en.
The _en variants are the documented default for Molmo2, which reads English
only; the full ones stay for multilingual models. The English OmniDocBench
tasks keep b865b2c's one fix: no per-language text-edit slices, which read
0.0 on English-only runs.
With the CDM toolchain installed at job start, omnidocbench and
omnidocbench_v15 (and their _en variants) run anywhere the evaluation does
and report every metric the _no_cdm variants did, plus CDM and overall.
Removes omnidocbench_no_cdm, omnidocbench_v15_no_cdm and their _en
variants, the text_score metric only they used, and the task's with_cdm
switch; the prompt tests use the CDM tasks with the toolchain stubbed.
Checkpoints from OLMo-core's vision-alignment recipe (OLMo 3.5: Kimi Delta Attention plus a
few attention layers, latent MoE, OLMoDDP) are detected from their config and get:
- the plain-document prompt the recipe trains on: [EOS] + image tokens + prompt, no chat
  template, later turns after a space (prompt_format=document, or set explicitly);
- causal image attention (the recurrent mixers cannot apply the bidirectional mask);
- bf16 weights without autocast (dtype/autocast_dtype now default to auto), as the OLMoDDP
  train module runs the model;
- the run's dataset tokenizer (dolma2 at its pinned revision) with the Molmo2 image tokens
  appended by OLMo-core's prepare_molmo2_tokenizer, and image blocks built with those ids;
- batched decoding without a KV cache: rows right-padded, each step keeps only every row's
  last-token logits, finished rows leave the batch;
- a torch fallback for TransformerEngine's MoE permute/unpermute, which the no-EP MoE path
  needs and the eval image lacks.

Through this path the bridge step-500 checkpoint reproduces the run's logged in-loop
validation CE (pixmo_caption 2.0240 vs 2.0241, pixmo_transcript 2.2923 vs 2.2928, 64 examples).

Also adds dense_caption_description, the dense-caption eval asked with the recipe's
"Description:" caption prompt.
… < 2.13

torch 2.10's F.grouped_mm CUTLASS kernels are not built for sm_10x; on B300 the
no-EP MoE expert matmul fails with an unspecified launch failure. Install a
per-group matmul loop in that case (the OLMo-core training stack runs torch 2.13).
…ffsets

OLMo-core's swiglu_valid_prefix Triton kernel (the no-grad routed-expert
activation) addresses x as row * stride + col in int32, so an up/gate input
with more than 2**31 - 1 elements (over 65,536 tokens in one LM forward with
top-16 routing and 2H = 2048) reads before the buffer and raises an illegal
memory access that poisons the CUDA context. Uncached decoding of long OCR
outputs reaches that at 16 rows x span 4097.

Wrap the routed_experts module's swiglu_valid_prefix: inputs within the
limit go to the kernel unchanged; larger ones run the same kernel on
contiguous row chunks with their share of the valid range, which gives
identical outputs.
…ne key

Uncached decoding changes the LM's token count on every step, and two Triton
kernels specialize on it:

- OLMo-core's swiglu_valid_prefix takes the routed row count as a constexpr,
  so every decode step compiled a new kernel (~120-170 ms, ~170 KB of Triton
  cache per step; 12-28% of step time).
- fla's causal_conv1d_fwd_kernel uses NB = cdiv(B * T, 1024) as an autotune
  key (a constexpr its body never reads), so it re-autotuned 32 configs
  (~10 s, ~7 MB of cache) every 1024 / B steps.

Run the SwiGLU kernel only on power-of-two row windows between 2**14 rows and
the largest int32-addressable window (2**19 rows for 2H = 2048): longer inputs
are covered by contiguous views, the last one slid back to stay full and
restricted to rows not yet covered; shorter inputs are padded. Each row is
computed once by the same kernel, so outputs are bitwise identical, at most
six variants ever compile, and the int32 overflow split from the previous
commit is subsumed.

Route fla's conv1d launch through a proxy that rounds NB up to a power of
two, installed only when the kernel body does not read NB; the convolution's
arithmetic does not depend on NB or the chosen tile.
@jason718 jason718 self-assigned this Nov 2, 2026
jason718 pushed a commit to allenai/Olmo-core that referenced this pull request Nov 6, 2026
…and recalibrate (#944)

Into `jasonr/olmo35-mixed-midtraining` (#916), on its head `4fb33e922`.
Companion: allenai/olmo-eval#535, into `jasonr/olmo-core-vlm-olmo35`
(allenai/olmo-eval#458). Nine commits: the fix, the recalibration it
requires, and seven follow-ups from the Codex review (frozen panels,
resumed runs and their loss calibration, resuming a checkpoint whose
config was not saved yet and recording its recovered split,
academic-eval result definitions). 19 files, +687/-145.

### Problem
`MultimodalMixtureConfig.build_tokenizer` loaded the tokenizer with
`AutoTokenizer`. For Dolma2 that builds `GPT2Tokenizer`, the class its
`tokenizer_config.json` names, and that class splits text with GPT-2's
regex instead of the `Split` regex in `tokenizer.json`. The vocabulary
and IDs are the same, but the tokens are not:

| Text | `tokenizer.json`, as the text mixtures were tokenized |
Multimodal runs until now |
|---|---|---|
| `2024` | `202` `4` | `20` `24` |
| `.\n\n` | `.ĊĊ` | `.` `Ċ` `Ċ` |
| `long_caption:` | `long` `_caption` `:` | `long` `_` `caption` `:` |

So every multimodal run, v3 to v7, trained its vision text on a
different tokenization from its text data: about 6% of the loss-weighted
vision tokens of the stage-1 v6 mixture differ. Removing
`use_fast=False` does not help, because the class, not the slow/fast
choice, replaces the pre-tokenizer. The in-repo academic eval had the
same issue (`GPT2Tokenizer.from_pretrained`).

### Change
- `build_tokenizer` uses `load_tokenizer_losslessly`, the loader the HF
export already uses: it loads `tokenizer.json` with the generic fast
class and validates the backend with `validate_tokenizer_backend`.
Vocabulary, special-token IDs and the Molmo2 image-token IDs are
unchanged, so checkpoints stay compatible.
- `MultimodalMixtureConfig.tokenizer_json_split` (default `True`)
records the choice in every run's config. `False` reproduces the old
load, only to resume or reproduce an earlier run. Evaluation follows the
saved value, and a config saved before this change means the old split:
`vision_academic` here, `olmo_core_vlm` in olmo-eval
(allenai/olmo-eval#535). The provider calls
`load_tokenizer_losslessly(path, revision=...)`, which the eval commit
`8f8ae5df4` already has, and reads the new field as a plain dict entry,
so evaluating on that commit still works.
- `load_tokenizer_losslessly` gains `cache_dir`, for
`tokenizer_cache_dir`.
- `vision_academic` records `tokenizer_json_split: true` in its result
definition for checkpoints that use the new split, so results saved by
the earlier evaluator are refused instead of merged (unchanged
definitions for earlier checkpoints).
- A saved config without the field means the old split
(`saved_tokenizer_json_split`). Decoded-diagnostic panels frozen before
this change keep that split when loaded, and `vision_decoded` scores
each checkpoint with the split it trained on and records it in the
result manifest (third commit, from the Codex review).

### Recalibration (second commit)
The mean loss weights were measured with the old split. Each table was
remeasured with the probe its docstring describes (128 rows, the
recipe's seed, Dolma2 at the pinned revision), once per split. The old
split reproduced every replaced constant exactly before the new value
replaced it.

| Table | New vs old |
|---|---|
| `ALIGNMENT_MEAN_LOSS_WEIGHTS` bridge, perception | -1.1% to 0% |
| `ALIGNMENT_ONE_ANNOTATION_MEAN_LOSS_WEIGHTS` | -0.1% to 0% |
| `STAGE1_V3_MEAN_LOSS_WEIGHTS`, `STAGE1_V3_DOCUMENTS_MEAN_LOSS_WEIGHTS`
| -6.1% to 0% |
| `STAGE1_V7_NEMOTRON_MEAN_LOSS_WEIGHTS` | -6.9% to -0.8% |
| `STAGE1_V7_GUI_SYN_MEAN_LOSS_WEIGHT` | -0.4% |
| `DEFAULT_VISUAL_MEAN_LOSS_WEIGHTS`, `visual_calibration_v1.json` |
-2.6% to 0% |
| `STAGE1_POSITIONS_PER_LOSS_TOKEN`, Nemotron and GUISyn | +0.3% to
+3.3% |

Derived values follow: `STAGE1_V6_REFERENCE_VISUAL_LOSS_MASS` is about
15.9B tokens (was 16.3B), and v7's derived loss targets move by up to
4%. In v7's base split, olmOCR documents now reaches its 5-pass cap
instead of falling just under it, and PixMo-Points' passes over the hero
are 24.7 (was 25.4). The tests and docstrings that quote these numbers
are updated.

**Left as they are, for a look:** today's builders do not reproduce two
sets of constants even with the old split, so they predate the current
code and the probe cannot recalibrate them.
- `ALIGNMENT_MEAN_LOSS_WEIGHTS["joint"]`: the joint builder now gives
perception's sources and perception's means.
- The 29 v6 entries of `STAGE1_POSITIONS_PER_LOSS_TOKEN`: for example,
TextOCR measures 22.2 against 26.7. The Nemotron and GUISyn entries,
measured the same way a day later, reproduce exactly.

### Evidence
A paired test at 20B on the v6 256K hero workload, 1,200 steps from D4,
two data seeds per arm: A (old split), B (fix), C (fix with a realigned
parent). The fix has no measurable effect on vision (fast stage-1 evals,
captions re-judged) or on text (9 bundles on seed 0, `easy` and `lc` on
seed 1). It is a correctness fix: training now matches the tokenizer the
text data and the exported model use.

### Compatibility
- A pre-fix run resumed on this code keeps its tokenization:
`vision_alignment.train` (also used by mixed mid-training) reads the
resume checkpoint's saved config and, if it predates the setting, keeps
the earlier split and the loss calibration saved with it, meaning its
mean loss weights, loss targets and the train module's loss targets
(also when `--dataset.tokenizer_json_split=false` is set, since the
means in code are calibrated for the new split), or stops with an error
if those do not cover the mixture's sources. It reads the newest
checkpoint that has a `config.json`, so the alignment pipeline's
recovery of a checkpoint saved before its config still works, and that
recovery writes the recovered split and means into the repaired
`config.json` (from the Codex review).
- Existing checkpoints evaluate exactly as before.

### Tests
- New: both load paths, the default, and a regression test with a
tokenizer that declares `GPT2Tokenizer` but splits digits in groups of
three (it fails under the old load). `vision_academic` follows the saved
value.
- `src/test/internal`, `src/test/data/multimodal`,
`vision_academic_test.py` and `nn/hf/tokenizer_test.py` on the training
image: the only failures also fail on the base commit
(`batch_prefetch_test` epoch mode and the two hero-phase override-table
tests).


🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_0159PTUsp2w3YTANVDZ4BUss

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
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