Repository navigation
Adjusting post norm MLP to be properly differentiated - #1890
Merged
Merged
Conversation
7 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
As part of reviewing #1878, I recognized that what is listed under
ln1/ln2could vary from model to model. This breaking change is intended to normalize these names, to ensure the same values always appear in the same location, and that post norm values do not appear under pre-norm names.ln1_post/ln2_post– OLMo 2, OLMo 3, EXAONE-4 and FlexOlmo declared their post-attention/post-feedforward norms in theln1/ln2slots, so readers of the pre-sublayer norm silently got the post-norm; those blocks now have noln1/ln2and such readers fail loudly.ln2_postand noln2getshook_resid_mid = mlp.hook_inand the MLP-sidehook_mlp_incapture automatically, replacing the OLMo 2 adapter's hand-written overrides.post_attention_layernormis the pre-MLP norm on linear-attention layers but follows attention on full-attention layers; full-attention layers now mount it asln1_post, soln2always feeds the MLP, andhook_resid_midis restored on both layer types.hook_attn_out/hook_mlp_outpointed at the raw sublayer outputs, which are not what the layer adds to the residual; norms now use the canonical keys and both aliases resolve toln1_post/ln2_post.hook_out, as on Gemma 2/3.apply_ln=Trueat a mid layer on OLMo 2-style blocks previously divided by the post-attention norm's scale; it now raises, saying the block has no pre-sublayer norm and pointing toapply_ln=Falseor final-layer LN.devwith the 1B model; after the rename the fork is correct by construction (noln1to wire) rather than by capture timing.model_structure.mdstate the rule – norm keys name the norm's position, not the HF attribute; post-norms never go inln1/ln2.Breaking changes
blocks.{i}.ln1.*/ln2.*toblocks.{i}.ln1_post.*/ln2_post.*, and on OLMo Hybrid full-attention layers fromblocks.{i}.ln2.*toblocks.{i}.ln1_post.*; the canonical aliases (hook_attn_out,hook_mlp_out,hook_resid_mid) keep their meaning.hook_attn_out/hook_mlp_outchange values (raw sublayer output → post-norm output), and its norm hooks are renamed from the HF names toln1,ln1_post,ln2,ln2_post.Type of change
Checklist: