Skip to content

Misc. bug: When KV is in RAM the MTP draft KV cache is also in RAM #28115

Description

@jkSeria

Name and Version

version: 0.3.0-dev (build 10675, commit 90c26fc)
built with MSVC 19.44.35228.0 for Windows AMD64

I've been able to reproduce on a7cc83b

Operating systems

Windows

Which llama.cpp modules do you know to be affected?

llama-server

Command line

llama-server -m Qwen3.8-27B-Q4_K_M.gguf -ngl 99 -c 131072 --no-kv-offload -ctk q8_0 -ctv q8_0 -fa on -ub 512 -b 2048 --spec-type draft-mtp --spec-draft-n-max 8

Problem description & steps to reproduce

When KV is in RAM the MTP draft KV cache is also kept in RAM, and copied to VRAM for every draft step. This causes a lot of redundant transfers causing a significant speed penalty. The MTP draft KV cache should just stay in VRAM instead of continuosly being copied. The same applies to a seperat draft model-s KV cache (--spec-draft-model).

Se also issue #24492

These are the measured differences when testing with Qwen 3.8 27b MTP n=8 with KV offloaded to RAM, before and after the change
(greedy, 200 tokens, fixed prompt. Numbers from the server timings object)

prompt depth master with fix accept len (identical)
65,536 19.2 t/s ~ 399 ms/step 27.2 t/s ~ 281 ms/step 7.69
122,880 13.3 t/s ~ 621 ms/step 21.1 t/s ~ 393 ms/step 8.33

Tested on a system with an RTX 5090 and 5200 MT/s DDR5 RAM. Issue found when trying to optimize throughput for KV offladed (to RAM) with YARN for past native context for the model.

First Bad Commit

No response

Relevant log output

Logs
llama_kv_cache:        CPU KV buffer size = 17408.00 MiB   # target, intended
llama_kv_cache:        CPU KV buffer size =  2048.00 MiB   # MTP draft (the bug)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions