Skip to content

DeepSeek-V4.1: --prompt-cache-gib sets the kept states' RAM limit, on every rank (#1625) - #2056

Merged
ashhart merged 2 commits into
mainfrom
lead/1625-cache-gib
Nov 3, 2026
Merged

ashhart merged 2 commits into
mainfrom
lead/1625-cache-gib

Conversation

@ashhart

@ashhart ashhart commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Closes #1625's first point. DeepSeek-V4.1 took its kept-state budget only from TF_DSV41_SESSION_*, so --prompt-cache-gib did nothing.

  • --prompt-cache-gib N sets the store's resident (in-RAM) limit to N GiB. 0 keeps no idle state in RAM; with TF_DSV41_SESSION_DISK, an evicted chat is parked on disk.
  • A set TF_DSV41_SESSION_RESIDENT_GIB wins, with one log line.
  • With neither set, the default is unchanged (no limit).
  • At TP > 1, rank 0 resolves the limit and sends it to every follower over the plan link, right after the session preflight. Every rank evicts the same chats, because the compared bytes are the same on every rank. A follower whose own variable differs refuses at startup, by name, on both ranks.

Host tests cover one rank (4 GiB, 1.5 GiB, 0, variable wins, neither) and two ranks over the loopback plan socket (the flag reaches the follower, a mismatch refuses on both, the default is kept on both). Both were checked to fail with the code broken. The DeepSeek host suites pass, the Linux CUDA build compiles, and there are no new lean problems. Replies don't move: the limit only decides which idle chats stay in RAM. A TP=2 run on two GB10s is still owed: the cap on both ranks, the same evictions, and the mismatch refusal. The 2,048-token resume boundary the issue also raises is a separate change.

Served.open dropped the server's prompt-cache budget, so the store's residency came only from the TF_DSV41_SESSION_* variables. The flag now sets the resident byte limit (0: none kept) when TF_DSV41_SESSION_RESIDENT_GIB is unset; a set variable wins and the engine logs it. With TP > 1 the followers never see the flag, so it is ignored there with a log line rather than letting rank 0's evictions diverge from the other ranks'.

Refs #1625.
…imit

Each rank's store enforces the resident limit itself on the same bytes, so the limit must be one value on every rank, but `tf-dsv41 follow` never sees the flag and the previous commit ignored it at TP > 1. Rank 0 now resolves its limit (the variable wins, else the flag, else unlimited) and sends it over the plan link right after the session preflight; followers use it. A follower whose own TF_DSV41_SESSION_RESIDENT_GIB is set and differs refuses on every rank by name, since a split limit would make a later restore disagree across ranks. The session protocol identity moves to 3, so ranks of different builds refuse at the preflight instead of misreading the new exchange.

Refs #1625.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeepSeek-V4.1: prompt cache resumes only at 2,048-token boundaries and ignores --prompt-cache-gib

1 participant