Repository navigation
Description
Name and Version
version: 10857 (f7ca480)
built with GNU 14.2.0 for Linux x86_64
Operating systems
Linux
GGML backends
CUDA
Hardware
GTX 1070 8GB VRAM
Models
Ornith-1.0-35B-MTP-APEX-I-Balanced.gguf from https://huggingface.co/SC117/Ornith-1.0-35B-MTP-APEX-GGUF
This is a model with up to Q6 quant and inbuilt MTP.
Problem description & steps to reproduce
The mentioned Ornith model based on Qwen 3.6 35B A3B works surprisingly well on my ageing machine. With a few patches applied I can get up 600 PP and 20 something TG. Which, in my view, is quite extraordinary.
I'm aiming for 128k context as 64k is just way too low for my purposes. On TurboQuant I could pull 128k with turbo4/turbo2 and things worked reasonably well. My 8GB VRAM would be almost fully used and another 25GB went into RAM + cached. Since I have 48 GB DDR4 RAM, I usually had a comfy 8GB RAM cushion. I have ZRAM enabled on my system, maybe relevant.
Anyhow, switching over to Beellama, I tried using kvarn5/kvarn4 which looked like the sweet spot. With this combo it became apparent with 128k context BL wanted to consume all of my RAM. So I turned on logging to LVL 4, turned off all the extra stuff (mmproj, MTP) and set a small 8192 context.
It became apparent that q5_0/q4_1 allocated about 350 MB for compute while kvarn5/kvarn4 allocated 3,5 GB for the same. Here's my llama-server command:
#!/bin/bash
args=(
-m ~/models/Ornith-1.0-35B-MTP-APEX-I-Balanced.gguf
### GENERAL
--metrics -lv 4 --parallel 1 -t 5 --poll 100
--no-mmap --cors-origins localhost
-fit on --flash-attn on
### CONTEXT
--predict 8192 -c 8192
#~ -ctk q5_0 -ctv q4_1
-ctk kvarn5 -ctv kvarn4
--reasoning off
### CACHING
--cache-ram 2048 -b 2048 -ub 1024
--cache-prompt
### MODEL SETTINGS
--temp 0.85 --top-p 0.95 --top-k 20 --min-p 0.0
--presence-penalty 1.1 --repeat-penalty 1.0
--jinja
)
/media/mkey/data/bin/beellama.cpp/build/bin/llama-server "${args[@]}"And here's my build command:
cmake -B build -DGGML_CUDA=ON -DGGML_NATIVE=ON -DGGML_CUDA_FA=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build -jFirst Bad Commit
IDK
Relevant log output
Logs
#~ -ctk q5_0 -ctv q4_1
0.33.658.673 I common_memory_breakdown_print: | memory breakdown [MiB] | total free self model context compute unaccounted |
0.33.658.676 I common_memory_breakdown_print: | - CUDA0 (GTX 1070) | 8084 = 1113 + ( 6348 = 5890 + 113 + 345) + 622 |
0.33.658.676 I common_memory_breakdown_print: | - Host | 18917 = 18859 + 2 + 56 |
# -ctk kvarn5 -ctv kvarn4
0.45.614.752 I common_memory_breakdown_print: | memory breakdown [MiB] | total free self model context compute unaccounted |
0.45.614.754 I common_memory_breakdown_print: | - CUDA0 (GTX 1070) | 8084 = 1073 + ( 6382 = 2663 + 116 + 3602) + 628 |
0.45.614.755 I common_memory_breakdown_print: | - Host | 22151 = 22086 + 2 + 62 |
Activity
Anbeeld commentedon Jul 28, 2026
Native KVarN wasn't enabled for pre-Turing GPUs. I implemented some fixes for that, please try building the latest v0.4.2 branch and check if it helps.
mkey commentedon Jul 29, 2026
@Anbeeld Thanks for looking into it. It doesn't seem to work out on my end.
[mkey@lmde program]$ /media/mkey/data/bin/beellama.cpp-2/build/bin/llama-server --version version: 10857 (f7ca480ed) built with GNU 14.2.0 for Linux x86_64I tried to start with 128k context with kvarn5/kvarn4 instead of q5_0/q4_1 and got this.
Anbeeld commentedon Aug 2, 2026
You version says
version: 10857 (f7ca480ed)in both cases, so you probably haven't tested the change.Please try v0.4.2 release (or v0.4.3 preview).
mkey commentedon Aug 3, 2026
Silly me. I thought I checked out 0.4.2 but apparently not. Here's 0.4.3. It's not the same issue, but it still crashes.
llama-server --version version: 11003 (6b365df15) built with GNU 14.2.0 for Linux x86_64AddisonJGambhir commentedon Aug 9, 2026
Also affects Vulkan/RADV on AMD, and v0.4.3 trades the memory spike for a large speed regression
Same class of issue on a different backend. On Vulkan + RADV (RX 7900 XTX, gfx1100),
kvarn5/kvarn4andq8_0differ enormously in speed on v0.4.3, and in memory on v0.4.2 — because the two releases pick opposite routes.Environment
v0.4.3(32040e7) andv0.4.2(d71585e), both built locally-c 131072,--flash-attn on,-ub 192,--spec-type draft-mtp --spec-draft-n-max 2,--kv-tail-tokensunset (0)Speed, v0.4.3, same build and session, 16384-char prompt
q8_0kvarn5/kvarn4KVarN is 47% slower on encode, 42% on decode. GTT peak is identical and ~5 GiB of VRAM is free during the run (polled every 0.4s via amdgpu fdinfo), so this is not spill or memory pressure.
Route evidence —
GGML_KVARN_DEBUG_ROUTES=1, counted per server start:route=portable-native entry=compact-tail, 0 materialize — including large prefill batches (nq=192 nkv=2048 gqa=6)route=materialize fallback=explicit-materializationCause appears to be
0c5034c1b, which changedggml_backend_vk_kvarn_native_rotated_max_query_tokensinggml/src/ggml-vulkan/ggml-vulkan.cpp:With the intrinsic 128-token exact suffix, every KVarN Vulkan layer is permanently in the mixed compressed-body + exact-tail class. Under 16u that vetoed to materialize + tiled FA; under UINT32_MAX every prefill batch goes to
kvarn_flash_attn.comp, which is a single unspecialized shader withlocal_size_x = 128, one query row per workgroup, and no cooperative-matrix path — against q8_0's coopmat FA.This also seems to contradict
docs/beellama-features.md:131:The v0.4.2 side is the memory half, and matches this issue. With the 16u/materialize route on the same card:
So on Vulkan/AMD the two releases sit at opposite ends of the same tradeoff: v0.4.2 materializes and blows up memory (this issue), v0.4.3 stays native and loses ~45% throughput. v0.4.2 KVarN encode was 331.0 tps, still well below q8_0.
Question: should Vulkan report a bounded cap on backends without a specialized KVarN decode kernel, rather than
UINT32_MAX? CUDA reportsrotated_query_max_specializedbecause it hasspecialized_decode_split/specialized_decode_vectorbehind it; Vulkan has one portable shader. Notedocs/records/kvarn-tail-fit-remediation-completion-20260809.mdstates the Vulkan route work for that commit was validated on an RTX 3090 and explicitly not on an AMD runtime.Happy to run patches or collect more data on RADV/gfx1100.
Anbeeld commentedon Aug 9, 2026
What a load-bearing report. I'll check what can be done.
AddisonJGambhir commentedon Aug 9, 2026
@Anbeeld Sorry it was Claude-generated, but I proof read it an the description is accurate. If there's anything I can do, in terms of proving more data or forking the branch and fixing it locally, I would be glad to do that as well.
skewty commentedon Aug 12, 2026
I just cloned repo (so current master) and compiled with:
ran with:
usage is 30.08 GB
when I was running upstream llama.cpp with:
usage is 29.058 GB
388608 ctx with parallel 3 (multiple MTP) vs. 65536 with parallel 1 to avoid
"ggml_vulkan: Failed to allocate pinned memory (Requested buffer size exceeds device buffer size limit: ErrorOutOfDeviceMemory)" error.
beellama.cpp (llama-server --version) after compile gives:
version: 11001 (5a35792)
built with GNU 16.1.1 for Linux x86_64
Something seems very wrong with the memory allocation.
Anbeeld commentedon Aug 12, 2026
@skewty try v0.4.3 branch.
skewty commentedon Aug 12, 2026
re-built
version: 11192 (ee8754c)
That did it! Wow.
388608 ctx -> 29.058 GB (using Q8_0 keys and Q5_0 values)
493312 ctx -> 29.218 GB (using kvarn5 keys and values)
Haven't tested performance yet but that is huge! 😻
edit: adding speed comparison
with q8/q5 k/v cache and upstream llama.cpp
PP 897 t/s -> 808 t/s with generation at around 56 t/s
with kvarn5 k/v cache and beellama.cpp (0.4.3 branch)
PP 420 t/s -> 155 t/s with generation at around 13 t/s
mkey commentedon Aug 12, 2026
I can report that I have installed a second GPU (3060 12GB) and on it kvarn seems to work OK, even if I'm seeing a mild performance hit. Currently I'm trying to make the most out of my setup where I will use 3060 as the main GPU, then offload to 1070 and finally to RAM. 1070 allows for a very reasonable performance boost, it may be old, but still faster VRAM than RAM.
I did run llama.cpp for comparison and over there I'm seeing very questionable performance degradation, on my otherwise very conservative hardware. For example, with beellama I get about 900 PP on Qwen 35B 3AB APEX vs miserably 50 PP on llama.cpp.
How could I further troubleshoot performance? I have a feeling I'm leaving a lot of performance on the table.
Anbeeld commentedon Sep 6, 2026
Performance and stability should be much better with the newly released v0.4.5