Repository navigation
Support SFT of Olmo-Hybrid-7B on the olmo-core path - #1822
Conversation
10ca2b7 to
095d079
Compare
365cad0 to
1204e02
Compare
095d079 to
e843409
Compare
1204e02 to
f759b87
Compare
|
Two updates since this was opened. The script now targets Blackwell, not Hopper. As originally written it pointed training at 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:
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. |
bdd8557 to
075b997
Compare
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]>
fec60a2 to
14b05c6
Compare
|
@codex review |
There was a problem hiding this comment.
💡 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".
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]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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]>
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]>
…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]>
olmo-core has no
TransformerConfigpreset for Olmo Hybrid and no HF -> olmo-core state conversion formodel_type: olmo_hybrid, so--config_name olmo3_hybrid_7B(already referenced byscripts/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-coremain, or anywhere upstream. Both live inopen_instruct/olmo_core_hybrid.pyuntil they land there.Architecture notes
Two things differ from Olmo 3 and are easy to get wrong:
rope_parametersis{"rope_theta": null}and HF builds no rotary embedding, so the full-attention layers have no positional encoding. Do not pass--rope_scaling_factor.Also note olmo-core's own
HYBRID_GDN_LAYER_KEY_MAPdisagrees with the released checkpoint (out_proj/normvso_proj/o_norm), so the maps here are taken from the checkpoint.Verification
Checked against
allenai/Olmo-Hybrid-7Bwithout 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 ownget_hybrid_hf_configreproduces the releasedconfig.jsonon 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-5on the gated DeltaNet output norm rather than usingrms_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.
prompt_level_loose_acc)exact_match)Olmo-Hybrid-7BbaseOlmo-Hybrid-Instruct-SFT-7BRoughly 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_embeddingscapped 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:
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.--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.