Skip to content

Add Dolma 3 sample, and a way to alias data mixes - #412

Merged
dirkgr merged 13 commits into
mainfrom
add-olmo-mix-0625-150bsample
Oct 6, 2025
Merged

dirkgr merged 13 commits into
mainfrom
add-olmo-mix-0625-150bsample

Conversation

@dirkgr

@dirkgr dirkgr commented Oct 4, 2025

Copy link
Copy Markdown
Contributor

No description provided.

dirkgr and others added 6 commits October 1, 2025 12:11
This adds a new 153B token sample data mix from the dolma2-0625 dataset.

The mix includes 6,967 files from 6 data sources:
- finemath-3plus: 128 files
- arxiv: 35 files
- wikipedia: 63 files
- all-dressed-snazzy2: 3,072 files (24 categories)
- s2pdf: 2,689 files (23 categories)
- stack-edu: 980 files (15 programming languages)

All files are located at s3://ai2-llm/preprocessed/dolma2-0625/v0.1-150b/
and have been verified to exist.

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

Co-Authored-By: Claude <[email protected]>
Update file paths to point to the actual files in S3 at preprocessed/dolma2-0625/v0.1-150b/allenai/dolma2-tokenizer/. Includes all sections: finemath-3plus, arxiv, wikipedia, all-dressed-snazzy2, s2pdf-redacted, and stack-edu.

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

Co-Authored-By: Claude <[email protected]>
Implement _missing_ method to support aliases for data mix names. For example, "dolma3-0625-6T-mix" is now an alias for "OLMo-mix-0625". Aliases are resolved to the same enum member, ensuring proper identity and equality checks.

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

Co-Authored-By: Claude <[email protected]>
@dirkgr
dirkgr requested a review from soldni October 4, 2025 00:00
cursor[bot]

This comment was marked as outdated.

v3_small_ppl_validation = "v3-small-ppl-validation"
OLMo_mix_0625 = "OLMo-mix-0625"
OLMo_mix_0925 = "OLMo-mix-0925"
OLMo_mix_0625_150Bsample = "OLMo-mix-0625-150Bsample"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Alternatively could add more values to the enum that map to the same string, eg:

OLMo_mix_0625_150Bsample = "OLMo-mix-0625-150Bsample"
dolma3-0925-150B-mix = "OLMo-mix-0625-150Bsample"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You can't have a member named "dolma3-0925-150B-mix" because of the minus signs.

OLMo_mix_0625_150Bsample = "OLMo-mix-0625-150Bsample"

@classmethod
def _missing_(cls, value: object) -> "DataMix | None":

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.

TIL about this!

@dirkgr
dirkgr enabled auto-merge (squash) October 6, 2025 20:57
@dirkgr
dirkgr merged commit cdb7922 into main Oct 6, 2025
@dirkgr
dirkgr deleted the add-olmo-mix-0625-150bsample branch October 6, 2025 21:02
@github-actions

Copy link
Copy Markdown

This PR has been released in v2.3.0.

b-dickson pushed a commit to b-dickson/OLMo-core that referenced this pull request Jan 26, 2026
jason718 added a commit that referenced this pull request Oct 2, 2026
… steps); drop TallyQA's COCO val2017 images (#887)

Based on `vision` at 05885ef (after #875, #893, #894 and the v3.0.0
main sync).

Stage 1 is going to be mixed into text midtraining, which has about 100B
text tokens, so it needs more distinct multimodal data than PixMo-Cap's
~717k images, which a stage-1 run already sees about 4 times. This PR
adds:

1. **An academic QA group** (`--academic_rate`): stage 2's large
synthetic QA sets, copied into stage 1 (stage 2 keeps them). The
training set of a benchmark stage 2 is evaluated on is never a source.
2. **A PixMo-Clocks group** (`--clock_rate`), so clock reading can be
learned without stage 2.
3. **A `v3` recipe** for 50,000 steps: caption 0.33, pointing and
counting 0.16, OCR 0.34, academic QA 0.14, clocks 0.03. The default
recipe stays `v1` at 32,000 steps.
4. **TallyQA without COCO val2017 images.** This changes stage 2 too,
which reads TallyQA's train split.

