Repository navigation
Rounds: lm_head of the rows that can be the greedy token - #111
Merged
Merged
Conversation
A round of 3 or 4 positions spent about 10 ms in lm_head, and a round of 8 about 20 ms, for the arithmetic of the 6-bit weights. A round needs only the greedy token of each position, and its logit. For 2 or more positions, `run_round35` now runs three kernels: - `lm_rough_q6`: rough logits a for up to 8 positions at once, with f16 weights and inputs on the simdgroup matrices. Its time is about that of one position. - `lm_pick_threshold`: for each position, M = the largest a - B, where B is a bound of |a - e| from the norms of x and of the rows (src/q6.vx gives the terms of the bound). - `matvec_q6_rows4_pick`: the exact logits e (those of `matvec_q6`) of each row that does not have a + B < M; the other rows get the lowest f32 and cannot be the greedy token. A block with no such row reads no weights. The norms of the rows come from `lm_q6_norms` in the first round. The greedy tokens, and their logits, stay those of the plain steps bit for bit; the other logits of a round are no longer exact. `Round35.pick` false gives all the logits exactly, as before. tests/round35.vx: each round runs again with the pick, and its greedy tokens and their logits must be those of the plain steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
So that entry 18 comes after entry 17. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
The entry gives the problem and the change. The numbers come after a run that follows the benchmarking policy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw
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 lm_head of a round of drafts, for 2 or more positions. This PR builds on #110 (its base is
qwen36-rows), so it shows only its own commit.Why
A round needs only the greedy token of each position, and its logit. Before,
run_round35computed all the logits exactly, and the arithmetic of the 6-bit weights grew with the number of positions.What
For 2 or more positions,
run_round35runs three kernels (src/q6.vx):lm_rough_q6: rough logits a for up to 8 positions at once, with f16 weights and inputs on the simdgroup matrices.lm_pick_threshold: for each position, M = the largest a - B over the rows. B is a bound of |a - e|, where e is the exact logit. It comes from the norms of x and of the rows of lm_head, and src/q6.vx gives each of its terms.matvec_q6_rows4_pick: the exact logit (that ofmatvec_q6, bit for bit) of each row that does not have a + B < M. The other rows get the lowest f32, and cannot be the greedy token. A block with no such row reads no weights.lm_q6_normscomputes the norms of the rows in the first round.What stays the same
--draftand--mtpdoes not change.Round35.pick = falsegives all the logits exactly, as before.Tests
tests/round35.vx: each round runs again with the pick. Its greedy tokens and their logits must be those of the plain steps.tests/run.sh: all pass on the local machine.Speed numbers come after a policy run.
🤖 Generated with Claude Code
https://claude.ai/code/session_014U9gTxfQzAEpmg4WJhYQqw