sparse V: skip negligible attention weights across all backends#98
Open
TheTom wants to merge 1 commit intofeature/turboquant-kv-cachefrom
Open
sparse V: skip negligible attention weights across all backends#98TheTom wants to merge 1 commit intofeature/turboquant-kv-cachefrom
TheTom wants to merge 1 commit intofeature/turboquant-kv-cachefrom
Conversation
Zero or skip V accumulation for positions where the softmax attention weight falls below 1e-6. At long context, 90%+ of weights are negligible — removing them avoids accumulating quantization noise with zero quality impact (PPL identical, NIAH improved). Metal VEC: skip V dequant entirely via continue CUDA tile: zero KQ entry before V matmul Vulkan: zero Pf before V accumulation CUDA VEC: already present (signalnine) Tested on M5 Max, Nemotron 30B-A3B, turbo3 KV: 16K: +9.3% decode (7.54 -> 8.24 tok/s) PPL: 12.5942 (identical on/off)
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.
Summary
Zero or skip V accumulation for positions where the softmax attention weight falls below 1e-6. At long context, 90%+ of weights are negligible — removing them avoids accumulating quantization noise with zero quality impact.
Changes
continue(gated byTURBO_SPARSE_Vpreprocessor define)4 files, +3 net lines.
Test Results (M5 Max, Nemotron 30B-A3B, turbo3 KV, r=3)
PPL: 12.5942 (identical with and without sparse V, 10 chunks wikitext-2)