Skip to content

fix(cache): retain measured prefill costs after expiry - #285

Merged
lukealonso merged 1 commit into
NVIDIA:mainfrom
dbotwinick:dbotwinick/fix-checkpoint-cost-discovery
Nov 13, 2026
Merged

lukealonso merged 1 commit into
NVIDIA:mainfrom
dbotwinick:dbotwinick/fix-checkpoint-cost-discovery

Conversation

@dbotwinick

Copy link
Copy Markdown
Contributor

Recorded or edited conversations can branch before the previous prompt's final message. They need an earlier checkpoint to reuse that prefix. The checkpoint work estimator requires every competing prefill shape to have a fresh duration, although ordinary dispatch retains measured durations after their 30-second freshness window. A rarely selected shape can therefore disable all optional checkpoints indefinitely: its measured cost still exists, but bounded refresh has not revisited it. This is reproducible after an idle gap on Qwen3.8-27B with Selene enabled.

Change interval_prefill_ns to use the same retained duration lookup as dispatch, rejecting absent or zero measurements. Add a regression test that ages the prefill measurements, refreshes only the snapshot-copy measurement, and checks that optional checkpoint selection resumes. Update the two scheduling specifications. The existing 5% work allowance and fresh snapshot-copy requirement still govern optional captures; model preparation and cache ownership are unchanged.

On the same DGX Spark, all three fresh-instance comparisons restored 16,751 cached tokens on the third long request after a 31-second idle gap. Unmodified main reused zero. That request's TTFT fell from 5.72–5.78 seconds to 0.43–0.44 seconds. Summed TTFT for all three post-gap requests averaged 16.85 seconds on main and 11.65 seconds with the fix. The first two remain misses while the snapshot estimate refreshes. Initial unmeasured prefill shapes can still suppress optional checkpoints.

Validation used main 8a887202a0ee55d456ddcf7510161e22865505bc and this patch, the same prepared Qwen3.8-27B NVFP4 core with embedded MTP, xhigh reasoning, 262,144-token serving context, and Selene disk caching (--prefix-cache-disk-limit 32G, no DRAM tier). Three pairs alternated engine order on one idle GB10 Spark. Each fresh instance received three short recorded requests, three long requests to learn the shape costs, a 31-second pause, and the three long requests under a fresh namespace. All 54 responses returned the exact 64-token target. Saved requests match across variants within each repeat; raw streams and native usage counters were independently reparsed. GPU samples showed only the owned engine.

The new regression fails on unmodified main. The full Helios library suite with server,runtime-core and prepared template fixtures passes: 1,369 passed, 0 failed, 26 ignored. The ignored hardware, external-fixture and manual benchmark tests were not run. The scheduler subset also passes all 296 tests. Live validation covers one existing model core on GB10, not tensor-parallel execution or other hardware.

A separate full agentperf-default-v1 replay on another idle GB10 Spark passed all 168 exact-output requests with xhigh and Selene: 803.597 seconds (13m 24s), 30,883 output tokens, and 2,277,236 / 2,533,974 prompt tokens cached (89.9%). The native duration sum, workload digest, complete recorded histories, token targets and all 168 traces were checked. It recorded 84 optional message captures and 309 endpoint captures, with no storage skips. This is one compatibility diagnostic; the earlier full-main timings used a different physical Spark, so no isolated full-replay speedup or repeatability claim follows from that comparison.

PR #227 addresses publication and offload retention of checkpoints that already exist. It does not change this estimator gate. This patch requires no changes from that PR.

Checkpoint planning requires every competing prefill shape to have a fresh
cost, even though dispatch retains measured costs after their freshness
window. A rarely refreshed shape can therefore suppress optional prefix
checkpoints after idle and force divergent conversations to re-prefill.

Use the retained duration lookup for prefill work estimates, rejecting
absent or zero measurements. Add an idle-expiry regression and clarify the
two scheduling specifications. Snapshot-copy freshness, the work allowance,
and cache ownership remain unchanged.

This keeps measured prefill work usable when choosing optional checkpoints.
In three fresh-instance pairs on one GB10 Spark, the third long request
after a 31-second pause reused 16,751 tokens with the fix versus zero on
main; TTFT fell from 5.72-5.78 seconds to 0.43-0.44 seconds.

The regression fails on unmodified main. Helios library tests with
server,runtime-core pass: 1,369 passed, 26 ignored. All 54 paired requests
met their exact targets. One Qwen3.8-27B NVFP4 full AgentPerf replay with
xhigh and Selene passed 168/168 requests in 803.597 seconds. That single
trial does not establish repeatability or a same-device full-replay
speedup. Tensor-parallel execution and other hardware were not tested.

Design-Signed-Off-By: Codex (GPT-6); design-review=ed22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants