Skip to content

[Multimodal 6/7] OLMo 3.5 vision alignment training - #936

Draft
jason718 wants to merge 1 commit into
mainfrom
jasonr/molmo2-alignment-training
Draft

jason718 wants to merge 1 commit into
mainfrom
jasonr/molmo2-alignment-training

Conversation

@jason718

@jason718 jason718 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PR 6 of 7 for moving the multimodal (Molmo2 / OLMo 3.5) work from vision to main. #910-#913 and #934 are merged, so this targets main directly; linear stack, so this diff is only the alignment training layer. Base is retargeted to main as parents land.

This adds OLMo 3.5 vision alignment as a multimodal-only layer over OLMoDDPModel:

  • Model / train module: MultimodalOLMoDDPModel (nn/vision/multimodal.py), the OLMoDDP train-module hooks it needs (train_module/config.py, nn/ddp/model.py), and MultimodalTransformerTrainModule changes for loss-group normalization and skip-step bookkeeping.
  • Optimizer / callbacks: optim/multimodal_optimizer.py, train/callbacks/multimodal.py.
  • Data: PretrainingReplay, perception sources and provenance (data/multimodal/*).
  • Pipeline: olmo_core.internal.vision_alignment* (phases, handoffs, data, pipeline), scripts/train/Vision-Align.py, scripts/export_multimodal_olmoddp.py, guide docs/source/guides/vision_alignment.md.
  • Evaluator: eval/multimodal_lm_evaluator.py and eval/multimodal_image_pairing.py.
  • ~15k lines, roughly half tests.

Series

# PR Contents Status
1/7 #910 model merged
2/7 #911 train module merged
3/7 #912 data core merged
4/7 #913 stage-1 recipe merged
5/7 #934 data infra + stage-2 recipe + Qwen3 0.6B/1.7B sizes merged
6/7 this PR OLMo 3.5 alignment training draft
7/7 #937 evals, mixed mid-training (from #916), catch-up with #916 draft

Why a separate PR

Alignment is a different consumer from stage 1 or 2: it needs OLMoDDP and the OLMo 3.5 text model, and it brings a large pipeline (phases, handoffs, export) that only alignment runs use. Splitting it keeps #913/#934 reviewable and lets this one be iterated on without touching the Molmo2 recipe.

Text side

No intended text-side change. The only edits to shared text code:

  • OLMoDDPTrainModule gets an inert hook _frozen_model_param_state_dict() (returns {}) that save_state_dict_direct merges into the save dict. The base behaviour is unchanged. Main's checkpoint_save_failure_test.py builds a spec'd Mock module, so I added the hook to those 4 mocks.
  • distributed/utils.py: restores reduce_distributed_failure_flag, used by multimodal loss-group normalization so a malformed batch on one rank fails every rank instead of hanging NCCL.
  • Other OLMoDDP edits are optional arguments defaulting to the old behaviour.

Differences from vision

Testing

CPU, src/test/{internal,train,optim,nn/ddp,nn/vision,data/multimodal} plus multimodal_lm_evaluator_test: 1297 passed, 107 skipped, 9 failed before the fix below. Of those failures:

ruff, black, isort and mypy src/ (CI config) are clean.

Not run yet: GPU parity/smoke for this layer. On vision, #902 and later alignment runs passed; I will add a Beaker smoke here before review.

@jason718 jason718 self-assigned this Oct 25, 2026
@jason718
jason718 force-pushed the jasonr/molmo2-stage12-data branch from b1fa5e3 to 401361c Compare October 28, 2026 23:35
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch from 824e34b to cfaf6a2 Compare October 28, 2026 23:35
@jason718
jason718 force-pushed the jasonr/molmo2-stage12-data branch from 401361c to c58653d Compare October 28, 2026 23:36
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch from cfaf6a2 to 1002cac Compare October 28, 2026 23:36
@jason718
jason718 force-pushed the jasonr/molmo2-stage12-data branch from c58653d to 1e2de64 Compare October 30, 2026 02:56
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch from 1002cac to 21eb8dc Compare October 30, 2026 02:56
@jason718
jason718 force-pushed the jasonr/molmo2-stage12-data branch from 1e2de64 to 7d5f498 Compare November 8, 2026 00:31
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch from 21eb8dc to bbfd53d Compare November 8, 2026 00:31
jason718 added a commit that referenced this pull request Nov 10, 2026
…1.py (#913)

## Summary

PR 4 of 7 for moving the Molmo2 stage-1 reproduction from the long-lived
`vision` branch onto `main`. #910 (model), #911 (train module) and #912
(data core) are merged; this PR adds the **stage-1 recipe** that makes
them runnable end to end: the datasets, the mixtures, and
`Molmo2-Stage1.py`.

About 6.7k source lines and 4.8k test lines. It also restores one fix
needed for the recipe to train correctly: activation-checkpoint RNG
replay (see "Why the RNG fix is here"). Almost all of it is new files;
the only existing files touched are listed under "Read closely" below.

## Review map

Reading every file closely is not necessary. Here is where attention
pays off.

### Read closely (about 1.9k lines)
| File | Lines | What to check |
|---|---|---|
| `scripts/train/Molmo2-Stage1.py` | 1537 | The recipe itself: the `v1`
/ `v2` / `v3` mixture rates, step counts, optimizer groups and learning
rates, the `--init_from` paths, and the launch settings. This is where a
wrong constant changes the training run silently. |
| `train/callbacks/unsharded_export.py` | 128 | Writes
`model.safetensors` and a config copy into each permanent checkpoint
from a background op on rank 0; skips ephemeral checkpoints. Moved here
from #911 because the stage-1 script is its only user. |
| `distributed/checkpoint/__init__.py` | +30 |
`load_unsharded_model_state()`: the only change to a shared distributed
module. Additive. |
| `nn/transformer/model.py` (+`ac_rng_test.py`) | +24 / -4 | Activation
checkpointing now preserves the RNG state when dropout is active
(`masked_dropout`, `ResidualStream` dropout, `nn.Dropout`), so the
recomputed forward replays the original dropout masks. Required by this
recipe; see below. |
| `data/multimodal/__init__.py`, `sequence_builder.py` | +92 / +4 |
Exports, and a type annotation on `build_branched_sequence` that already
accepted multi-turn branches. No behaviour change. |

### Skim for the shared pattern (about 4.9k lines of dataset code)
These are adapters. Each one defines a config dataclass and a map-style
dataset, formats its rows into the stage-1 prompt family, builds the
sequence with the #912 builders, and truncates with `truncate_example`.
Seven of them (`academic_dataset`, `gui_syn`, `ocr_caption_tars`,
`olmocr`, `pixmo_points_v2`, `synthetic_ocr`, `text_rich_caption`) use
the `EpochSeededExamples` mixin from #912 for epoch-aware sampling; the
others do not sample per epoch. If one is right, the rest are
variations.

| Group | Files |
|---|---|
| Pointing and counting | `pixmo_points.py` (433), `pixmo_points_v2.py`
(579), `gui_syn.py` (243), `detect_counting_question.py` (82) |
| OCR | `olmocr.py` (328), `ocr_caption_tars.py` (366),
`synthetic_ocr.py` (384), `text_rich_caption.py` (200),
`mixtures/ocr.py` (245) |
| Academic QA | `academic/registry.py` (611), `academic_dataset.py`
(179), `academic/formatters.py` (102), `mixtures/stage1_academic.py`
(149) |
| Other sources | `pixmo_clocks.py` (145), `pixmo_cap_qa.py` (104),
`pixmo_ama.py` (96), `tulu.py` (173), `finevision.py` (249),
`mmfinereason.py` (218) |

### Tests (about 4.8k lines)
They mirror the modules above (one test file per dataset group), plus
`molmo2_training_logits_parity_test.py` (GPU, needs the HF checkpoint)
and the callback and distributed-checkpoint tests. A test that needs
Weka data skips when the data is absent.

### Invariants the design relies on (worth a spot check)
These are stated in the script's docstring and should hold across every
file:
- Every default source is a **train split only**; the training set of a
benchmark the stage-2 checkpoints are evaluated on is never a stage-1
source.
- OCR and academic sources use a **style tag as the whole user turn**,
with no question text.
- Data lives on Weka, so datasets read paths from `paths.py` (#912) and
nothing here needs S3 or GCS secrets.
- Mixture rates per recipe are as in the script's docstring: `v1`
caption 0.6 / pointing and counting 0.3 / text 0.1; `v2` caption 0.5 /
pointing 0.25 / OCR 0.25; `v3` caption 0.33 / pointing 0.16 / OCR 0.34 /
academic 0.14 / clocks 0.03.

## Series

| # | PR | Status |
|---|---|---|
| 1/7 | #910 Model: HF Molmo2 loader, flex attention, split-vocab
embedding | merged |
| 2/7 | #911 Train module, `PerGroupScheduler`, weighted CE | merged |
| 3/7 | #912 Data core | merged |
| 4/7 | #913 Stage-1 recipe **(this PR)** | review |
| 5/7 | #934 Data infrastructure, stage-2 recipe, Qwen3-0.6B / 1.7B
sizes | draft, stacked on this PR |
| 6/7 | #936 OLMo 3.5 alignment training: OLMoDDP hooks and train
module, optimizer, callbacks, alignment pipeline | draft |
| 7/7 | #937 In-repo evaluation suites and remaining tools | draft |
| 8 | #938 Stable mixed mid-training (from #916) | draft |
| 9 | #939 Still-changing mixed mid-training (from #916) | draft |

PRs 5 to 7 bring the rest of `vision` onto `main`, so that `main` can do
everything `vision` can. Separate: activation-checkpoint RNG replay for
`ResidualStream.masked_dropout` is already in this PR; #906 (open) will
need a rebase on it.

## Why this is a separate PR

- It is the bulk of the series, but the review is mostly
pattern-checking, and it is the only part that depends on external data
locations and recipe choices.
- It can be iterated (new datasets, recipe tweaks) without touching any
core API from #910 to #912.
- It is what makes stage 1 runnable, so it is where the end-to-end
evidence belongs.

## Does this change anything on `main` / the text side?

No intended text-side change. The shared files it touches are the
additive checkpoint helper, the callbacks `__init__` export, a type
annotation, and the activation-checkpointing change in
`nn/transformer/model.py`. That last one changes behaviour only for
models that use dropout together with activation checkpointing (their
recompute now replays the dropout masks, which it previously did not);
with `dropout=0`, the default, text models are unaffected. For the
series as a whole, text-side outputs (weights, logits, loss and
gradients) were compared bit for bit against `main` on CPU and match,
and the existing test suites show no regressions. Text GPU and
distributed paths (FSDP2, TP, CP) cannot run on the CPU box I used, so
CI's GPU jobs are the check there.

## Why the RNG fix is here

Stage 1 trains with full activation checkpointing and 10% response-token
residual dropout. Without replaying the RNG, the recompute draws
different dropout masks than the original forward, so gradients are
taken against a different sample than the loss. This was held out of
#910 because #906 (open) rewrites the same lines; the end-to-end parity
run below showed it cannot be left out of the recipe: without it the run
trains much worse than `vision` (final loss 1.83 vs 1.19). The change
here is `vision`'s own fix (#828) unchanged, with its test. #906 fixes
the general case differently and will need a rebase on top of this.

## Not included (stays on `vision`)

Stage 2 (`Molmo2-Stage2.py`, `image_only_v9`, multi-image datasets,
`compare_sft_example.py`), the stage-1 data infrastructure upgrades, and
the OLMo 3.5 alignment work; see the plan above.

## Testing

**CPU:** `src/test/data`, the callback and distributed-checkpoint tests:
462 passed, 0 failed (before the last test-only fix below). ruff, black,
isort and `mypy src/` (the CI config) are clean. `Molmo2-Stage1.py
dry_run` resolves for the default, `--recipe=v2` and `--recipe=v3` (32k
and 50k steps). One test (`test_st_qa_train_validation_split`) read a
Weka path with no skip, which failed on the CI runner; it now skips when
the data is absent.

**GPU smoke (Beaker, 8x GPU, FSDP2):** an earlier 30-step run of the
stack: CE loss 3.23 → 2.57, checkpoint and unsharded export written.

**End-to-end parity on Beaker** (`ai2/molmofication`, Holmes, allocated,
`--recipe=v3`, 1 node x 8 GPUs, 2000 steps, same seed and arguments; W&B
disabled because `BeakerCallback.pre_train` calls `wandb.Run.get_url()`,
which the image's `wandb` lacks, existing code unrelated to this
series). V is the control: `vision` at the commit this series was cut
from.

| Run | Code | Result |
|---|---|---|
| [V](https://beaker.org/ex/01M5N24PSKG4EYXQNXQ7KK45XC) | `vision` @
`f639a28` (control) | CE 3.16 -> 1.20 |
| [P](https://beaker.org/ex/01M5N222MQ1JSY1TBDWY3YZBEY) | this PR
**without** the RNG fix | trains worse than V, gap grows: +0.05 (steps
1-50), +0.41 (201-500), +0.60 (1501-2000); final-100-step CE 1.83 vs
1.20 |
| [P2](https://beaker.org/ex/01M5NWNH21XHNA9WFKPJRARQHS) | this PR
**with** the RNG fix | tracks V |

Windowed mean CE, with the fix (P2) against the control (V):

| steps | P2 | V | P2 - V |
|---|---|---|---|
| 1-50 | 2.619 | 2.619 | +0.000 |
| 51-200 | 2.114 | 2.096 | +0.018 |
| 201-500 | 1.638 | 1.640 | -0.002 |
| 501-1000 | 1.326 | 1.315 | +0.011 |
| 1001-1500 | 1.248 | 1.238 | +0.011 |
| 1501-2000 | 1.199 | 1.201 | -0.002 |

Last 100 steps: P2 1.192, V 1.197. The offset has no trend (-0.002 per
1000 steps; without the fix, +0.195 per 1000 steps). Two identical-code
runs (P and R1) differ by about 0.015 per logged point, so window means
agree within about that. Per-point differences between P2 and V are
larger (stdev 0.057) because the data draws differ on purpose: the
review fixes made PixMo-Cap sampling epoch-aware.

Caveats: one run per arm. The gradient norm is spiky; P2 had two
transient spikes (step 300: 30, step 455: 37.6) that V did not, with
normal loss at those steps and clipping at 1.0 (the unfixed run spiked
as high as 165). I cannot tell noise from a small residual difference
from single runs.

**Checkpoint and resume:** run
[R1](https://beaker.org/ex/01M5N222PV51TWTJ7YR9KXWWNP) (1000 steps)
wrote a checkpoint;
[R2](https://beaker.org/ex/01M5NS0S9NSNFQGJBQVDGF2ENE) resumed it from
step 1000 to 2000 (first logged step 1005). Over steps 1001-2000 its
loss differs from the uninterrupted run P by +0.003 on average (stdev
0.013), inside the same-code noise. The unsharded `model.safetensors`
export was written. This pair ran on the code before the RNG fix; resume
does not depend on it, but I have not rerun it on the final code.

**Second parity check: Qwen3-0.6B on 2 nodes (16 GPUs), against a
finished `vision` run.** This covers paths the 4B runs above did not:
`response_logits_only=true`, no activation checkpointing, and 16-GPU
FSDP. Reference: `molmo2-stage1-0p6b-v3-50k-20261023` (`vision` HEAD),
whose per-step training loss is readable from its W&B files. Test:
[`mm-e2e-0p6b-main-2k`](https://beaker.org/ex/01M5QC1TVNGX0R8CXF8VZ725C5),
this branch plus `vision`'s #933 (the 0.6B size) cherry-picked, with the
reference's launch arguments, image and environment, stopped at step
2000 by `hard_stop` while keeping its 50k-step LR schedule. Windowed
mean CE:

| steps | run | reference | diff |
|---|---|---|---|
| 1-50 | 4.580 | 4.595 | -0.015 |
| 51-200 | 2.722 | 2.729 | -0.007 |
| 201-500 | 2.383 | 2.380 | +0.002 |
| 501-1000 | 1.738 | 1.737 | +0.002 |
| 1001-2000 | 1.519 | 1.520 | -0.002 |

Last 100 steps: 1.443 vs 1.458; trend of the difference -0.006 per 1000
steps; loss finite throughout. Per-point differences between the two
runs have stdev 0.093, which matches what two independent runs of the
same curve should give (the reference's own per-step noise is about
0.064, so about 0.09 for a difference). Caveat: the reference ran
`vision` HEAD, which includes data-code changes made after this series'
cut point (#902, #903, #918), so this is a sanity check of overall
health, not an apples-to-apples control; the rigorous rerun comes once
those changes land on `main`.

**Offline check, no GPU:** one training step of a tiny multimodal model
on `vision`@cut and on this branch (dropout off) produces bit-identical
loss, gradients and updated weights, so the model and train-module path
is unchanged apart from the RNG fix.

**GPU logit parity vs HF Molmo2 (4B and 8B pass; O-7B skipped):** see
#910.

**Not covered:** long-horizon loss parity against the released
Molmo2-4B-Pretrain recipe (these are 2000-step checks); GPU text-side
paths beyond CI; a resume rerun on the final code.
@jason718
jason718 force-pushed the jasonr/molmo2-stage12-data branch from 7d5f498 to 8e0ebfe Compare November 10, 2026 20:26
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch 3 times, most recently from 463d8fe to 3a1eec9 Compare November 13, 2026 03:59
@jason718
jason718 force-pushed the jasonr/molmo2-stage12-data branch from 5573654 to 4982b4a Compare November 14, 2026 02:38
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch from 3a1eec9 to 0708bf6 Compare November 14, 2026 02:38
@jason718
jason718 force-pushed the jasonr/molmo2-stage12-data branch from 4982b4a to fc91cba Compare November 16, 2026 03:38
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch 3 times, most recently from f0b87a6 to 6215245 Compare November 20, 2026 07:02
@jason718
jason718 force-pushed the jasonr/molmo2-stage12-data branch from c332a9d to c3aef42 Compare November 25, 2026 08:16
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch 3 times, most recently from c723b08 to 87b10d0 Compare November 30, 2026 12:41
Base automatically changed from jasonr/molmo2-stage12-data to main November 30, 2026 12:58
jason718 added a commit that referenced this pull request Nov 30, 2026
…1.7B sizes (#934)

## Summary

PR 5 of 7 for moving the Molmo2 reproduction from the long-lived
`vision` branch onto `main`. **#913 (stage-1 recipe) is merged, so this
targets `main` directly**; the diff here is only this PR's change. This
PR brings the multimodal **data pipeline up to `vision`'s current
state** and adds the **stage-2 recipe**, plus the Qwen3-0.6B / 1.7B
model sizes:

- **Epoch-aware, resumable mixture loading** (`mixture_data_loader`,
`alignment.py`, `mixture_weights`, `packing`, `rng`): per-source epochs
(`get(index, epoch)`), configurable `MultimodalMixtureConfig` /
`MultimodalSourceConfig` mixtures, loader state that resumes mid-epoch.
- **Message layouts** (`document_layout`, `qwen3_layout`,
`molmo2_tokens`: `Molmo2TokenIds`, `prepare_molmo2_tokenizer`): the
released `qwen3` layout and a `document` layout, selected per source.
- **Truncation and sampling** (`sft_common`, `pixmo_cap`,
`message_sequence`, `collator`): `truncate_example(...,
recompute_root_subsegments=...)` and `truncate_for_format`;
`sft_example_rng`.
- **Stage-1 data updates** from `vision`: `pixmo_points`,
`pixmo_points_v2`, `finevision`, `fs_cache`, and small updates to the
OCR, academic and text-rich sources.
- **Stage 2:** `Molmo2-Stage2.py`, the `image_only_v9` mixture,
multi-image datasets, `mm_olmo_loader`, and the `sft_demo` mode of
`PixMoCapDataset`.
- **Model sizes:** `MultimodalLMConfig.molmo2_0_6B()` / `molmo2_1_7B()`
and `--model_size=0.6b|1.7b` in `Molmo2-Stage1.py`.

About 5.4k source lines and 3.7k test lines in 56 files. Everything is
opt-in; existing behaviour on `main` does not change.

## Review map

Reading every file closely is not necessary.

### Read closely
| File | Lines | What to check |
|---|---|---|
| `data/multimodal/mixture_data_loader.py` | +925 / -79 | The loader's
state, epoch and resume semantics, and how per-source epochs reach
`get(index, epoch)`. The most behaviour-sensitive file in the PR. |
| `data/multimodal/sft_common.py` | +174 / -32 | `truncate_example`
(rejects cutting any image-structural token; rescales branch weights
only when `recompute_root_subsegments=True`) and `truncate_for_format`.
Replaces the weighting-aware version added in #912's review; same
behaviour, `vision`'s API. |
| `data/multimodal/pixmo_cap.py` | +293 / -37 | Routes through the
shared `truncate_example` (the local copy that always rescaled is gone);
`sft_demo` now truncates; `__getitem__` uses the dataset's current
epoch. |
| `data/multimodal/packing.py`, `collator.py` | +150 / +41 | Packing
contract; the collator still refuses to cut `<im_patch>` tokens (from
#912's review). |
| `scripts/train/Molmo2-Stage2.py` | 564 (new) | The stage-2 recipe:
mixture, optimizer groups, learning rates, launch settings. |
| `nn/vision/multimodal.py`, `molmo2_tokens.py` | +80 / +118 | The
model-side pieces the new data pipeline needs (0.6B / 1.7B factories,
token ids). Only the data-pipeline and size parts of `vision`'s file are
here. |

### Skim for the shared pattern
`pixmo_points.py` (+1005), `finevision.py` (+334), `pixmo_points_v2.py`
(+135), `multi_image_datasets.py` (289 new), `mixtures/image_only_v9.py`
(360 new), `alignment.py` (314 new), `message_sequence.py`,
`document_layout.py`, `fs_cache.py`, and small updates to
`text_rich_caption`, `ocr_caption_tars`, `olmocr`, `synthetic_ocr`,
`academic_dataset`. These are dataset adapters and mixture definitions
that follow one shape; if one is right, the rest are variations.

### Tests (about 3.7k lines)
One test file per module group, plus `molmo2_tokens_test`,
`molmo2_native_config_test` (now covers 0.6B / 1.7B) and the model-size
test for the stage-1 script.

## Series

| # | PR | Status |
|---|---|---|
| 1/7 | #910 Model: HF Molmo2 loader, flex attention, split-vocab
embedding | merged |
| 2/7 | #911 Train module, `PerGroupScheduler`, weighted CE | merged |
| 3/7 | #912 Data core | merged |
| 4/7 | #913 Stage-1 recipe | merged |
| 5/7 | this PR: data infrastructure, stage-2 recipe, 0.6B / 1.7B sizes
| approved |
| 6/7 | #936 OLMo 3.5 alignment training: OLMoDDP hooks and train
module, optimizer, callbacks, alignment pipeline | draft |
| 7/7 | #937 evals, mixed mid-training (from #916), catch-up with #916 |
draft |

With PRs 6 and 7, `main` reproduces everything on `vision`, apart from
the intentional divergences below.

## Why this is a separate PR

- It is the data and recipe layer that every later PR builds on, and it
can be checked without any OLMo 3.5 or OLMoDDP code.
- The loader and truncation changes are behaviour-sensitive and deserve
a focused review, separate from #913's recipe.
- Stage 2 only needs this data layer, so it lands here and not behind
the alignment work.

## Does this change anything on `main` / the text side?

No. This PR adds files under `data/multimodal/`, `nn/vision/` and
`scripts/`; `nn/transformer`, `optim`, `train` and the text data
pipeline are untouched. Only multimodal entry points change behaviour.

## Behaviour added or fixed during review

These are in the final diff; each has a test that fails without it.
- **Epochs reach every source.** `sft_example_rng` varies Qwen-layout
streams with the epoch (epoch 0 is the unchanged stream, so first passes
are identical). Points, Count, CoSyn and FineVision honor `set_epoch`,
which the default (non-continuous) loader calls; GUISyn builds per
explicit epoch; selected sources forward the epoch. A scan test fails
for any source with an epoch-taking `get` but no `set_epoch` (the
alignment and mid-training sources run with `continuous_stream=True` and
are excluded).
- **Truncation is independent of strict validation**
(`pixmo_points._finalize_example`), and multi-image examples longer than
the recipe's length are truncated or rejected so the loader skips them
instead of the collator stopping the run. The collator's image-patch id
follows the mixture's `token_ids`.
- **Resume identities.** FineVision fingerprints every source with a
stable Arrow fingerprint and binds it to the token ids;
`strict_annotations=True` requires `skip_bad_rows=False`; a row
selection over an unpinned source advertises no fingerprint.
- **Mixture and stage-2 plumbing.** Subset mixtures open only the groups
they need; Stage 2 derives source names from the registry order
(matching the datasets returned) without opening sources twice; the
stage-2 registry test skips without Weka data.

## Intentional divergences from `vision`

Where `vision` and `main` differ on purpose:
- **No HF export direction** (`multimodal_lm_state_dict_to_hf`) and no
`output_vocab_size` logit masking: both were removed in #910's review.
Nothing on `vision` calls either.
- **Reviewed fixes kept:** the collator's image-token guard, and
PixMo-Cap's truncation through the shared function (the weighting-off
fix).
- **Type-only fixes** so `mypy src/` passes (annotations in tests and
the stage-2 script, an undefined `Molmo2TokenIds` annotation in
`sft_common`, which was a latent lint error on `vision`).
- **Not in this PR:** the B-side parts of `vision`'s `multimodal.py` and
the data package exports (OLMoDDP model, document-mode attention, replay
datasets), which arrive with PR 6.

## Testing

CPU on the final tip: `src/test/{data/multimodal,scripts,nn/vision}` 665
passed, 26 skipped, 1 failed. The failure, `test_clip_parity`, is
environment-only and fails the same way on `main` on the dev box. ruff,
black, isort and `mypy src/` (CI config) are clean.
`package_import_test` runs subprocess imports with a 45 s timeout that
the slow dev box exceeds, so it was checked separately with a longer
timeout; CI runs it as is.

**GPU parity (Beaker
[`mm-e2e-0p6b-A-2k`](https://beaker.org/ex/01M5RK532QEWWEVZG8S6HG2S0W),
0.6B, 2 nodes, 2000 steps, this PR's code) vs the `vision` reference run
`molmo2-stage1-0p6b-v3-50k-20261023`:** windowed mean train CE,
2026-10-25.

| steps | this PR | reference | diff |
|---|---|---|---|
| 1-50 | 4.623 | 4.595 | +0.027 |
| 51-200 | 2.720 | 2.729 | -0.008 |
| 201-500 | 2.371 | 2.380 | -0.010 |
| 501-1000 | 1.739 | 1.737 | +0.002 |
| 1001-2000 | 1.530 | 1.520 | +0.010 |

Per-point diff over 401 logged steps: mean +0.004, stdev 0.099
(independent runs of this size differ by about this much per point). All
windows after warm-up are within ±0.015, the noise floor for identical
code. Caveats: one run per arm, loss only (no downstream eval), and the
run is of an earlier tip. The later review fixes change only Qwen-layout
draws from epoch 1 on (epoch 0 is bit-identical, tested against
`example_rng`), and I did not rerun parity after them.
@jason718
jason718 force-pushed the jasonr/molmo2-alignment-training branch from 87b10d0 to dedd1f0 Compare November 30, 2026 13:02
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.

1 participant