]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
server: avoid unnecessary checkpoint restore when new tokens are present (#24110)
authorYongyue Sun <redacted>
Thu, 4 Jun 2026 13:09:01 +0000 (21:09 +0800)
committerGitHub <redacted>
Thu, 4 Jun 2026 13:09:01 +0000 (16:09 +0300)
commit6f3a9f3dee3c27545371044a3a38005721ac8a8e
tree6b178d23c8f1e036477b9d2608d72eadd11577bf
parenta121232fdc80ad93587adfce2c56452c9052b850
server: avoid unnecessary checkpoint restore when new tokens are present (#24110)

* server: avoid unnecessary checkpoint restore when new tokens are present

The pos_min_thold calculation unconditionally subtracts 1 to ensure at
least one token is evaluated for logits when no new tokens exist.
However, when the request contains new tokens beyond the cached prefix,
this -1 is overly conservative and may trigger an unnecessary checkpoint
restore.

Conditionally apply the -1 only when n_past >= task.n_tokens() (no new
tokens), avoiding redundant KV state restoration when there is actual
work to do.

* cont : add ref

---------

Co-authored-by: Georgi Gerganov <redacted>
tools/server/server-context.cpp