Skip to content

server : fix context checkpoint reuse for hybrid/recurrent models with SWA - #32426

Closed
SMC17 wants to merge 1 commit into
ggml-org:masterfrom
SMC17:fix/hybrid-swa-checkpoint-reuse
Closed

SMC17 wants to merge 1 commit into
ggml-org:masterfrom
SMC17:fix/hybrid-swa-checkpoint-reuse

Conversation

@SMC17

@SMC17 SMC17 commented Nov 16, 2026

Copy link
Copy Markdown

Fixes #32339.

Summary

  • For recurrent and hybrid models, llama_memory_seq_pos_min() returns pos_max (the exact position of the recurrent state) rather than pos_max - n_swa + 1.
  • Passing n_swa to server_prompt::get_reuse() caused pos_min_thold to subtract n_swa - 2, rejecting valid checkpoints within n_swa tokens of pos_eval and falling back to an older checkpoint.
  • Pass 0 for n_swa when calling get_reuse() on recurrent or hybrid models (llama_model_is_recurrent(model_tgt) || llama_model_is_hybrid(model_tgt)), since the recurrent state is only valid at its exact position.
  • Add unit tests for server_prompt::get_reuse() in tests/test-server-component.cpp.

Testing

  • ctest --test-dir build -R test-server-component --output-on-failure: 100% tests passed (1/1).

…h SWA

Fixes ggml-org#32339.

For recurrent and hybrid models, llama_memory_seq_pos_min() returns
pos_max (the position of the recurrent state) rather than pos_max - n_swa + 1.
Passing n_swa to server_prompt::get_reuse() caused it to subtract the SWA
slack from pos_eval, rejecting valid checkpoints within n_swa tokens of
the prompt end and falling back to an older checkpoint.

Pass 0 for n_swa when calling get_reuse() on recurrent or hybrid models,
and add unit tests for server_prompt::get_reuse() in test-server-component.
@github-actions github-actions Bot added testing Everything test related server labels Nov 16, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

Hi @SMC17, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

  • Multiple open PRs from a new contributor: We limit new contributors (those without a previously merged PR) to 1 open PR at a time. You currently have 3 open PRs.


Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Nov 16, 2026
@github-actions
github-actions Bot marked this pull request as draft November 16, 2026 18:24
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Nov 16, 2026
@ngxson ngxson closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: LFM3 does not restore context checkpoints within 256 of the prompt end

2 participants