Repository navigation
qwen4: take the rotary table from core's exact helper - #2223
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/qwen4-rope
branch
from
November 5, 2026 17:39
ddcac37 to
3fc2596
Compare
ashhart
added a commit
that referenced
this pull request
Nov 6, 2026
ashhart
force-pushed
the
lead/qwen4-rope
branch
from
November 6, 2026 03:00
3fc2596 to
79d8f1f
Compare
rotary_table.fill keeps its refusals and the three header words and now writes the frequencies with rope_freq.inverseFrequencies(theta, head_dim * partial_rotary_factor), the words transformers' default RoPE uses. Metal and CUDA upload the same table, so both backends move together. The Qwen4 reference oracle takes the same FP32 scalar form, and the Qwen4 core facades export rope_freq where they lacked it. Every moved word is a 1-ulp move to transformers' bits, pinned by literals in the tests; the CUDA open test's 1e4/32 words take the new values. The XPU half of the original change stays separate.
ashhart
force-pushed
the
lead/qwen4-rope
branch
from
November 6, 2026 12:29
5e84e63 to
8fe4bec
Compare
ashhart
added a commit
that referenced
this pull request
Nov 6, 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.
The Qwen4 half of #2000: its rotary table now comes from core's exact helper,
rope_freq.inverseFrequencies, so its FP32 values match transformers' bits. Every moved word is a 1-ulp move, pinned by literals. The refusals and header words stay.Qwen4's table and oracle passed the host gates (
test-qwen4-host114/114,-reference-host7/7,-device-host10/10,-cuda-nodes-host6/6), and #2000 reportstest-qwen4-metal86/86 on an M3 Ultra. No Qwen4 checkpoint is on a box here, so no tokens were compared. Replies can change where a token was a near-tie. #2000 keeps the Qwen3.8-27B on XPU half, which needs an Arc GPU.