server : skip checkpoints beyond pos_next#24411
Merged
Merged
Conversation
Member
|
This is a regression introduced by #23981. After the change, the checkpoint server information claims to cover a larger position range than it actually does (due to the new masking logic during saving the checkpoint). I think a better fix would be to reflect the correct position range. Something like this probably: diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp
index bdfa51718..1cff8ad61 100644
--- a/tools/server/server-context.cpp
+++ b/tools/server/server-context.cpp
@@ -2046,7 +2046,7 @@ private:
auto & cur = slot.prompt.checkpoints.emplace_back();
- cur.update_pos(slot.prompt.n_tokens() - n_tokens_cur, pos_min, pos_max);
+ cur.update_pos(slot.prompt.n_tokens() - n_tokens_cur, pos_max - n_swa, pos_max);
cur.update_tgt(ctx_tgt, slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY);
cur.update_dft(ctx_dft.get(), slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY); |
ggerganov
approved these changes
Jun 11, 2026
Contributor
Author
|
I tested your recommendation and it also fixes the issue. Also looks like it improves cache reuse, as it is selecting a checkpoint closer to the end in my limited testing. That said, I don't fully understand the implications. |
Member
|
Yup, I'll follow-up on this. It needs some unit tests and a more robust way to determine the position range of the saved checkpoints. |
anaisbetts
pushed a commit
to anaisbetts/llama.cpp
that referenced
this pull request
Jun 16, 2026
* server : skip checkpoints beyond pos_next * cont : update comment + TODO + ref --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com> (cherry picked from commit db94854) (cherry picked from commit b4267b2bc8aee70edb578a00f43992eae872ae5d)
4 tasks
adrianhoehne
pushed a commit
to adrianhoehne/llama.cpp
that referenced
this pull request
Jul 5, 2026
* server : skip checkpoints beyond pos_next * cont : update comment + TODO + ref --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
While working on #24176, I noticed all the Gemma 4 models (12B and 26B in particular) were forgetful when sending a second identical initial message after a series of turns (e.g. the same agentic test case twice). I also noticed the issue did not appear when using
cache_prompt = false.I threw Fable at it, and it found an issue with checkpoints and SWA models. Here is a minimal repro to demonstrate the issue: checkpoint-restore-repro.py
master
PR
Is this a legitimate issue and fix? It appears to have fixed the issues I was seeing.
Requirements