prefix caching: the unaligned-resume equivalence gate dissolves — the path is unreachable #47
Labels
No labels
human-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitpartner/tt-stack#47
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
docs/LOOP-ITERATIVE-IMPROVEMENT.mdcarried backlog lever 2, "unaligned-resumeequivalence — required before prefix caching ships", as outstanding correctness work
gating the prefix-caching arm. It is not work. The condition it guards cannot occur
in any valid configuration. Recorded here so it is not picked up again.
Verdict record:
bench/runs/unaligned-resume-equivalence-verdict-20260920T0800Z.jsonl(
4f2cdc2). No hardware was used and no boot was spent.The argument
Three enforced constraints compose:
qwen36_prefix_cache.py:47—if block_size < 2048 or block_size % 2048: raise,so
block_sizeis a multiple of 2048.prefill_chunk_planvalidation —chunk_size % block_sizemust be 0, whichrejects any
block_sizelarger thanchunk_size.model.py:2107asserts the 2048-token chunk, and every call site passes 2048(894, 915, 1142, 1258, 2548, 3437).
Enumerating 64…32768, constraints 1 and 2 with
chunk_size = 2048admit exactly onelegal block size: 2048.
qwen36_prefix_cache.py:28-30— a resumestartis a prefix-cache hit length and istherefore always a multiple of
block_size.Therefore
start % chunk_size == 0always, andplan["lead"]is alwaysNone.Exhaustive check over the legal space: 0 of 1,400
(block_size, start, end)combinations reach the unaligned lead.
Do NOT delete the lead branch
It is defensive, not dead-by-accident. It is the only thing standing between a
future
chunk_sizechange and a silent KV gap.Re-open trigger, explicitly
Raising
chunk_sizeabove 2048 whileblock_sizestays 2048 makes the path liveimmediately:
Any change to the 2048 chunk must re-open this lever. The
model.py:2107assert iswhat currently prevents it.
Evidence the instrument is not vacuous
bench/fixtures/fixtures-prefix-chunk-plan-test.pypasses 12 cases against thereal prefix
model.py, including three unaligned-resume shapes ([1024,8222),[64,2048),[2112,9000)), and its negative control rejects the unpatched logicon all 8 resume cases.
bench/prefix_hit_equivalence.pypasses 7/7 fixture cases including the BLINDdetector (a harness that gives the same digest to a different question is caught).
The one weaker link, stated
Link 4 (hit lengths are whole blocks) is verified from the in-source comment at
qwen36_prefix_cache.py:28-30plus vLLM's standard block-granular hit accounting —not by executing the hit path. It is the only one of the four not proven by direct
enumeration.
What this does NOT cover
Aligned-resume numerical equivalence is a different question and remains open. It is
what
bench/ab/cache-speed-16k-32k.sh'sequiv_cold/equiv_warm/equiv_controlphases exercise, and that has not been run on the current tree. That is the real
remaining prefix correctness item.
Related: #47
Correction: the "Related: #47" line in the description is a self-reference typo. The intended link is #48 (the prefix-caching deploy decision), which is where the remaining open item from the last section — aligned-resume numerical equivalence on the current tree — is tracked.
agy research (2026-09-24)
Findings: Unaligned-Resume Path is Truly Unreachable
Independently verified the prefix-caching resume path across the vLLM plugin and TT model:
qwen36_prefix_cache.py:254: Enforcesblock_size >= 2048 and block_size % 2048 == 0.prefill_chunk_plan(model.py): Enforceschunk_size % block_size == 0.model.py:2120&qwen36_vllm.py:31: Pinchunk_size == 2048.2048.startis a prefix hit length (cp.end), whichprepare()strictly requires to match a block checkpoint (cp.end == startwhere checkpoints only record atend % block_size == 0). Thusstart % 2048 == 0always.start % chunk_size == 0holds for every valid call;plan["lead"]isNoneacross all 2,102 enumerated legal(start, end)configurations.chunk_sizeabove 2048 (e.g.chunk_size=4096, block_size=2048, start=2048) makes the lead branch live immediately (lead=(2048, 2048)).Recommendation: CLOSE Issue #47 (gate dissolved; lever struck from backlog as blocked work).
What Changed
agy/issue-474c65566assert plan["lead"] is None/assert False) citing Issue #47 acrossprefill_traced_chunked,_prefill_chunked_eager_tp, and_prefill_traced_chunked_tpin model.py, while leaving defensive lead execution logic intact.Nonelead.Hardware Measurement Needed Next
bench/ab/cache-speed-16k-32k.shequiv_coldandequiv_warm(B=1/B=4), with warm TTFT beating nohead above the relative floor.Open Questions
_chunked_chunk_sizeabove 2048? (Any such change will hit the fail-closed assertion and must re-open the unaligned-resume qualification lever).