Skip to content

Stage 1: stop down-weighting the pointing and counting loss - #842

Merged
jason718 merged 1 commit into
visionfrom
jasonr/stage1-pointing-loss-weighting
Aug 31, 2026
Merged

jason718 merged 1 commit into
visionfrom
jasonr/stage1-pointing-loss-weighting

Conversation

@jason718

@jason718 jason718 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

The pointing/counting dataset classes default loss_token_weighting to root_subsegments, which
scales an example's loss by 1/√(n_labels). The caption dataset is explicitly set to "none", with
a comment explaining exactly why that factor is wrong here — it "does not cancel out of the global
sum(CE*w)/sum(w) divisor when branch counts differ across examples"
— but the four pointing
entries were left on the default.

The released Molmo2-4B-Pretrain weights every response token equally:
mm_preprocessor.loss_token_weighting: None, and message_weight: None on all of
pixmo_points_train, pixmo_count_train, pixmo_points_high_freq_train, cosyn_point.

Measured over 15k source rows under our max_points=60 filter:

dataset labels/example our per-token weight released
points-pointing 12.5 0.28 1.00
points-counting 2.8 0.60 1.00

So pointing data got ~3.5× and counting ~1.7× less gradient weight per token than captions, for a
full 32k-step run.

Verified by a full run

Three 4B stage-1 checkpoints, 32k steps each, same recipe and data.seed=95818, differing only in
these fixes. Every eval below was run with the checkpoint's own prompt family
(-o prompt_templates=none -o system_prompt_style=style_and_length_v2) and completed with zero
scoring failures.

checkpoint contents
molmo2-stage1-4b-full-20260814 baseline: neither fix
molmo2-stage1-4b-ptfix-unalloc-20260819 #836 only (stage-1 pointing prompt family)
molmo2-stage1-4b-lossw-20260828 #836 + this PR

All at /weka/oe-training-default/ai2-llm/checkpoints/jasonr/<name>/step32000; released reference at
/weka/oe-training-default/mm-olmo/released-models-molmo2-1225/Molmo2-4B-Pretrain/step32000.

pixmo_point_eval_v3_mp:test (1215 instances)

metric baseline #836 only +#842 Δ vs #836 Δ vs baseline released gap left
f1 0.7062 0.7053 0.7977 +0.0924 +0.0915 0.8152 0.0175
precision 0.7231 0.7226 0.8164 +0.0938 +0.0933 0.8342 0.0178
recall 0.7232 0.7209 0.8037 +0.0828 +0.0805 0.8232 0.0195
single 0.7647 0.7338 0.8465 +0.1127 +0.0818 0.8570 0.0105
zero (absent) 0.7181 0.8389 0.8658 +0.0269 +0.1477 0.9128 0.0470
low_freq 0.7233 0.7240 0.8205 +0.0965 +0.0972 0.8387 0.0182
med_freq 0.5795 0.5889 0.6774 +0.0885 +0.0979 0.6895 0.0121
high_freq 0.6739 0.6640 0.7366 +0.0726 +0.0627 0.7624 0.0258

sa_co_gold_point_4k_mp:test (28,672 instances, unweighted primaries)

metric baseline #836 only +#842 Δ vs #836 Δ vs baseline
f1 0.3314 0.5502 0.5593 +0.0091 +0.2279
precision 0.3463 0.5639 0.5741 +0.0102 +0.2278
recall 0.3394 0.5571 0.5640 +0.0069 +0.2246
single 0.8363 0.8541 0.8842 +0.0301 +0.0479
low_freq 0.3135 0.5476 0.5527 +0.0051 +0.2392
med_freq 0.6343 0.6417 0.7011 +0.0594 +0.0668
high_freq 0.5352 0.5423 0.6039 +0.0616 +0.0687
is_absent_acc 0.2053 0.4871 0.4859 −0.0012 +0.2806
is_present_acc 0.9969 0.9925 0.9912 −0.0013 −0.0057

Counting and captions

benchmark / metric baseline #836 only +#842 Δ vs #836 Δ vs baseline
pixmo_count correct 0.8815 0.8685 0.8963 +0.0278 +0.0148
countbench_qa correct 0.9612 0.9510 0.9388 −0.0122 −0.0224
dense_caption avg 57.983 57.721 57.314 −0.407 −0.669
↳ recall 45.275 44.879 44.666 −0.213 −0.609
↳ consistency 70.691 70.564 69.961 −0.603 −0.730
↳ recall_at_10 86.727 86.231 85.861 −0.370 −0.866
↳ num_statements 21.655 21.763 21.739 −0.024 +0.084

Reading it

The two fixes are cleanly separable, which is what makes the attribution credible:

Net: the pointing gap against the released Pretrain checkpoint went from 11.0 points to 1.8.

Costs, stated plainly

Two benchmarks moved the wrong way and are not explained by the mechanism:

  • countbench_qa declines monotonically across all three checkpoints (0.9612 → 0.9510 → 0.9388).
    It is the only benchmark that benefited from neither fix, and it is out-of-domain academic data,
    unlike in-distribution pixmo_count, which gained +0.028.
  • every dense_caption sub-metric except num_statements declines monotonically (avg −0.67 from
    baseline). A plausible mechanism exists — raising the pointing/counting weight reduces captions'
    relative share of the normalised sum(CE*w)/sum(w) objective — but it is unconfirmed.

