Repository navigation
Stage 1: weight caption loss 1.25x - #861
Conversation
#842 matched the released weighting exactly -- no weighting on any source -- which puts captions at ~77.5% of the `sum(CE*w)/sum(w)` loss mass. That is the right default for reproducing the released recipe, but it left dense_caption ~0.9 below the released checkpoint while pointing and counting were at or above it. Weighting captions 1.25x lifts their share to ~81% and recovers most of that gap for a pointing cost at the noise floor. `PixMoCapDatasetConfig` gains a `message_weight` field (the pointing configs already had one), applied through the same path: branch scaling is already folded into `loss_masks` by `build_branched_sequence`, so only the example-wide multiplier is applied. The default stays `None`, i.e. released behaviour; only the stage-1 script opts in. Measured with two seeds per baseline arm, so every delta is quoted against its seed spread: +842 (n=2) 1.25x delta seed spread dense_caption avg 57.271 57.808 +0.537 0.085 recall 44.570 44.915 +0.345 0.193 consistency 69.973 70.701 +0.728 0.024 recall_at_10 85.761 86.243 +0.482 0.200 pixmo_points f1 0.7938 0.7847 -0.009 0.008 sa_co_gold f1 0.5537 0.5408 -0.013 0.011 pixmo_count 0.8991 0.8815 -0.018 0.006 countbench_qa 0.9378 0.9388 +0.001 0.002 The caption gain is ~6x its noise floor; the pointing losses are ~1x theirs. Caption consistency lands at 70.701 against the released 70.745, essentially parity, and sa_co `single` rises to 0.8919 (best of any run, released is 0.8832). `pixmo_count` is the one real cost at ~3x noise, though it stays at the released 0.8685 rather than below it. Standing against `Molmo2-4B-Pretrain` after this change: ahead on both counting benchmarks, at parity on sa_co f1 and `is_absent_acc` (two-seed means 0.5537/0.4786 vs 0.5559/0.4797), behind by 0.018 on pixmo_points f1 and 0.354 on dense_caption avg. Also corrects an earlier reading: run 1 alone appeared to beat released on sa_co (0.5593 vs 0.5559), but that is a quarter of the 0.011 seed spread. With two seeds it is parity, not a win. Verified: 2 new tests pin the 1.25 default and that the multiplier scales loss mass exactly 1.25x with `None` unchanged; 10 tests pass in the file. isort/black/ruff clean.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f9b5cd696
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| eos_id=self._eos_id, | ||
| loss_token_weighting=cfg.loss_token_weighting, | ||
| ) | ||
| if cfg.message_weight is not None: |
There was a problem hiding this comment.
Apply message weight in SFT demo mode
When PixMoCapDatasetConfig is used with mode="sft_demo"—as the stage-2 pixmo_cap source is built in image_only_v9.py—__getitem__ returns before reaching this scaling block, and _getitem_sft_demo() does not pass the configured weight to encode_sft_example(). Consequently, setting the new message_weight option silently has no effect for that supported mode; thread it into the SFT encoder or apply the multiplier on both return paths.
Useful? React with 👍 / 👎.
`--caption_message_weight` now sets it, defaulting to CAPTION_MESSAGE_WEIGHT = 1.25. Passing 1.0 reproduces the released weighting exactly, which matters because 1.25 is a deliberate deviation from Molmo2-4B-Pretrain: anyone reproducing the released recipe needs a way back that is not a code edit. The value is read via _read_float_override because the caption dataset config is built inside build_config, before Config.merge runs -- the same reason model_size and train_vit use the override readers. It is also declared on ExperimentConfig so merge accepts it as a top-level override; without that declaration the flag is rejected as an unknown attribute. Verified: default -> 1.25, --caption_message_weight=1.0 -> 1.0, =2.0 -> 2.0, all through a real dry_run; 10 tests pass; ruff clean.
The assertion still looked for the literal `message_weight=1.25`, which the previous commit replaced with `message_weight=caption_message_weight`. It now checks CAPTION_MESSAGE_WEIGHT == 1.25 and that the value reaches the dataset config through the override-readable name, so the test also pins the knob being configurable rather than hardcoded. I pushed the previous commit without rerunning this file -- the test was red on the branch for one commit.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4865134c3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| caption_message_weight = _read_float_override( | ||
| overrides, "caption_message_weight", CAPTION_MESSAGE_WEIGHT | ||
| ) |
There was a problem hiding this comment.
Normalize dashed caption-weight overrides before building dataset
When this knob is supplied as --caption-message-weight=1.0, the standard config merger accepts it because _clean_opt() normalizes hyphens to underscores, but _read_override() compares the unnormalized raw name and therefore builds dataset_config with the default 1.25. The later merge changes only config.caption_message_weight, leaving config.dataset.message_weight at 1.25, so this supported CLI spelling silently fails to reproduce the requested loss weighting.
Useful? React with 👍 / 👎.
Both findings were real.
1. `message_weight` was silently ignored in `mode="sft_demo"`. `__getitem__` returns early on that
path, so the branched path's scaling never ran -- and stage 2 builds this source that way
(`mixtures/image_only_v9.py`). `encode_sft_example` already takes a `message_weight`, so it is
now threaded through.
2. `_read_override` compared the raw override name while `Config.merge` normalizes hyphens
(`_clean_opt` does `.replace("-", "_")`). So `--caption-message-weight=1.0` was accepted by the
merger but missed by the reader: the dataset config kept 1.25 while the top-level field became
1.0, with no error. The reader now normalizes too, which also fixes the pre-existing
`model_size` / `init_from` / `train_vit` / `freeze_base_embeddings` readers, all of which had
the same latent divergence for their dashed spellings.
Verified: dry_run gives message_weight=1.0 for both `--caption_message_weight=1.0` and
`--caption-message-weight=1.0`, and 2.0 for the dashed 2.0; 2 new regression tests, 12 pass in the
file; ruff clean over src/.
#842 matched the released weighting exactly — no weighting on any source — which puts captions at
~77.5% of the
sum(CE*w)/sum(w)loss mass. That's the right default for reproducing the releasedrecipe, but it left
dense_caption~0.9 below the released checkpoint while pointing and countingwere at or above it. Weighting captions 1.25× lifts their share to ~81% and recovers most of that
gap for a pointing cost at the noise floor.
The change
PixMoCapDatasetConfiggains amessage_weightfield (the pointing configs already had one),applied through the same path — branch scaling is already folded into
loss_masksbybuild_branched_sequence, so only the example-wide multiplier is applied. Library default staysNone(released behaviour), soimage_only_v9, stage 2 and every other consumer are unaffected.CAPTION_MESSAGE_WEIGHT = 1.25, overridable per run:The flag needs both an override reader (the caption config is built inside
build_config, beforeConfig.mergeruns — same reasonmodel_sizeandtrain_vituse readers) and a declaration onExperimentConfig, ormergerejects it as an unknown attribute.Measured, two seeds per baseline arm
Every delta is quoted against its seed spread, measured from two runs of the identical +842 config:
The caption gain is ~6× its noise floor; the pointing losses are ~1× theirs. Caption
consistency reaches 70.701 against the released 70.745 — essentially parity — and sa_co
singlerises to 0.8919, best of any run (released: 0.8832).
pixmo_countis the one real cost at ~3× noise,though it lands exactly at the released 0.8685 rather than below it.
Standing vs
Molmo2-4B-Pretrainafter thisis_absent_acc(two-seed means 0.5537 / 0.4786 vs 0.5559 / 0.4797)Caveats
caption gain is ~6× the caption noise floor so it is very likely real, but the pointing costs sit
at ~1× theirs and a second seed would be needed to call them genuine rather than artifact.
rather than a hardcoded constant.
seed spread. With two seeds it is parity, not a win — which is why every delta above carries its
noise floor.
Verification
--caption_message_weightexercised through realdry_runs: default → 1.25,=1.0→ 1.0,=2.0→ 2.0. 3 tests pin the default, the override path, and that the multiplier scales loss massexactly 1.25× with
Noneunchanged. 155 tests pass acrosssrc/test/data/multimodal/.isort/black/ruff clean.
Checkpoint:
/weka/oe-training-default/ai2-llm/checkpoints/jasonr/molmo2-stage1-4b-capmw125u-20260904/step32000