Skip to content

[Feature] Expose Q4_0 as a KV Cache Dtype option in Studio UI #7244

Closed

Description

@ZupoLlask

Summary

The Studio web UI currently exposes these KV cache dtypes in Chat settings:

  • f16
  • bf16
  • q8_0
  • q5_1
  • q4_1

q4_0 is not available in the dropdown, even though backend logic appears to recognize/handle it in KV-related estimation/parsing paths.

Problem

Users who want to trade more quality for lower KV cache memory cannot select q4_0 from the UI, despite it being a known cache type in backend logic and tests.

This creates a UI/backend mismatch:

  • Backend/test paths include handling for q4_0
  • Frontend control does not expose q4_0

Evidence

Frontend dropdown currently hardcodes the available options (no q4_0):

  • studio/frontend/src/features/chat/chat-settings-sheet.tsx
    • SelectItem values: f16, bf16, q8_0, q5_1, q4_1

Backend model field description also currently lists examples without q4_0:

  • studio/backend/models/inference.py
    • cache_type_kv description examples include f16, bf16, q8_0, q4_1, q5_1

Backend tests indicate q4_0 is handled in KV estimation:

  • studio/backend/tests/test_kv_cache_estimation.py
    • includes checks using _estimate_kv_cache_bytes(..., "q4_0")

Proposed change

  1. Add q4_0 to the KV Cache Dtype dropdown in Studio UI.
  2. Update backend/API field descriptions to include q4_0 so docs and UI remain consistent.
  3. (Optional) Add/adjust frontend tests to ensure the option remains available.

Expected behavior

Users can select q4_0 directly from Studio UI KV Cache Dtype settings, and load/estimate flows continue to work consistently.

Acceptance criteria

  • q4_0 appears in the KV Cache Dtype selector in Studio UI
  • Selection persists and is passed through the existing load request path (cache_type_kv)
  • KV estimate/load flows do not regress for existing dtypes
  • Relevant docs/descriptions mention q4_0 alongside other supported KV dtypes

Notes

If q4_0 is intentionally excluded for quality/stability reasons, documenting that rationale in the UI/help text would also resolve the ambiguity.

Activity

  1. added
    feature request
    on Jul 19, 2026
  2. zakirkg commented on Jul 21, 2026

    @zakirkg

    Hi, I have the same question about the KV Cache Dtype options exposed in Unsloth Studio.

    The studio dropdown includes

    • f16
    • bf16
    • q8_0
    • q5_1
    • q4_1

    But studio/backend/core/inference/llama_cpp.py also includes these dtypes inside _valid_cache_types.

    • q4_0
    • q5_0
    • iq4_nl
    • f32

    These additional values are also handled by Studio’s KV-cache VRAM estimator.
    Both the unsloth documentation (https://unsloth.ai/docs/models/tutorials/grok-2) and
    llama.cpp documentation (https://github.com/ggml-org/llama.cpp/blob/master/tools/completion/README.md) list all nine as supported cache types.
    Were q5_0, q4_0, iq4_nl, and f32 intentionally omitted to keep the UI limited to recommended choices particularly because the Unsloth documentation recommends the _1 variants or are they simply not surfaced in Studio yet?

    If the omission is not intentional, would a PR adding these options be welcome?

  3. added a commit that references this issue on Jul 24, 2026
    330586d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions