Repository navigation
Conversation
This was referenced Oct 25, 2026
This was referenced Oct 26, 2026
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
October 28, 2026 23:35
824e34b to
cfaf6a2
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
October 28, 2026 23:35
f339491 to
4a7a238
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
October 28, 2026 23:36
cfaf6a2 to
1002cac
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
October 28, 2026 23:36
4a7a238 to
5cc87e3
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
October 30, 2026 02:56
1002cac to
21eb8dc
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
October 30, 2026 02:56
5cc87e3 to
6e570dc
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 8, 2026 00:31
21eb8dc to
bbfd53d
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 8, 2026 00:31
6e570dc to
bdb23e5
Compare
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
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 10, 2026 20:27
bbfd53d to
fe91673
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 10, 2026 20:27
bdb23e5 to
2490057
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 11, 2026 17:55
fe91673 to
463d8fe
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 11, 2026 17:55
abe7ac6 to
5659765
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 13, 2026 03:59
463d8fe to
3a1eec9
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 13, 2026 03:59
5659765 to
31ab45b
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 14, 2026 02:38
3a1eec9 to
0708bf6
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 14, 2026 02:38
31ab45b to
328e470
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 16, 2026 03:38
0708bf6 to
46be4b5
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 16, 2026 03:38
328e470 to
6579d2b
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 18, 2026 21:06
46be4b5 to
f0b87a6
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 18, 2026 21:06
6579d2b to
9164c45
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 20, 2026 07:02
f0b87a6 to
6215245
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 20, 2026 07:02
9164c45 to
77c2f91
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 25, 2026 08:16
6215245 to
1709eeb
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 25, 2026 08:16
77c2f91 to
3f5af19
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 30, 2026 12:25
1709eeb to
c723b08
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 30, 2026 12:25
3f5af19 to
ba2c43a
Compare
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 30, 2026 12:41
c723b08 to
87b10d0
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 30, 2026 12:41
ba2c43a to
10e1c1e
Compare
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.
…er vision encoder, crop balancing, batch prefetch
…5/v6 visual data, 256K text stage, compile_vision
…te-grad skip, EMo from the text config
…#916; its hero-phase tests fail without it)
jason718
force-pushed
the
jasonr/molmo2-alignment-training
branch
from
November 30, 2026 13:02
87b10d0 to
dedd1f0
Compare
jason718
force-pushed
the
jasonr/molmo2-complete-parity
branch
from
November 30, 2026 13:02
10e1c1e to
634bdb5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 7 of 7, the last PR in the series. Stacked on #936 (#910-#913 and #934 are merged). It replaces the old #937, #938 and #939, which are folded into this one. After it lands, the multimodal / OLMo 3.5 mid-training code that
visionand #916 have is onmain, andvisioncan be retired.It is large (about 16k lines, roughly half tests) but split into commits that review independently, in this order:
olmo_core/eval/{multimodal_checkpoint,multimodal_decoding,multimodal_panel,vision_fast_text,vision_decoded,vision_academic}.py,src/scripts/eval/Vision-Align-Eval.py(renamed fromVision-Align.py: mypy rejects two modules with that name),src/scripts/compare_sft_example.py,parity_artifact_test.py.src/scripts/train/Mixed-Midtraining.py,olmo_core.internal.vision_midtraining*, the merged MT+LC text side, the chunked weighted loss, compact image collation, crop balancing (Mixed midtraining: opt-in crop balancing for the vision encoder #923), the faster vision encoder and connector (Mixed midtraining: faster vision encoder and connector #924), child-process batch building (Mixed midtraining: opt-in batch building in a child process #925),olmo_core.kernels.layer_norm, cuDNN attention first on SM100, the dead-embedding-row clipping fix, anddocs/source/guides/mixed_midtraining.md.annotation_sampling="documents", stage-1 v5/v6 visual data, the 256K text stage (document masking, segment caps, 65k+ calibration),compile_vision, 2-ahead batch building (Mixed midtraining: build 2 rank batches ahead again #926).tokenizer.jsondefines it with a recalibrated visual calibration (Multimodal: load the tokenizer exactly as tokenizer.json defines it, and recalibrate #944), an opt-in skip of optimizer steps with a non-finite gradient norm, and routers taking EMo from the stage's text config (Mixed mid-training: routers take EMo from the stage's text config (on #916) #949).train_module.optim.skip_nonfinite_grad_stepswas missing fromMULTIMODAL_OVERRIDES, so [Do not merge yet] Mixed midtraining on OLMo 3.5: the OLMo-core side of scaling-ladders#83 #916's owntest_hero_phases_differ_from_the_text_config_only_by_the_override_tabletests fail on its head. [Do not merge yet] Mixed midtraining on OLMo 3.5: the OLMo-core side of scaling-ladders#83 #916 needs the same line.Text-side impact
nn/moe/emo.py,nn/moe/v2/emo_router.py,ops/moe.py,nn/transformer/model.py):Transformer.forwardaccepts an optionalemo_segment_ids; when it isNone(the default) the segment ids come from the EOS tokens exactly as before. The EMo router now computes its pools with a float64 prefix sum, which can change EMo routing numerics slightly for text runs too. I have not measured that effect, so treat it as a numerics change until someone does.mainhere (they came in via Fix OLMoDDP Torch 2.13 training and preserve HF inference numerics #885), so no other MoE change.olmo_core.kernels.layer_normis new and used only by the vision encoder. Everything else is multimodal-only code or optional arguments that default to the old behaviour.How it was ported
#916 sits on
vision, and the stack differs fromvisionon purpose, so each step is a per-file 3-way merge (base = the #916 state I ported from, ours = this stack, theirs = #916's head) and not a commit replay. Where #916's current code and the stack's differ, I took #916's version, except for review fixes already made in the stack. The one conflict in this round was the flex-mask guards innn/vision/multimodal.py; #916's version (sliding-window check applies in document mode too) was taken. The hero LM uses flash attention there, so it is not reachable. Type-only# type: ignore[...]lines were added to #916's untyped tests somypy src/passes.Testing
CPU,
src/test/{nn/moe,nn/transformer,internal,train,optim,nn/vision,data/multimodal,eval}on the combined branch before the one-line fix: 2215 passed, 230 skipped, 12 failed.test_clip_parity: environment-only; they fail the same way onmain.olmo3_rope_import_testyarn tests (KeyError: original_max_position_embeddings): they fail identically on today'smain(installedtransformersversion), so they are not from this PR.ruff, black, isort and
mypy src/(CI config) are clean.Parity evidence so far
Stage 1, Qwen3-0.6B, 2 nodes, 2000 steps (
mm-e2e-0p6b-C-2k, run on an earlier tip of this stack) vs thevisionreferencemolmo2-stage1-0p6b-v3-50k-20261023: windowed mean train CE within ±0.015 of the reference in every window after the first 50 steps (1001-2000: 1.530 vs 1.520). One run per arm, loss only.Not run yet: the hero-setting parity (two runs of #916 for the noise floor vs this stack, same text config, data and parent checkpoint, at small scale). It waits for the hero runs to finish, so this PR stays a draft until then.