You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: prompt_cache_e2e dense multi-turn assertion under-allows for block flooring with thinking models #1156
prompt_cache_e2e::multi_turn_chat_reports_cached_tokens_and_lowers_prefill_latency (an #[ignore]d test run manually with local qwen3-0.6b-4bit weights) fails deterministically at turn 3: cached_tokens is 64 against a previous prompt length of 73, but the assertion at tests/prompt_cache_e2e.rs:359 allows only 4 tokens of slack.
Attribution is settled by a two-arm measurement: the pre-epic baseline 9c154ff3 fails with token-for-token identical values (cached 0/48/64/96/112 across 5 turns), so this is pre-existing and not a regression from epic #1148. Reproduced 2026-08-15 on main a206f089 and on the baseline with identical numbers; the full turn table is in epic #1148's summary comment.
Mechanism. Dense trie adoption is block-floored to multiples of 16 (all observed cached values are multiples of 16). With max_tokens=16, the qwen3 thinking model produces empty assistant content (all 16 tokens go to the unterminated think block), so the history re-render diverges right at the previous prompt boundary, and flooring can cost up to 15 tokens, which exceeds the 4-token slack.
Proposed Solution
One of:
Raise the slack to one block minus 1 (15 tokens).
Derive the slack from the paged block size constant instead of hardcoding 4, so the assertion stays correct if the block size changes.
Make the fixture avoid the empty-content case: use a non-thinking model, or a larger max_tokens so assistant content is non-empty and the re-rendered history does not diverge at the previous prompt boundary.
The other assertions in the test (cached > 0, monotonic growth) are sound and should stay strict.
Acceptance Criteria
The multi-turn test passes deterministically with the local qwen3-0.6b-4bit fixture across all 5 turns
The slack in the under-allowance assertion is either derived from the block size constant or documented with the block-flooring rationale
The strict assertions (cached_tokens > 0 from turn 2, monotonic growth) remain unchanged
Technical Considerations
Refs epic #1148 (integration verification that surfaced this, full turn table in its summary comment). The deterministic token-identical failure on both arms rules out cache-policy changes from the epic as a cause.
Activity
test: import the APC block size instead of mirroring it
test: derive prompt_cache_e2e slack from the paged block size (#1158)
test: derive prompt_cache_e2e slack from the paged block size (lablup…