Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

feat(studio): expose full KV cache dtype list in model config UI (#7348)

Souravrajvi0330586de7c9e
diff --git a/studio/backend/models/inference.py b/studio/backend/models/inference.py
index 26632421878..1758efe515f 100644
--- a/studio/backend/models/inference.py
+++ b/studio/backend/models/inference.py
@@ -70,7 +70,10 @@ class LoadRequest(BaseModel):
cache_type_kv: Optional[str] = Field(
None,
- description = "KV cache data type for both K and V (e.g. 'f16', 'bf16', 'q8_0', 'q4_1', 'q5_1')",
+ description = (
+ "KV cache data type for both K and V "
+ "(e.g. 'f16', 'bf16', 'q8_0', 'q4_0', 'q4_1', 'q5_0', 'q5_1', 'iq4_nl', 'f32')"
+ ),
)
gpu_ids: Optional[List[int]] = Field(
None,
@@ -442,7 +445,10 @@ class LoadResponse(BaseModel):
)
cache_type_kv: Optional[str] = Field(
None,
- description = "KV cache data type for K and V (e.g. 'f16', 'bf16', 'q8_0')",
+ description = (
+ "KV cache data type for K and V "
+ "(e.g. 'f16', 'bf16', 'q8_0', 'q4_0', 'q4_1', 'q5_0', 'q5_1', 'iq4_nl', 'f32')"
+ ),
)
chat_template: Optional[str] = Field(
None,
@@ -602,7 +608,11 @@ class InferenceStatusResponse(BaseModel):
)
cache_type_kv: Optional[str] = Field(
None,
- description = "KV cache quantization dtype (e.g. 'q8_0'), or None for default",
+ description = (
+ "KV cache quantization dtype "
+ "(e.g. 'f16', 'bf16', 'q8_0', 'q4_0', 'q4_1', 'q5_0', 'q5_1', 'iq4_nl', 'f32'), "
+ "or None for default"
+ ),
)
chat_template: Optional[str] = Field(
None, description = "Model's default chat template (Jinja2 source), if any"
diff --git a/studio/backend/routes/models.py b/studio/backend/routes/models.py
index 3c0d6ff4ba4..ed83a12f482 100644
--- a/studio/backend/routes/models.py
+++ b/studio/backend/routes/models.py
@@ -2692,7 +2692,10 @@ async def get_kv_cache_estimate(
repo_id: str = Query(..., description = "HF repo ID or local path"),
quant: str = Query(..., description = "Quantization label (e.g. Q4_K_M)"),
n_ctx: int = Query(..., ge = 1, description = "Context length to size the KV cache for"),
- cache_type_kv: Optional[str] = Query(None, description = "KV cache dtype (e.g. q8_0)"),
+ cache_type_kv: Optional[str] = Query(
+ None,
+ description = "KV cache dtype (e.g. q8_0, q4_0, q5_0, iq4_nl, f32)",
+ ),
current_subject: str = Depends(get_current_subject),
):
"""Estimate KV cache + weight bytes for a downloaded GGUF at n_ctx.
diff --git a/studio/frontend/src/features/model-picker/components/model-config-page.tsx b/studio/frontend/src/features/model-picker/components/model-config-page.tsx
index ee208dc0bc1..afbd33af7cb 100644
--- a/studio/frontend/src/features/model-picker/components/model-config-page.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-config-page.tsx
@@ -415,7 +415,8 @@ function GgufAdvancedSettings({
<span className={LABEL_CLASS}>KV Cache Dtype</span>
<InfoHint>
Lower KV cache precision to save VRAM at the cost of some quality.
- f16/bf16 are full precision; q8_0/q5_1/q4_1 are quantized.
+ f16 is the default; bf16 and f32 are full precision; q8_0 through
+ iq4_nl are quantized.
</InfoHint>
</div>
<Select
diff --git a/studio/frontend/src/features/model-picker/model-config/per-model-config.ts b/studio/frontend/src/features/model-picker/model-config/per-model-config.ts
index 0b034237361..ba6d4cec997 100644
--- a/studio/frontend/src/features/model-picker/model-config/per-model-config.ts
+++ b/studio/frontend/src/features/model-picker/model-config/per-model-config.ts
@@ -46,7 +46,17 @@ export const MAX_SEQ_LENGTH_STEP = 128;
export const DEFAULT_MAX_SEQ_LENGTH = 4096;
export const CONTEXT_LENGTH_MIN = 128;
-export const KV_CACHE_DTYPES = ["bf16", "q8_0", "q5_1", "q4_1"] as const;
+// Matches studio/backend/core/inference/llama_cpp.py _valid_cache_types (f16 is the UI default).
+export const KV_CACHE_DTYPES = [
+ "bf16",
+ "q8_0",
+ "q4_0",
+ "q4_1",
+ "q5_0",
+ "q5_1",
+ "iq4_nl",
+ "f32",
+] as const;
const VALID_KV_CACHE_DTYPES = new Set<string>(KV_CACHE_DTYPES);
export const SPECULATIVE_TYPES = [