Repository navigation
feat(studio): expose full KV cache dtype list in model config UI - #7348
Conversation
Fixes unslothai#7244 The Studio per-model config dropdown only surfaced bf16, q8_0, q5_1, and q4_1 even though llama.cpp already accepts q4_0, q5_0, iq4_nl, and f32. Add the missing options to KV_CACHE_DTYPES and align API field descriptions with the backend _valid_cache_types set.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Manual UI verification completed locally (CPU-only, no GPU inference):
Results:
Model load itself was not GPU-verified end-to-end; this check only covers UI exposure and per-model persistence. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! 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". |
|
Reviewed and verified. The model config UI exposed only a partial KV cache dtype list, so valid options were unreachable. This exposes the full KV cache dtype list in the config UI. Confirmed the options render and map to valid backend values. Codex review has no open items. The remaining red CI is pre-existing upstream breakage unrelated to this change. Good to merge. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20ce58d0c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| export const KV_CACHE_DTYPES = [ | ||
| "bf16", | ||
| "q8_0", | ||
| "q4_0", |
There was a problem hiding this comment.
Disable quantized cache types when tensor parallelism is selected
When a user selects the newly exposed q4_0 option (and likewise q5_0 or iq4_nl) together with Tensor Parallelism, the load path detects that tensor mode cannot use quantized KV caches and silently clears the selected dtype before launching (llama_cpp.py:6596-6612). The model therefore loads with the default non-quantized cache while the saved per-model configuration still says q4_0, defeating the VRAM-saving setting and making the UI misleading for this supported configuration combination. Disable these choices while tensor parallelism is enabled, or surface that tensor parallelism will override them.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed the llama.cpp limitation (--split-mode tensor aborts on a quantized KV cache), but disabling the quantized dtypes whenever the tensor-parallel toggle is on would block configurations the backend does support. Manual mode with fewer than 2 effective GPUs, manual mode with Auto layers, and the layer-split fallback all turn tensor parallelism off and preserve the requested quantized cache (llama_cpp.py restores _tensor_dropped_cache_type_kv on those paths). The incompatibility is only real when tensor split genuinely engages (auto mode, >= 2 GPUs), and the load path already resolves it there by dropping the quantized cache for the tensor attempt. Coupling the dropdown to the toggle would strip valid quantized + TP-requested combinations, so keeping the runtime resolution in the backend is intentional. Leaving the option list as-is.
There was a problem hiding this comment.
Disable quantized cache types when tensor parallelism is selected
When a user selects the newly exposed
q4_0option (and likewiseq5_0oriq4_nl) together with Tensor Parallelism, the load path detects that tensor mode cannot use quantized KV caches and silently clears the selected dtype before launching (llama_cpp.py:6596-6612). The model therefore loads with the default non-quantized cache while the saved per-model configuration still saysq4_0, defeating the VRAM-saving setting and making the UI misleading for this supported configuration combination. Disable these choices while tensor parallelism is enabled, or surface that tensor parallelism will override them.Useful? React with 👍 / 👎.
Instead of disabling the choices, showing a warning message in the interface would be sufficient
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
Fixes #7244
Problem
The Studio per-model KV Cache Dtype dropdown only exposed
bf16,q8_0,q5_1, andq4_1, even thoughstudio/backend/core/inference/llama_cpp.pyalready accepts the full llama.cpp cache-type set (q4_0,q5_0,iq4_nl,f32, …) and the VRAM estimator already handles them (test_kv_cache_estimation.py).Users who wanted lower KV memory (especially
q4_0) had no UI path to select it; the value was also dropped on reload becauseVALID_KV_CACHE_DTYPESin the frontend did not include the missing entries.The issue referenced
chat-settings-sheet.tsx; on currentmainthis control lives in the per-model config page (model-config-page.tsx).Fix
studio/frontend/src/features/model-picker/model-config/per-model-config.ts: expandKV_CACHE_DTYPEStobf16,q8_0,q4_0,q4_1,q5_0,q5_1,iq4_nl,f32(matches backend_valid_cache_types;f16stays the default menu item).studio/frontend/src/features/model-picker/components/model-config-page.tsx: update the KV cache dtype help text.studio/backend/models/inference.py: document all supported dtypes oncache_type_kvfields.studio/backend/routes/models.py: broaden the VRAM-estimate query param description.No backend load-path changes — this is UI exposure + docs for types llama-server already understands.
Verification
pytest tests/test_kv_cache_estimation.py— 143 passednpm run typecheck— clean_valid_cache_types(parity script checked locally)q4_0/q5_0/iq4_nl/f32; selectingq4_0with "Remember for this model" persists through page reload (Playwright, CPU-only; model load not GPU-verified end-to-end)