Repository navigation
Share the partner label and partner starts in the join minimum - #36
Merged
Merged
Conversation
The minimum counted each pair's partner label, partner document, and answer cue in full. The label is the same for every pair of one anchor, and partners of one anchor that begin with the same tokens share those tokens in a prefix cache, so the minimum was above what unlimited KV needs. On LEP-6 the stock vLLM run computed fewer fresh tokens than the minimum. The label now counts once per anchor, after the frame, and the partner documents of one anchor count as a prefix trie.
shreyashankar
added a commit
to fsdatalab/quail
that referenced
this pull request
Oct 3, 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.
Problem
The join minimum in
quail_b.minimumis too high. It counts the partner label, the partner document, and the answer cue in full for each pair. A prefix cache over whole requests shares two of these parts:For example, on LEP-6 at sf 0.5 (Qwen3 4B fp8), the stock vLLM run computed 70.74M fresh tokens, but the minimum was 72.03M. Thus its KV regret showed 0. A rebuild of all 1,014,968 vLLM join requests, tokenized from the text that vLLM got, gives 315,088,130 tokens, the same as the vLLM count. With unlimited KV and 16-token cache blocks, these requests need at least 69,996,610 fresh tokens. vLLM computed 69,996,914. Per token, they need 63,892,234, which is 8.42M less than the old minimum:
Solution
_PartnerTriesorts all partner documents for one answer cue one time. The trie size of a subset is its length minus, for each pair of sorted neighbours, the shortest common prefix in the sorted run between them. A range-minimum table gives that value. Thus a join with many anchors does not sort its partners again for each anchor.docs/reference.mdstates the new rule.Impact
Only joins and classifications of joined rows change. Saved runs of Qwen3 4B fp8 at sf 0.5, scored again (KV regret as a percentage of fresh tokens):
Sources:
/results/benchmarks/quailb/20261002T061804Z-a6ccc1fe-minfix/quailand/results/benchmarks/quailb/20261001T010217Z-1e7f7ba8-minfix/stock_vllmon thequail-resultsvolume. The other eight classification queries do not change. For the LEP-6 vLLM run, the new minimum before scaling is 63,892,234, the same as the direct per-token check above.Testing
test_minimum_input_tokens_of_a_join_is_the_trie_of_its_requestscompares the minimum withprefix_trie_sizeover all full requests of a join. The join has partners with a shared start and one repeated text.test_partner_trie_size_matches_the_trie_of_any_subsetcompares_PartnerTriewithprefix_trie_sizeon 200 random subsets of 60 short documents, with repeats and prefixes.Limits and follow-ups
f3ad796. After this PR merges, Quail moves the pin to the merge commit.🤖 Generated with Claude Code
https://claude.ai/code/session_01BGcUxUrkntTY43pDwWgfK5
Generated by Claude Code