Skip to content

[Engine] conversation cache budget: count every part of a split GGUF - #7579

Open
Cinderella-Man wants to merge 1 commit into
Niko1221:mainfrom
Cinderella-Man:fix-conversation-cache-split-gguf
Open

Cinderella-Man wants to merge 1 commit into
Niko1221:mainfrom
Cinderella-Man:fix-conversation-cache-split-gguf

Conversation

@Cinderella-Man

Copy link
Copy Markdown

Problem and result

The conversation cache budget from #7044 (terminal/strata_control/conversation_cache_size.py) takes the model's size
off the free RAM, and reads that size from the file --native names. For a split GGUF that is the first part, which
is often only the metadata. Unsloth's Qwen3.8-Flash-Next UD-Q5_K_XL is six parts: part 1 is 10.4 MiB of 150,954 MiB.
On a 121 GiB PC with three RTX 3090s (layer split, the experts in RAM) the budget was 40 % of (122,308 - 10 - 4,096 -
2,560) MiB, capped at a quarter of the RAM, so the server passed --conversation-cache-mib 30976. The loaded model
leaves about 13 GB of RAM available on that PC, so a long agent session could park conversations until the engine's
2,560 MiB floor.

Now every part beside the named one is counted (<stem>-NNNNN-of-MMMMM.gguf, the naming terminal/ref/load.py
already uses; a missing part counts as nothing). The same start gets no flag, so the engine sizes the cache itself, as
the module says it should for "a model that fills the RAM". A single-file model is read as before.

Related discussion

#7044 (the budget this fixes). No scope question: a fix inside the existing rule, no default changed.

Approach

model_mib() matches the five-digit split name and sums the sizes of parts 1..N in the same folder. The rest of the
module is unchanged. Two tests in terminal/tests/terminal/test_conversation_cache_size.py: the parts are summed
(also when another part is named, and with a part missing), a name that only looks like a part is one file, and the
case above with the real part sizes (Path.stat patched, no 150 GB of files), which now leaves the args alone.

Validation

Passed:

  • python3 -m unittest tests/terminal/test_conversation_cache_size.py (in terminal/, Python 3.14, Linux,
    3416d048b): 16 tests OK. The two new ones fail on 8db8753d5 (1.0 != 6.0; 10.4 != 150953.9).
  • python3 -m unittest serve/test_conversation_cache_budget.py: 8 tests OK.
  • On the PC above (Ubuntu 26.04, driver 615.71.09, CUDA 13.5, Strata 0.2.23, whose conversation_cache_size.py is
    byte-identical to main's), the module on the real files and RAM: before, model 10 MiB, RAM total 124377 free 122308 MiB -> --conversation-cache-mib 30976; after, model 150954 MiB ... -> no flag.
  • The same PC, a full start of the server from a 0.2.23 tree with this change: no [strata] conversation cache: ...
    line, no --conversation-cache-mib on the engine's command line, the engine's own conversation cache sized from the free RAM: 3328 MiB for up to 4 parked conversations, and the server answered (short / code / long-prompt greedy
    requests).

Failed:

None observed.

Not run:

  • python tools/check (pytest is not installed on the machine where I ran the tests; the two files were run with
    unittest). No CI run of this revision.
  • Windows and macOS: the change is path and size handling with pathlib; not run there.

Limits

  • The model size stays the upper bound the module already used (the whole file set, including tables the engine does
    not keep in RAM).
  • A split GGUF whose parts are not all in one folder counts only the parts found beside the named one.

🤖 Generated with Claude Code

…GGUF

`--native` names the first part of a split GGUF (`...-00001-of-00006.gguf`), which is often only the metadata, so the
budget took a few MB off the free RAM instead of the model: a 158 GB UD-Q5_K_XL in six parts on a 121 GiB PC got
`--conversation-cache-mib 30976` while the loaded model left about 13 GB free. Every part beside the named one is
counted now (a missing part counts as nothing), so a split model that fills the RAM is left to the engine's own
sizing, as the module intends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant