Repository navigation
llm: skip quantized kv cache for models that don't support it - #16955
Open
tenderdeve wants to merge 1 commit into
Open
tenderdeve wants to merge 1 commit into
tenderdeve wants to merge 1 commit into
Conversation
gpt-oss uses attention with sinks, which crashes llama-server when served with a quantized KV cache (OLLAMA_KV_CACHE_TYPE=q8_0). A guard for this lived in GGML.SupportsKVCacheType, but that function lost all of its callers and the gpt-oss branch was later removed in 19e6796, so the requested cache type now reaches llama-server unchecked and core dumps. Restore the gpt-oss guard, move SupportsKVCacheType onto KV, and consult it when building the llama-server command: if the model does not support the requested cache type, fall back to the default instead of passing an unsupported one. Fixes ollama#16946
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16946
Serving gpt-oss with
OLLAMA_KV_CACHE_TYPE=q8_0core dumps llama-server. gpt-oss uses attention with sinks, which does not support a quantized KV cache.A guard for this used to live in
GGML.SupportsKVCacheType, but that function lost all of its callers and the gpt-oss branch was removed in 19e6796 (assuming a GGML update made it safe). The requested cache type now flows straight to llama-server as--cache-type-k/--cache-type-vunchecked, so it crashes. This is a regression — the reporter confirms it works on 0.24.0 and fails on 0.30.x.This restores the gpt-oss guard, moves
SupportsKVCacheTypeontoKV, and consults it when building the llama-server command: if the model doesn't support the requested cache type, fall back to the default instead of passing an unsupported one.Added a unit test covering gpt-oss (quantized rejected, f16/unset allowed) and other architectures (q8_0/q4_0 allowed).