Skip to content

Support SFT of Olmo-Hybrid-7B on the olmo-core path - #1822

Merged
abhishekraok merged 8 commits into
mainfrom
pr/olmo-hybrid-sft
Aug 20, 2026
Merged

abhishekraok merged 8 commits into
mainfrom
pr/olmo-hybrid-sft

Conversation

@abhishekraok

@abhishekraok abhishekraok commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

olmo-core has no TransformerConfig preset for Olmo Hybrid and no HF -> olmo-core state conversion for model_type: olmo_hybrid, so --config_name olmo3_hybrid_7B (already referenced by scripts/train/olmo-hybrid/7b_instruct_dpo_sweep_olmo_core_budget_ac.sh) could never resolve — that preset does not exist in the pinned rev, in olmo-core main, or anywhere upstream. Both live in open_instruct/olmo_core_hybrid.py until they land there.

Architecture notes

Two things differ from Olmo 3 and are easy to get wrong:

  • It is NoPE. rope_parameters is {"rope_theta": null} and HF builds no rotary embedding, so the full-attention layers have no positional encoding. Do not pass --rope_scaling_factor.
  • GDN blocks are pre-norm while attention blocks are reordered-norm, which is why the per-layer key maps are split in two.

Also note olmo-core's own HYBRID_GDN_LAYER_KEY_MAP disagrees with the released checkpoint (out_proj/norm vs o_proj/o_norm), so the maps here are taken from the checkpoint.

Verification

Checked against allenai/Olmo-Hybrid-7B without a GPU: the config builds 523 tensors matching the checkpoint's 523 exactly (no missing keys, no extra keys, no shape mismatches), and feeding it back through olmo-core's own get_hybrid_hf_config reproduces the released config.json on every architectural field. Then on one GPU, the built model reproduces HF's logits to 0.6% with 100% argmax agreement.

That last check earned its place. Three structural checks passed green on code carrying a 38% logit error: HF hardcodes eps=1e-5 on the gated DeltaNet output norm rather than using rms_norm_eps, and nothing in the config or the weight names hints at it. Compounded over 24 GDN layers it gave 70% argmax agreement — close enough that training would have looked entirely healthy.

Result

Full 0.1-0.5 epoch curve, 861/861 steps in 2h on one B300 node. Data, cache, seed and global batch are byte-identical to the Olmo 3 run, so the model is the only variable.

checkpoint epoch IFBench (prompt_level_loose_acc) GSM8K (exact_match)
Olmo-Hybrid-7B base 0 0.1467 0.7498
step 172 0.1 0.2367 0.7506
step 344 0.2 0.2400 0.7710
step 516 0.3 0.2433 0.7589
step 688 0.4 0.2667 0.7498
step 861 0.5 0.2600 0.7574
released Olmo-Hybrid-Instruct-SFT-7B 2-stage, ~15x tokens 0.2733 0.8014

Roughly 80% of the IFBench gain arrives by 0.1 epochs (+9.0 points, ~2.6 sigma). From 0.1 to 0.5 the range is 0.2367-0.2667 against a ~3.5-point standard error on the difference, so the curve is flat within noise and the apparent 0.4 peak is not separable from sampling variation. GSM8K is flat throughout — no regression, no gain. The 0.4 checkpoint (0.2667) is inside noise of the released model (0.2733), from ~1/15 the SFT tokens on 8 GPUs rather than 64.

Throughput: 16,392 tok/s/device on B300, 9,073 on H100, against Olmo 3's 6,580 at identical global batch.

The base row was measured with max_position_embeddings capped 65536 -> 32768 so vLLM would start inside olmo-eval's 300s budget. That is safe only because this model is NoPE — there is no positional embedding table for the larger value to index.

Full report.

Runs:

  1. B300, completed 861/861 in 2h, exit 0: Beaker
  2. H100, went silent at step 580/861: Beaker
  3. H100 + CUDA 13 image, failed on driver version: Beaker
  4. B300 + CUDA 12 image, failed on nvrtc arch: Beaker

Why the launch script pins ai2/holmes

Four H100 runs of this exact configuration went silent mid-training — steps 65, 205, 350 and 580, on four different nodes — stalled in the FSDP2 post-backward gradient reduce-scatter with every rank enqueued and none completing (allenai/Olmo-core#829). The same configuration completes on B300, so the script targets ai2/holmes and needs --cuda-version 13.

GPU architecture and CUDA toolkit are confounded here, and runs 3 and 4 above were an attempt to separate them that failed on both sides: H100 cannot run the CUDA 13 image (its driver reports 12.8, too old for that build) and B300 cannot run the CUDA 12 image (nvrtc: invalid value for --gpu-architecture). So Hopper-specific is the observed behaviour, not a demonstrated cause.

Follow-ups, deliberately not in this PR

  • scripts/train/debug/check_olmo_core_matches_hf.py, the script behind the logits check above. It is a generic "does this olmo-core config reproduce its HF reference?" tool rather than anything hybrid-specific, so it is worth its own review.
  • The launch script wants --dist_timeout_hours 2; that flag arrives with Expose save_async and the distributed timeout #1821. Until then a mid-training hang holds its 8 GPUs for the full 24h default — this happened once, for 2h40m.

@abhishekraok
abhishekraok force-pushed the pr/save-async-and-dist-timeout branch from 10ca2b7 to 095d079 Compare August 14, 2026 21:14
abhishekraok added a commit that referenced this pull request Aug 14, 2026
@abhishekraok
abhishekraok force-pushed the pr/save-async-and-dist-timeout branch from 095d079 to e843409 Compare August 14, 2026 22:47
abhishekraok added a commit that referenced this pull request Aug 14, 2026
@abhishekraok

Copy link
Copy Markdown
Collaborator Author

Two updates since this was opened.

The script now targets Blackwell, not Hopper. As originally written it pointed training at ai2/jupiter, where this exact configuration hung 4/4 times (steps 65, 205, 350, 580, across four nodes) in the FSDP2 post-backward reduce-scatter — allenai/Olmo-core#829. The same configuration completed 861/861 on a B300 node and ran 81% faster (16,392 vs 9,073 tokens/s/device). ai2/holmes requires the CUDA 13 image, so the documented launch command now passes --cuda-version 13. Tokenization stays on the CPU clusters.

Caveat recorded on the issue: the B300 run necessarily used CUDA 13 while every H100 run used CUDA 12, so toolkit version is confounded with architecture. A CUDA-13-on-H100 run is in flight to separate them; if it turns out to be the toolkit rather than the GPU, this cluster change should be revisited.

Full results. The completed run gives the 0.1–0.5 epoch curve:

epoch IFBench GSM8K
0 (base) 0.1467 0.7498
0.1 0.2367 0.7506
0.2 0.2400 0.7710
0.3 0.2433 0.7589
0.4 0.2667 0.7498
0.5 0.2600 0.7574
released 2-stage 0.2733 0.8014

Roughly 80% of the IFBench gain arrives by 0.1 epochs; from 0.1 to 0.5 the spread is 3 points against a ~3.5-point standard error, i.e. flat within noise. GSM8K never moves. Report.

@abhishekraok
abhishekraok force-pushed the pr/save-async-and-dist-timeout branch from bdd8557 to 075b997 Compare August 18, 2026 20:01
olmo-core has no TransformerConfig preset for Olmo Hybrid and no HF ->
olmo-core state conversion for model_type "olmo_hybrid", so
--config_name olmo3_hybrid_7B could never resolve. Both live in
open_instruct/olmo_core_hybrid.py until they land upstream.

Two things differ from Olmo 3 and are easy to get wrong:

* It is NoPE. rope_parameters is {"rope_theta": null} and HF builds no
  rotary embedding, so the full-attention layers have no positional
  encoding. Do not pass --rope_scaling_factor.
* GDN blocks are pre-norm while attention blocks are reordered-norm,
  which is why the per-layer key maps are split in two.

olmo-core's own HYBRID_GDN_LAYER_KEY_MAP also disagrees with the released
checkpoint (out_proj/norm vs o_proj/o_norm), so both directions of the
conversion are defined here from the checkpoint itself.

Verified end-to-end on 8 GPUs: IFBench 0.1467 -> 0.2500 at 0.3 epochs,
GSM8K flat, 9,073 tok/s/device.

Co-Authored-By: Claude Opus 5 <[email protected]>
@abhishekraok
abhishekraok changed the base branch from pr/save-async-and-dist-timeout to main August 18, 2026 20:48
@farhatkevin

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14b05c610f

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread open_instruct/olmo_core_utils.py Resolved
abhishekraok and others added 3 commits August 19, 2026 15:54
verify_can_save_as_hf() still called olmo-core's generic converter, which
has no olmo_hybrid case and falls through to the llama-style key templates.
On a hybrid state dict it raises "Some state keys were not converted" on
every GDN parameter, so DPO and GRPO -- both of which run this check before
training -- would abort at preflight on a model that exports fine.

Both the check and the save now go through one dispatching function, so
they cannot disagree about which converter a model needs.

Reported by Codex review on #1822.

Co-Authored-By: Claude Opus 5 <[email protected]>
The docstring carried the NoPE and norm-convention caveats, which belong
next to the code they constrain, not in a preamble. The NoPE note moves to
the `rope=None` it explains; the norm conventions were already documented
on the two key maps.

Co-Authored-By: Claude Opus 5 <[email protected]>
The header re-explained the two-job split and the cache key, both of which
oc_sft_olmo3_7b_1node.sh already covers and #1835's runbook now owns as the
living source of truth. It now points there and keeps only the departures
the architecture forces, each in a line or two.

The tokenizer note gets the same treatment: eleven lines of BPE comparison
for a one-line assignment, when the operative fact is that the two
tokenizers are interchangeable so the Olmo 3 cache is reusable.

Co-Authored-By: Claude Opus 5 <[email protected]>
@abhishekraok
abhishekraok marked this pull request as ready for review August 20, 2026 00:04
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Comment thread open_instruct/olmo_core_utils.py Resolved
abhishekraok and others added 3 commits August 20, 2026 20:17
The generic converter raises on hybrid rather than mis-loading it: nothing
maps the GDN linear_attn keys, so StateConverter reports them unconverted.
The quiet failure is the general one -- load_hf_model writes back only the
keys its converter produced -- and the docstring conflated the two, which
sends anyone debugging this looking for a corruption that cannot happen.

Co-Authored-By: Claude Fable 5 <[email protected]>
# Conflicts:
#	CHANGELOG.md
#1821 has landed, so the flag the header asked for exists. 2h is safe only
because the tokenize job runs first: on a cold cache the non-zero ranks wait
at a barrier while rank 0 tokenizes, which outlasts it. Say so, since the
number is otherwise indistinguishable from a guess.

Co-Authored-By: Claude Fable 5 <[email protected]>
@abhishekraok
abhishekraok enabled auto-merge August 20, 2026 20:25
@abhishekraok
abhishekraok added this pull request to the merge queue Aug 20, 2026
Merged via the queue into main with commit bc0d18f Aug 20, 2026
7 checks passed
@abhishekraok
abhishekraok deleted the pr/olmo-hybrid-sft branch August 20, 2026 20:39
abhishekraok added a commit that referenced this pull request Aug 20, 2026
Key and shape checks pass on conversions that are numerically wrong: they
cannot see a right-shaped tensor behind the wrong name, and a state-dict
round trip cannot either. This runs both models on the same input and
compares logits, reporting per-block divergence so a mismatch points at
the layer that caused it.

It found one real bug while landing Olmo-Hybrid support (#1822): HF
hardcodes eps=1e-5 on the gated DeltaNet output norm instead of reading
rms_norm_eps, which three structural checks passed straight through at a
38% logit error.

Needs a GPU, so it stays a manual tool rather than a test.

Co-Authored-By: Claude Fable 5 <[email protected]>
JimmyWang0417 pushed a commit to JimmyWang0417/open-instruct that referenced this pull request Sep 4, 2026
…allenai#1839)

* Add a script that checks an olmo-core config reproduces its HF logits

Key and shape checks pass on conversions that are numerically wrong: they
cannot see a right-shaped tensor behind the wrong name, and a state-dict
round trip cannot either. This runs both models on the same input and
compares logits, reporting per-block divergence so a mismatch points at
the layer that caused it.

It found one real bug while landing Olmo-Hybrid support (allenai#1822): HF
hardcodes eps=1e-5 on the gated DeltaNet output norm instead of reading
rms_norm_eps, which three structural checks passed straight through at a
38% logit error.

Needs a GPU, so it stays a manual tool rather than a test.

Co-Authored-By: Claude Fable 5 <[email protected]>

* Take the input ids from the tokenizer and match HF's attention backend

The hard-coded ids started at 100257, which is outside any vocabulary smaller
than that -- a 32k-vocab Llama would have died in the embedding lookup, on a
path the loader otherwise supports. Encoding with the checkpoint's own
tokenizer keeps the ids in range whatever the model.

Loading HF under its default backend while building olmo-core with flash also
compared two different kernels, whose ordinary numerical difference can flip a
near-tied argmax and read as a conversion error. Map the backend across, and
fall back to HF's own choice with a warning when an architecture does not
implement it.

Both raised by Codex on allenai#1839.

Co-Authored-By: Claude Fable 5 <[email protected]>

* Make the attention fallback apply to both models

The previous fallback only moved HF: when it rejected the requested backend we
reloaded it under its own default while olmo-core still built with flash,
recreating the mismatched-kernel comparison the mapping existed to prevent.
The backend is now a variable both sides read, so a fallback moves them
together, and re-raises rather than retrying when the fallback is what already
failed.

Backends without an HF counterpart (flash_4, te) are rejected by argparse
instead of silently comparing different kernels.

Raised by @farhatkevin on allenai#1839.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
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.

2 participants