]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
memory: respect unified KV cache in hybrid memory for eval tasks (#21224)
authorEttore Di Giacinto <redacted>
Wed, 1 Apr 2026 09:50:17 +0000 (11:50 +0200)
committerGitHub <redacted>
Wed, 1 Apr 2026 09:50:17 +0000 (12:50 +0300)
commite1cb817483ebda4e3ebc30fd07f4292c654f4339
treeae154ddaf061bc46de78dda0f2850f00a9f3e637
parent88d5f8ffc398f9d6dbe529e3f0f0c739eabeafa7
memory: respect unified KV cache in hybrid memory for eval tasks (#21224)

The hybrid memory paths (`llama-memory-hybrid.cpp` and
`llama-memory-hybrid-iswa.cpp`) always used sequential equal split,
ignoring the unified KV cache flag. This caused hellaswag, winogrande,
and multiple-choice evaluations to fail on hybrid models (models with
both attention and recurrent/SSM layers, such as Qwen3.5-35B-A3B) with:

  split_equal: sequential split is not supported when there are
  coupled sequences in the input batch (you may need to use the
  -kvu flag)

PR #19954 fixed this for `llama-kv-cache-iswa.cpp` by automatically
enabling unified KV mode and setting n_parallel >= 4 for multi-choice
eval tasks. However, the hybrid memory paths were not updated.

This commit mirrors the iswa fix: use non-sequential split when KV
cache is unified (n_stream == 1), which is automatically set by
llama-perplexity for hellaswag/winogrande/multiple-choice since #19954.

Tested on Qwen3.5-35B-A3B (hybrid attention+SSM MoE model):
- HellaSwag: 83.0% (400 tasks)
- Winogrande: 74.5% (400 tasks)
- MMLU: 41.2%
- ARC-Challenge: 56.2%
- TruthfulQA: 37.7%
All previously failed with llama_decode() error.
src/llama-memory-hybrid-iswa.cpp
src/llama-memory-hybrid.cpp