[Bug fixes] Offset block attn-res boundary by head empty layers - #1766
Merged
Waynezee merged 1 commit intoAug 18, 2026
Merged
Conversation
`_is_block_boundary` used the physical `layer_number`, but the spec builders shift it by `num_empty_layers_add_in_head` so empty head layers occupy the leading slots. The schedule is defined on the logical decoder index, so subtract that offset before the modulo; otherwise the whole block layout slides and logical layer 0 never opens a block, silently changing the residual topology for a K3 warm start. Add tests covering the head-offset shift and the non-positive span error.
risemeup1111
approved these changes
Aug 17, 2026
risemeup1111
left a comment
Contributor
There was a problem hiding this comment.
| 序号 | 位置 | 优先级 | 状态 |
|---|---|---|---|
| 1 | - | - | ✅ |
Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1766 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 1
Lines ? 2
Branches ? 0
===========================================
Hits ? 2
Misses ? 0
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
xingmingyyj
approved these changes
Aug 18, 2026
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.
PR Category
Execute Infrastructure
PR Types
Bug fixes
Description
TransformerLayer._is_block_boundaryused the physicallayer_numberto decide which layers open an attention-residual block. However, the spec builders (gpt_layer_specs.get_gpt_decoder_layers_spec) shiftlayer_numberbynum_empty_layers_add_in_headso the empty head layers occupy the leading slots. The block schedule is defined on the logical decoder index, so the physical index must have that offset subtracted before the modulo.Without this fix, whenever
num_empty_layers_add_in_head > 0the entire block layout slides by the offset and logical layer 0 never opens a block — silently changing the residual topology of every layer for a K3 warm start.This PR subtracts
num_empty_layers_add_in_headfromlayer_numberbefore the block-span modulo, and adds tests covering:ValueErrorinstead of silently no-op'ing.是否引起精度变化
是