Archived
sched: a prefix hit on a sliding-window model resumes from a snapshot of the window behind it
The prefix cache cannot index a windowed group, so every hit on a windowed
trunk re-prefilled the whole prompt (73620ef). Gemma 4 31B (50 of 60 layers
windowed at 1024) paid that on every chat and agent turn: 17-48 s to the
first token at 25-49k tokens.
A model with a window and no linear state now takes one checkpoint per
prompt, a block short of its end -- the next turn re-renders the last few
tokens -- if the prompt is --checkpoint-interval tokens or longer, and does
not split chunks at the interval. The prefix cache treats the window like
linear state: a hit is reusable at a checkpoint only. admit_one adopts the
full-attention blocks as before, seeds the windowed groups at the window's
floor, and the entry's restore fills them from the slot; anything else
re-prefills as before. A model with both linear state and a window keeps
refusing the hit.
Measured on Gemma 4 31B, TP 2, agent transcripts: a follow-up turn's first
token in 0.8-3.4 s instead of 17-48 s; greedy output byte-identical to a
cold prefill with the same chunk boundaries (32 turns, chains five hits
deep, thinking on and off).
This commit is contained in:
1 parent
93389679e8
commit
e35052abfe
7 files changed
+70
-8
No files matched your search
@@ -158,6 +158,9 @@ int PrefixCache::configure(const Config& cfg, KVManager* kv, int64_t checkpoint_
|
||||
}
|
||||
|
||||
interval_ = checkpoint_interval;
|
||||
/* A WINDOW SNAPSHOT is state in the same sense: a hit is reusable at a checkpoint only, where
|
||||
* the slot carries the window behind it (KVManager::has_window_snapshot). */
|
||||
if (kv->has_window_snapshot() && interval_ > 0) has_linear_ = true;
|
||||
if (has_linear_) {
|
||||
if (interval_ <= 0) {
|
||||
RAD_ERR("checkpoint_interval is %lld but the model has linear-attention state. A "
|
||||
|
||||
Reference in new issue
Block a user