Repository navigation
Studio (Windows): keep prompt caching on full GPU offload - #7260
Conversation
…ow-up) The #5692 full-offload tuning also added --no-cache-prompt, which disables in-VRAM prompt-prefix reuse. That is unrelated to the host-RAM KV checkpoints #5692 fixed (--cache-ram 0 / --ctx-checkpoints 0): a fully offloaded model keeps its KV cache in VRAM, so reusing a common prefix does not copy to system RAM and does not cause the PCI-E overhead. --no-cache-prompt only forces every request to re-prefill the whole prompt, which is small for short chats but severe for large stable system prompts reused across calls (coding agents, long multi-turn chats). Remove --no-cache-prompt; keep the checkpoint disables and the thread/OMP tuning. _prompt_cache_disabled stays False (its default), so slot save/restore is intact. Verified on a fully offloaded gemma GGUF: an identical repeated prompt reprefills 1 token instead of 2220.
There was a problem hiding this comment.
Code Review
This pull request modifies the Windows full offload tuning logic for llama-server to keep prompt caching enabled (in-VRAM prefix reuse) while still disabling host-RAM KV checkpoints to avoid WDDM/PCI-E overhead. This prevents repeated prompts from being re-prefilled on every request. The corresponding test in test_llama_cpp_mtp_detection.py has been updated to reflect this change. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Add a backend-wide test that AST-scans studio/backend and fails if --no-cache-prompt is appended/extended/+= into a command. This locks in the #7260 fix across every code path, not just load_model. Detecting the flag or honouring a user-supplied one stays allowed.
|
Added a backend-wide regression guard in a follow-up commit so this cannot creep back in.
Still allowed, so nothing legitimate is blocked:
Verified: full file green (246 passed), and a temporary re-injection of both |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
The Windows full-offload tuning from #5692 disables host-RAM KV checkpoints (
--cache-ram 0,--ctx-checkpoints 0) to avoid WDDM/PCI-E overhead, which is correct. It also adds--no-cache-prompt, and that one is an overreach: it turns off in-VRAM prompt-prefix reuse, a different feature. For a fully offloaded model the KV cache lives in VRAM, so reusing a common prefix does not copy anything to system RAM and does not cause the PCI-E overhead #5692 was about.The side effect is that llama-server re-prefills the entire prompt on every request. It is barely noticeable for short single-turn chats, but severe for a large, stable system prompt reused across many calls (coding agents via
unsloth start, long multi-turn chats). In testing, one short turn re-prefilled about 79k prompt tokens.This affects all Windows full-offload GGUF inference (Studio UI chat,
unsloth startagents, direct API), so it is not agent-specific.Change
Drop
--no-cache-promptfrom thewin32 and full_offload_tuning_activebranch instudio/backend/core/inference/llama_cpp.py. Keep--cache-ram 0and--ctx-checkpoints 0(the flags that actually address #5692) and the OMP / thread tuning._prompt_cache_disabledtherefore staysFalse(its default), so slot save/restore continues to work.Verification
Fully offloaded gemma GGUF, the same prompt sent twice with prompt caching on, then once with it off:
A repeated prompt is reused (2220 to 1) instead of fully re-prefilled. Backend tests pass (
studio/backend/tests: 404 passed, 13 skipped), including the updatedtest_windows_full_offload_flags_use_current_llama_server_args, which now asserts--no-cache-promptis not added.