Repository navigation
zaya: correct CCA conv input with several sequences in a ubatch - #15
Merged
bong-water-water-bong merged 1 commit intoSep 26, 2026
Merged
Conversation
The conv input was built by transposing QK over all the ubatch's tokens and then reshaping to [T, n_qk, S]; after the transpose a channel's row runs across every sequence, so with n_seqs > 1 the reshape mixed channels and sequences. Split the sequences first, then transpose (as the Mamba graphs do). Seen as llama-perplexity at its default batch (4 x 512-token sequences per ubatch): ZAYA1-8B F16 on wikitext-2, 4 chunks, gave PPL 58,259 against 27.89 with one sequence per batch; now both give 27.8871 on the CPU (Vulkan 27.54 / 27.62). llama-server with parallel slots batches requests the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Reviewed: the bug is mine. I transposed across the whole ubatch, and every check I ran used |
bong-water-water-bong
merged commit Sep 26, 2026
706ad1a
into
1bit/hrx-vulkan-patched
9 of 24 checks passed
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.
ZAYA gave wrong results when a ubatch held more than one sequence:
llama-perplexityat its default batch, and llama-server with parallel slots when requests get batched together.Cause. The CCA conv input was built by transposing QK over all of the ubatch's tokens and then reshaping to
[T, n_qk, S]. After the transpose, one channel's row runs across every sequence, so withn_seqs > 1the reshape mixed channels and sequences. The fix splits the sequences first and transposes after, as the Mamba graphs do. With one sequence the result is identical.Checked on Strix Halo with ZAYA1-8B F16 on wikitext-2 (4 × 512-token chunks):
test-llama-archs -a zayapasses on Vulkan and CPU, including the save/reload.-np 4with four concurrent chats gives coherent answers. Three drift from the sequential answers after a shared prefix, as expected from batch-dependent rounding in Q4 at temperature 0.Every earlier ZAYA check used one sequence, which is why this was missed.
🤖 Generated with Claude Code