Both are small per step, and the trade (+9.2 f1 pointing, +2.8 counting, for ~0.7 caption avg) is
strongly favourable, but a second seed would be needed to separate the ~0.7 from run-to-run
variance. Filed as a follow-up rather than a blocker.

Tests

2 new tests pin the stage-1 setting and the 1/√n mechanism (1 label → 1.000, 4 → 0.500,
12 → 0.289); the stage-1 assertion fails when the value is restored to root_subsegments. 8 tests
pass in the file. isort/black/ruff clean.

The pointing/counting dataset classes default `loss_token_weighting` to `root_subsegments`, which
scales an example's loss by 1/sqrt(n_labels). The caption dataset is explicitly set to `"none"`
with a comment explaining why the factor is wrong here -- it does not cancel out of the global
`sum(CE*w)/sum(w)` divisor when branch counts differ across examples -- but the four pointing
entries were left on the default.

The released `Molmo2-4B-Pretrain` weights every response token equally:
`mm_preprocessor.loss_token_weighting: None` and `message_weight: None` on all of
pixmo_points_train, pixmo_count_train, pixmo_points_high_freq_train and cosyn_point. Measured over
15k source rows under our `max_points=60` filter, our examples average 12.5 labels for pointing and
2.8 for counting, so the default gave that data roughly 3.5x and 1.7x less gradient weight per
token than captions, for a whole 32k-step run:

    labels/example    our per-token weight    released
    12.5 (pointing)           0.28              1.00
     2.8 (counting)           0.60              1.00

This is the best remaining explanation for the pointing gap against the released Pretrain
checkpoint. #836 fixed the prompt family and moved abstention a long way -- SA-Co `is_absent_acc`
0.205 -> 0.487, its f1 0.331 -> 0.550, and pixmo_point_eval_v3_mp's zero slice 0.718 -> 0.839 --
but overall pointing f1 stayed flat at 0.705 against the released 0.815, because the non-absent
slices did not improve (single 0.765 -> 0.734). Abstention was a formatting problem; localisation
quality looks like a training-weight problem, and this is the weight that was wrong. The 1-2%
counting shortfall (pixmo_count 0.869, countbench_qa 0.951) has the same cause.

Verified: 2 new tests pin the stage-1 setting and the 1/sqrt(n) mechanism (1 label -> 1.000,
4 -> 0.500, 12 -> 0.289); the stage-1 assertion fails when the value is put back to
`root_subsegments`. 8 tests pass in the file. isort/black/ruff clean.

Needs a fresh run to land: every existing stage-1 checkpoint trained with the pointing loss
down-weighted.
@jason718
jason718 merged commit 8018f47 into vision Aug 31, 2026
1 check passed
@jason718
jason718 deleted the jasonr/stage1-pointing-loss-weighting branch August 31, 2026 19:03
jason718 added a commit that referenced this pull request Sep 7, 2026
#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 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.25× lifts their share to ~81%
and recovers most of that
gap for a pointing cost at the noise floor.

## The change

- `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. **Library default stays
`None`** (released behaviour), so `image_only_v9`, stage 2 and every
other consumer are unaffected.
- Stage 1 sets it from `CAPTION_MESSAGE_WEIGHT = 1.25`, **overridable
per run**:

```bash
python src/scripts/train/Molmo2-Stage1.py launch <name>                              # 1.25 (default)
python src/scripts/train/Molmo2-Stage1.py launch <name> --caption_message_weight=1.0 # released weighting
```

The flag needs both an override reader (the caption config is built
inside `build_config`, before
`Config.merge` runs — same reason `model_size` and `train_vit` use
readers) and a declaration on
`ExperimentConfig`, or `merge` rejects 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:

| metric | +842 (n=2) | **1.25×** | 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 **~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 `single`
rises to 0.8919, best of any run (released: 0.8832). `pixmo_count` is
the one real cost at ~3× noise,
though it lands exactly at the released 0.8685 rather than below it.

## Standing vs `Molmo2-4B-Pretrain` after this

- **ahead**: both counting benchmarks
- **parity**: sa_co f1 and `is_absent_acc` (two-seed means 0.5537 /
0.4786 vs 0.5559 / 0.4797)
- **behind**: pixmo_points f1 by 0.018, dense_caption avg by 0.354

## Caveats

- **The treatment arm is n=1.** Baselines have two seeds each; the 1.25
config has one run. The
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.
- **1.25 is a deliberate deviation from the released recipe**, which is
why it is a documented flag
  rather than a hardcoded constant.
- Run 1 alone appeared to beat released on sa_co (0.5593 vs 0.5559);
that is a quarter of the 0.011
seed spread. With two seeds it is parity, not a win — which is why every
delta above carries its
  noise floor.

## Verification

`--caption_message_weight` exercised through real `dry_run`s: 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 mass
exactly 1.25× with `None` unchanged. 155 tests pass across
`src/test/data/multimodal/`.
isort/black/ruff clean.

Checkpoint:
`/weka/oe-training-default/ai2-llm/checkpoints/jasonr/molmo2-stage1-4b-capmw125u-20260904/step32000`
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