Repository navigation
Add structure demotion option to KVzipPress / RestoreKVPress 🤖🤖🤖 - #288
JeetuSK0808 wants to merge 3 commits into
Conversation
|
Results PR on the leaderboard Space (RULER 4096, Qwen3-8B, ratio 0.94: 89.64): https://huggingface.co/spaces/nvidia/kvpress-leaderboard/discussions/24 🤖🤖🤖 |
c5802dc to
82aa641
Compare
|
Thanks for the contribution and for sharing the benchmark results. We're maintaining kvpress with limited review capacity, so we're currently prioritizing bug fixes and methods backed by an associated paper. Could you link a paper that describes and evaluates the method proposed here? If there isn't a paper for this method, we'll close the PR for now. |
Default-off options structure_demotion (factor) and structure_min_repeats on KVzipPress, inherited by RestoreKVPress: before eviction, scale the reconstruction scores of repeated punctuation/whitespace/symbol tokens so the budget goes to content. Letters and digits are never touched; prefix, sink and post-context positions are excluded. Registry entries kvzip_plus_sd and RestoreKV_plus_sd (factor 0.25). README note and 13 CPU unit tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Satyajeeth Suresh Kannan <jeetusk08@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Satyajeeth Suresh Kannan <jeetusk08@gmail.com>
Structure demotion demoted the standalone "-" tokens of UUIDs (RULER niah_multikey_3: keys and values are UUIDs, so "-" repeats hundreds of times), evicting parts of the identifiers the query has to retrieve. A structural token that carries no whitespace and sits between a token ending in a letter/digit and a token starting with one is a joiner (UUID dashes, 3.14, 10:30, 1,000) and is now left alone; separators (list markers, quotes, brackets, tokens with a newline) are demoted as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Satyajeeth Suresh Kannan <jeetusk08@gmail.com>
|
Thanks for taking a look! There's no paper yet. Structure demotion is new, and the benchmark run linked above is the main evaluation so far. I'm writing it up as a short preprint now. Would an arXiv link be enough? If so I'll post it here once it's up. Otherwise feel free to close this for now and I'll reopen it with the paper. 🤖🤖🤖 |
82aa641 to
2e41b0d
Compare
|
Here's the paper: https://github.com/JeetuSK0808/kvpress/blob/structure-demotion-paper/structure_demotion.pdf (LaTeX source is in the same branch). It describes and evaluates the method, with the full per-task results and paired confidence intervals against the leaderboard predictions. I'm setting up an arXiv posting and will add that link here once it's live. Also rebased this PR onto current main, so the merge conflict in kvzip_press.py is resolved. 🤖🤖🤖 |
PR description
What. A default-off option on
KVzipPress(inherited byRestoreKVPress): before eviction, scale thereconstruction scores of structural tokens — punctuation/whitespace/symbol tokens that repeat ≥
structure_min_repeatstimes in the context and are not glued inside an identifier — bystructure_demotion.Letters and digits are never touched.
Why. On RULER-4096 at compression ratio 0.9375 (256 KV pairs per head kept),
RestoreKV_plusspends about halfof its budget on the scaffolding of the context: list separators, newlines, quotes (diagnostic on cwe: ~60% of the
context is list structure; words are kept at 10%, numbers at 3.8%, whitespace at 8.7%). Reconstruction-based
scoring rates those tokens highly because they are trivially predictable from each other, not because the
answer needs them. Demoting them hands the budget to content.
Measured (Qwen3-8B, ratio 0.9375, paired 100-row screens on the same rows as the baseline, MPS+sdpa):
cwe 90.6 vs 77.2 (+13.4, 95% CI [+10.8, +16.0]); niah_multikey_1 94.0 vs 90.0 (+4.0, CI [+1.0, +8.0]);
niah_multivalue 85.5 vs 80.8 (+4.75, CI [+1.5, +7.75]); fwe 90.0 vs 82.3 (+7.67, CI [+4.67, +10.67]).
Full 13-task run (500 rows each, RULER 4096, Qwen3-8B, ratio 0.9375, MPS + sdpa, bf16): mean string_match 89.64 vs 86.38
for
RestoreKV_pluson the leaderboard — cwe 90.96 (78.88), fwe 90.0 (83.67), niah_multikey_1 92.2 (85.8), niah_multikey_299.2 (99.6), niah_multikey_3 96.8 (97.0), niah_multiquery 98.2 (96.8), niah_multivalue 88.15 (82.75), niah_single_1 100 (100),
niah_single_2 96.0 (90.8), niah_single_3 95.8 (93.0), qa_1 67.6 (65.4), qa_2 50.4 (49.2), vt 100 (100). Results PR to the
leaderboard Space: nvidia/kvpress-leaderboard (opened right after this PR). I don't have a CUDA box; happy to see a CUDA re-run replace the row.
Safety by construction. The rule keys on repetition and token class; a needle is a number or a word and is
never demoted. Punctuation glued inside an identifier — a whitespace-free token between a letter/digit and a
letter/digit, such as the dashes of a UUID,
3.14,10:30,1,000— is a joiner and is never demoted either(without this, RULER's
niah_multikey_3, whose keys and values are UUIDs, lost a third of its answers). Prefix andsink positions are excluded; positions beyond the context (RestoreKV's restore tokens) are untouched.
structure_demotion=0(default) leaves every existing press bit-identical.Tests.
tests/presses/test_kvzip_structure_demotion.py(16 CPU tests). Style: black/isort/flake8/mypy clean.Assisted by an automated agent (Claude Code); reviewed and submitted by the author. 🤖🤖🤖
Checklist
Before submitting a PR, please make sure:
make test) — the newtests/presses/test_kvzip_structure_demotion.py(16 CPU tests) plus upstream's KVzip-related test files (tests/presses/test_presses.py,tests/test_pipeline.py: 278 passed, 3 skipped, CPU) were run locally; the option is default-off so existing presses are bit-identicalmake style, on errors try fix withmake format) — black / isort / flake8 clean,mypy --check-untyped-defsclean on the touched filegit commit -sNot a new press file — this PR adds two default-off options to the existing
KVzipPress(inherited byRestoreKVPress) and two registry entries, so the "(new press)" items do not apply:mypress_press.pyis in thepressesdirectory — n/aMyPressis in__init__.py— n/aREADME.mdis updated with a 1 liner about the new press in the Available presses section — one sub-bullet underKVzipPressdefault_presseslist intests/default_presses.py— n/a (option on an existing press)🤖 Generated with Claude Code 🤖🤖🤖