server: retain recurrent prompt checkpoints for reuse - #24899
Conversation
|
Local live validation on Qwen3.6-35B-A3B-MTP GGUF, using this PR branch (
I sent two chat-completion requests with the same long shared prefix and only a small suffix change, Client-side timing: Relevant server log excerpt: So the second request avoided replaying the 37.8k-token shared prefix and restored from the near-tail recurrent checkpoint, replaying only the changed suffix. |
Assisted-by: OpenAI Codex
Assisted-by: OpenAI Codex
Assisted-by: OpenAI Codex
83d6d2c to
e239e0c
Compare
|
I'd like to bump this. These updates have been essential for getting useful behavior out of these hybrid recurrent models. If there are other approaches being explored here, I'll be happy to close this and follow those, but if not I request review of this approach. |
Assisted-by: OpenAI Codex
|
@aldehir it's another one :) |
This already works on |
|
Yup. #24176 fixed this and was merged just after I implemented this. Sorry for the noise. |
Summary
This adds server-side checkpoint retention for recurrent-model prompt reuse.
--recurrent-snapshotsMotivation
Hybrid/recurrent models can reuse long prompt prefixes, but without a restorable recurrent state the server can only safely reuse exact tail-aligned cache state. For long agent/chat histories, a small rollback window causes otherwise reusable common prefixes to be replayed from the start. Keeping bounded recurrent snapshots plus ladder checkpoints makes long-prefix reuse practical while keeping memory bounded.
Testing
cmake --build build --config Release -j --target llama-server test-server-checkpoint-policyctest --test-dir build -R test-server-checkpoint-policy --output-on-failureOpened as draft because the option names and checkpoint-retention policy are intended for maintainer review before this is considered final.