It also makes the stage-1 prompt family tag every style, which the new
sources depend on ([Prompt](#prompt)).

## Results

The v3 run `molmo2-stage1-4b-v3-50k-20260930`
([beaker](https://beaker.org/ex/01M3R9285B5GT234XXQ644NSR8), 4×8 B300 on
holmes, 50k steps, finished 2026-10-01) trained this PR's code at
`163d1c1f9` (this PR plus #893). Every file this PR touches is identical
to the launch commit, except the removal of the unused share caps, which
leaves the mixture weights unchanged (max difference 6e-17).

All rows are from olmo-eval #412 with the stage-1 prompts (`-o
prompt_templates=none -o system_prompt_style=style_and_length_v2`). v3
and the released checkpoint were scored at #412's `5fc8fa21`. v1 and v2
were scored on 2026-09-27 at `f1f3b2b3`; the caption, pointing and
counting task code is the same at both commits.

| Metric | Released Molmo2-4B-Pretrain | v1 32k | v2 32k | **v3 50k** |
|---|---|---|---|---|
| Caption avg | **57.7** | 57.1 | 56.9 | 56.8 |
| Caption recall | **44.3** | 43.1 | 43.1 | 43.6 |
| Caption consistency | **71.1** | 71.0 | 70.8 | 69.9 |
| PixMo-Points F1 | **81.5** | 78.4 | 79.4 | 78.2 |
| SA-Co Gold subset F1 | 66.3 | 62.0 | **68.1** | 67.2 |
| SA-Co Gold 4k F1 | 55.7 | 54.0 | **83.7** | **83.7** |
| SA-Co Gold 4k absent-object accuracy | 48.0 | 46.1 | 84.3 | **84.7** |
| PixMo-Count val | 88.5 | 89.6 | 90.4 | **91.3** |
| PixMo-Count test | **88.0** | 87.8 | 87.6 | 85.2 |
| olmOCR-Bench | 26.5 | 26.5 | 51.1 | **54.0** |
| CC-OCR multi-scene, English (macro F1) | 19.6 | 6.1 | 78.4 | **79.2**
|
| OmniDocBench v1.6 English, text edit (lower is better) | 0.971 | 0.980
| 0.247 | **0.211** |
| OmniDocBench v1.5 English, text edit (lower is better) | 0.970 | 0.979
| 0.236 | **0.212** |

* **OCR improves.** Against v2: olmOCR-Bench +2.9, CC-OCR +0.8, and
OmniDocBench text edit 0.036 lower on v1.6 and 0.024 lower on v1.5. With
formula grading (CDM), v3's OmniDocBench overall is 66.7 on v1.6 and
70.3 on v1.5. The v1/v2 eval skipped CDM, so OmniDocBench is compared on
text edit only. 9 of the 755 v1.6 pages failed to score for v3.
* **Caption and pointing are flat to about 1 point lower.** Caption avg
is 56.8 against v2's 56.9 (recall +0.5, consistency −0.9). PixMo-Points
F1 is −1.2 and the SA-Co subset −0.9; SA-Co 4k is unchanged. v3 sees
caption and pointing data about as often as v2 does (4.2 and 4.4
passes), at lower rates over more steps.
* **Counting is mixed.** Val is +0.9 and test −2.4. All answers parse.
* **Longer training would not help.** v3 at step 40,000 is within about
1 point of step 50,000 on every caption, pointing, olmOCR-Bench and
CC-OCR metric (OmniDocBench was not run at 40k). v2's 24k, 28k and 32k
checkpoints were also within about 1 point of each other.
* **The released checkpoint** was trained on 0.6 caption and 0.3
pointing. It still leads on caption (+0.9 avg over v3) and PixMo-Points
(+3.3), but its SA-Co 4k score is 28 points lower: it handles only 48%
of absent-object queries correctly, against v3's 85%. It has no OCR
training. Its scores reproduce mm_olmo's own eval of it: PixMo-Points
81.5 vs 81.6, SA-Co 4k 55.7 vs 55.5. Its caption prompt here is
`long_caption:` rather than the `long_caption 65:` it was trained on;
mm_olmo with that prompt gets avg 58.1 and recall 45.6.
* **What these evals do not measure** is the academic QA group (9.1% of
v3's loss). Its effect, if any, shows after stage 2 or midtraining.

## Which stage-2 sets go into stage 1

**Rule: the training set of a benchmark the stage-2 checkpoints are
evaluated on stays stage-2 data.** The stage-2 image evals (mm_olmo
`eval_molmo2.py` `IMAGE_TASKS` / `TEST_IMAGE_TASKS`) are VQAv2, TextVQA,
ChartQA, DocVQA, InfographicVQA, AI2D, A-OKVQA, MMMU, RealWorldQA,
MathVista, Point-Bench, CountBenchQA and PixMo-Count.
`STAGE2_EVAL_TRAIN_SETS` lists the sets this rule keeps out, and both
the dataset class and the training script refuse them:

| Stays in stage 2 | Train images | Benchmark |
|---|---|---|
| `coco_2014_vqa_multi` | 82,783 | VQAv2 |
| `doc_qa` | 39,463 | DocVQA |
| `text_vqa` | 34,602 | TextVQA |
| `chart_qa_weighted` | 28,299 | ChartQA |
| `info_qa` | 23,946 | InfographicVQA |
| `a_okvqa_mc` / `a_okvqa_da` | 17,056 | A-OKVQA |
| `ai2_diagram_v2_mix_transparent` | 15,042 | AI2D |
| `tally_qa` | 127,867 (after the filter below) | VQAv2, through shared
val2014 images |

The rest of stage 2's single-image academic data becomes the stage-1
group. The group's rate is split by sqrt(size), with stage 2's row caps
(`image_only_v9` `root_size_factor`) on the three templated chart sets.
Without the caps, those sets would take 44.0% of the group instead of
18.8%:

| Source | Train images | Weighted as | Share of group | Share of v3
mixture |
|---|---|---|---|---|
| `cosyn_chart_exp` | 116,814 | 116,814 | 18.83% | 2.64% |
| `cosyn_document` | 71,282 | 71,282 | 14.71% | 2.06% |
| `cosyn_math_exp` | 66,714 | 66,714 | 14.23% | 1.99% |
| `cosyn_table_exp` | 46,518 | 46,518 | 11.88% | 1.66% |
| `cosyn_diagram_exp` | 34,963 | 34,963 | 10.30% | 1.44% |
| `cosyn_music_exp` | 11,969 | 11,969 | 6.03% | 0.84% |
| `cosyn_chemical_exp` | 8,942 | 8,942 | 5.21% | 0.73% |
| `plot_qa` | 157,070 | 20,000 | 7.79% | 1.09% |
| `dv_qa` | 200,000 | 10,000 | 5.51% | 0.77% |
| `figure_qa` | 100,000 | 10,000 | 5.51% | 0.77% |

* **PlotQA trains 20 of its questions per image per epoch**, drawn
afresh each epoch (`STAGE1_DEFAULT_MAX_QUESTIONS`; an explicit
`max_questions` still wins). Its images carry 131 questions on average,
and most full examples exceed the 2,560-token stage-1 sequence. With 20
questions, none of 300 sampled images overflowed (max 2,437 tokens).
* **Left out:** OKVQA, ST-VQA, ScienceQA and TabMWP (6k–25k images each,
too small to matter), and every multi-image source.
* **CoSyn is closest to the line.** Its chart, document and table
categories were built to improve ChartQA, DocVQA and InfographicVQA. It
is not their training split, so the rule allows it. It is the set to
drop first if the rule should be read more strictly.
* **Overlap with the OCR group:** 267,359 of CoSyn's 357,202 images are
also in the OCR group's figure-caption sources, so for those the group
adds QA on images v3 already describes. The images a v3 run sees only
through this PR: 546,913 (CoSyn's other 89,843, DVQA, FigureQA, PlotQA),
plus PixMo-Clocks.

## PixMo-Clocks: a group of its own

800,269 synthetic clock faces, all asking the same question. They teach
one narrow skill, so the group gets its own rate (`--clock_rate`; 0.03
in v3) instead of a share of the QA group. Clocks may later leave stage
2, which would leave stage 1 as the only place the model learns to read
them. v3 trains about 271k clock examples (0.34 passes). That is roughly
40–70% of what the released Molmo2-4B stage 2 trained, at 2.0% of v3's
tokens and 0.08% of its loss.

The user turn is `clocks: What time is being shown?` and the answer is
the time (`The time shown is 3:02 PM`). The question stays in because,
without stage 2, it would be the only clock question the model ever
sees. Naming `pixmo_clocks` in `--academic_sources` is refused with a
pointer to `--clock_rate`.

## The v3 recipe

`--recipe=v3` adds the academic and clock groups to v2 and raises OCR.
It runs 50,000 steps (`RECIPE_MAX_STEPS`; an explicit
`--trainer.max_duration.value` still wins). The rates were chosen
against the sources themselves: 80 sampled examples per source (all 27,
built as the script builds them), packed by the script's 2D-knapsack
packer (2,560 tokens, 27 crops). That gives 1.41 examples per sequence,
so 50k steps are 9.0M examples.

| | v2 (32k steps) | **v3 (50k steps)** |
|---|---|---|
| Rate: caption / pointing / OCR / academic / clocks | 0.50 / 0.25 /
0.25 / 0 / 0 | **0.33 / 0.16 / 0.34 / 0.14 / 0.03** |
| Loss share: caption | 55.1% | 39.2% |
| Loss share: pointing and counting | 18.5% | 12.8% |
| Loss share: OCR | 26.5% | 38.9% |
| Loss share: academic QA | | 9.1% |
| Passes over PixMo-Cap (715k) | 4.0 | 4.2 |
| Passes over the pointing sources (325k) | 4.4 | 4.4 |
| Passes over the OCR sources (3.09M) | 0.46 | **0.99** |
| Passes over the academic group (814k) | | 1.55 |
| Synthetic share of examples / loss | 22.6% / 20.7% | 44.0% / 38.5% |

* **OCR 0.34 gives one pass over the OCR group**: 3.07M OCR examples for
its 3.09M rows. The pass is uneven within the group, which is still
split by task and then sqrt(size). The figure captions get about 1 pass,
olmOCR documents 2.1, the small olmOCR subsets, TextOCR and the receipts
7–10, and NVIDIA's 1.46M synthetic images 0.32.
* **Most of the synthetic rise is OCR** (figure captions, NVIDIA,
receipts). CoSyn is 95% of the academic group's loss because its answers
carry explanations. DVQA, FigureQA, PlotQA and the clocks together are
about 0.5% of the loss.
* **For midtraining these are shares of the multimodal part.** If that
part grows, every pass count grows with it.

## Prompt

Stage-1 sources send a `"<style>:"` tag and no template. An academic
source sends the tag followed by the bare question:

| Source | User turn | Answer |
|---|---|---|
| `plot_qa` | `plot_qa: Is the sum of the use of imf credit in dod in
2003 and 2007 greater than ...?` | `Yes` |
| `dv_qa` | `dv_qa: What percentage of people like the least preferred
object in the whole chart?` | `10` |
| `cosyn_chart_exp` | `cosyn_chart_exp: What's the average investment in
Transportation between 2003 and 2022?` | `<explanation> Answer:
<answer>` |
| `pixmo_clocks` | `clocks: What time is being shown?` | `The time shown
is 3:02 PM` |

Two `SftFormatter` fixes for the stage-1 family
(`prompt_templates="none"`, `system_prompt="style_and_length_v2"`),
which had only been used with pointing data:

* **Every style is tagged.** Before, only the pointing styles got
`"<style>:"`. mm_olmo tags every style under this family; the length
number it adds to non-pointing styles is dropped here, as #875 dropped
it from the caption tag. That matches mm_olmo's molmo3 stage-1 family
(`style_and_length_v3`). The pointing sources are unaffected.
* **No chain-of-thought instruction under `"none"`**, as in mm_olmo
(`data_formatter.py:1933-1934`); the `*_exp` tag is what asks for the
explanation. The stage-2 family keeps the instruction.

Multiple choice under `"none"` raises `NotImplementedError` (mm_olmo's
`format_options` layout is not ported); no stage-1 source is multiple
choice.

## TallyQA: drop its COCO val2017 images

TallyQA's train split holds the 5,000-image COCO val2017 set, both under
2014 file names and through Visual Genome (`image_data.json` `coco_id`).
Those images are dropped; the rest of val2014 is kept.

| TallyQA train | Images | Questions |
|---|---|---|
| Total | 132,981 | 249,318 |
| COCO val2017 images under val2014 names | 4,052 | |
| Visual Genome images that are COCO val2017 images | 1,062 | |
| **Dropped** | **5,114** | **9,578** |
| **Kept** | **127,867** | **239,740** |

The ids come from COCO's `annotations/captions_val2017.json`. The filter
is in the registry's TallyQA loader (train split only), so
`image_only_v9` gets it too: TallyQA's sqrt(size) weight in stage 2
falls by 1.9% relative to the other academic sources. A missing held-out
file fails the build rather than skipping the check.

## Launch note: torchvision

`pixmo_clocks` imports torchvision only when it formats a clock image,
so v1/v2 runs don't need it. A run that trains clocks does. In the
`akshitab/olmo-core-tch2100cu130-2026-07-03` image, the package install
upgrades torch to 2.13.0 and leaves torchvision at 0.25.0, which fails
to import ("operator torchvision::nms does not exist"). The v3 run added
`torchvision==0.28.0` to `post_setup`. Stage 2 trains clocks too, so it
needs the same pin on that image.

## Verification

* `src/test/data/multimodal/`: **324 passed, 7 skipped** on CPU (torch
2.10, rebased branch). The skips are `h5py` / `pypdfium2`, not installed
here. `stage1_academic_test.py` (38 tests) covers:
  * the v3 recipe and its 50k steps, and PlotQA's default cap;
* the clock group: prompt, refusal as an academic source, rate
validation;
  * the prompt family and per-epoch question sampling;
* the TallyQA filter, on synthetic files and against weka (pins 127,867
kept images and 5,000 val2017 ids);
  * refusal of every stage-2 eval training set;
  * the group weights (CoSyn 81.2%, templated charts 18.8%).
* Real data: every v3 source built with the Qwen3 tokenizer as the
script builds it, and 80 examples encoded from each of the 27 for the
recipe numbers.
* black 23.12 and isort 5.13 pass. ruff 0.15.9 (the pinned version)
passes. mypy adds no errors: the changed files have 5 errors, against 7
on `vision`.

## Usage

```
python src/scripts/train/Molmo2-Stage1.py launch RUN --recipe=v3                 # 50k steps
python src/scripts/train/Molmo2-Stage1.py launch RUN --recipe=v3 --clock_rate=0.02
python src/scripts/train/Molmo2-Stage1.py launch RUN --recipe=v3 \
    --academic_sources=[cosyn_chart_exp,cosyn_document,cosyn_table_exp]
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants