Repository navigation
fix(kvflash): #934 follow-ups: graph scorer tolerance stated, non-finite keys fail, spawn failure joins - #990
Merged
Conversation
…mass fails The header claimed the same outputs as the AVX2 scorer. ggml_mul_mat quantises queries to 8 bits for Q4_0/Q8_0 keys, so the select score deviates by up to 4e-2 at 400 sealed chunks and top-k sets can differ. Document that, add a 400-chunk bound test and an F32 exactness test, and make a NaN or Inf plane sum fail the call instead of reaching nth_element.
…PU scorer rejects NaN A failed thread creation destroyed joinable threads and called std::terminate. The CPU scorer returned true with NaN scores for every chunk when one key value was NaN or Inf. Also drop the unused tol parameter and a stale section header in the exact-mass test.
davide221
reviewed
Nov 11, 2026
davide221
left a comment
Contributor
There was a problem hiding this comment.
Code review
No issues found. Checked for bugs and logic errors in the changed code.
Reviewed 4d75667e · 0 candidate issues checked, kept at ≥70% confidence · add the code-review label to review again
score_chunks guarded S against the legacy 8-token kLookahead while passing n_lookahead=128 to the drafter; a named constant now feeds both. Review: Luce-Org#963 thread T8
dusterbloom
force-pushed
the
kvflash/scorer-followup
branch
from
November 12, 2026 07:49
2dd92f8 to
e9e0037
Compare
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.
This follow-up to #934 corrects what the graph scorer header claims and closes three small robustness gaps in the same code. It changes no kernels and makes no performance claim.
What changes
kvflash_gpu_mass.hsaid the graph scorer gives "the same outputs" askvflash_exact_mass_scores_fast_multi. It does not. For Q4_0 and Q8_0 keys,ggml_mul_matquantises the queries to 8 bits, while the AVX2 scorer keeps them in F32. The header now states the measured deviation and that the two scorers are not interchangeable inside one session. The unit test gets a 400-chunk case asserting the real bound (5e-2) and an F32-keys case asserting float-rounding agreement (1e-4), which shows the graph itself is right and the deviation comes from the query quantisation only.run_workerscalledstd::terminatewhen a thread could not be created after earlier ones had started (pids limit, no stack memory). It now joins the started threads and rethrows.tolparameter and a stale section header from the exact-mass test.Measurement methodology
The only numbers here are the scorer deviation figures in the header comment. They compare the graph scorer against the AVX2 scorer on the same synthetic keys and the same queries, so nothing but the scorer differs.
No before/after speed benchmark is included because no hot path changed. The 1.7 s figure for the CPU scorer (64 queries, 514 sealed chunks) in the header comes from #934 and was not re-measured here.
Tests: the four KVFlash unit sources (exact mass, graph mass, user-question helpers, PFlash mapper) build without warnings in a CPU-only build and pass 66 of 66. The new cases failed before the fixes.
Known limits, not addressed here