Skip to content

llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized#25871

Open
fairydreaming wants to merge 1 commit into
ggml-org:masterfrom
fairydreaming:force-fa-quant-kv-cache
Open

llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized#25871
fairydreaming wants to merge 1 commit into
ggml-org:masterfrom
fairydreaming:force-fa-quant-kv-cache

Conversation

@fairydreaming

Copy link
Copy Markdown
Collaborator

Overview

This PR fixes issue described in detail here. It does it by:

  • making sure that K cache type and V cache type are the same for DeepSeek V4, so that any code referring to V cache type makes correct decisions,
  • auto-enabling FA if V cache is quantized or failing if user wants to use quantized V cache with FA explicitly disabled.

Fixes #25851

Requirements

@fairydreaming
fairydreaming requested a review from ggerganov as a code owner July 18, 2026 19:16
Comment thread src/llama-context.cpp
}
}

if (model->arch == LLM_ARCH_DEEPSEEK4 && params.type_k != params.type_v) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this currently applies also to DeepSeek V3.2 and models where hparams.is_mla() is true since they use a view of K cache as V cache, maybe it's worth extending the condition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: CUDA GGML_ASSERT(tensor->nb[0] == ggml_element_size(tensor)) fitting Deepseek V4 Flash, but manual tensor split works

2 participants