Repair Week 1 Day 3 GQA learner contract - #287
Merged
Merged
Conversation
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.
Why
Week 1 Day 3 did not fully bind the public grouped-attention and Qwen3 attention contract. The chapter left multi-query attention, arbitrary leading dimensions, independent head dimensions, additive-mask forwarding, mask dtype, the causal
S >= Ldomain, Q/K normalization order, and the float32 attention/cast-back boundary implicit. The supplied tests therefore allowed several learner-visible API and numerical errors to pass undetected.Change
head_dim, additive masks, requested mask dtype, and the causal requirement that key/value length is at least query length.L > Sbefore it can produce NaNs.Review
book/src/week1-03-gqa.md,src/tiny_llm_ref/attention.py, andtests_refsol/test_week_1_day_3.py(+254/-9), with no add/delete/rename/mode change.L > S, batch size 2, independenthead_dim, norm/RoPE order, additive masks, float32 attention promotion, and castback.AI-Assisted: GPT-5.6 Sol + Forge