Granite 4.2 3B: closing the speed gap with llama.cpp Vulkan (prefill and decode)
Summary
Granite 4.2 3B (Q4_1) on the NPU was well behind llama.cpp on Vulkan. The work in #209 closes most of that gap. This issue holds the full numbers and what is still open.
Related: #189 (the Uno drafter, merged in #192).
Where we are (tokens per second)
Prefill, by prompt length:
| 512 | 1024 | 2048 | |
|---|---|---|---|
| NPU, default route | 234 | 257 | 247 |
| NPU, bfp16 route (opt-in) | 744 | 812 | 759 |
| Vulkan Q4_1 | 871 | 824 | 732 |
| Vulkan Q4_0 | 869 | 826 | 786 |
| Vulkan Q4_K_M | 705 | 684 | 650 |
Decode, by context length (speculation off):
| 0 | 512 | 1024 | 2048 | |
|---|---|---|---|---|
| NPU | 23.35 | 22.33 | 21.40 | 19.72 |
| Vulkan Q4_1 | 23.7 | 23.5 | 23.2 | 22.6 |
| Vulkan Q4_0 | 23.5 | 23.0 | 22.8 | 22.2 |
| Vulkan Q4_K_M | 18.7 | 18.5 | 18.3 | 17.9 |
Before this work: prefill 331 / 312 / 240 (bfp16) and 179 / 189 / 148 (default); decode 20.6 / 17.6 / 15.4 / 12.2.
Speculation (off by default, OFLM_SPECULATIVE=1) never runs slower than plain decode: about 1.1-1.2x on normal replies, up to 3x when the reply copies the prompt (a whole-file fix: 43.6 tok/s against 13.9 plain, Vulkan about 23). The output is identical to plain decode. These ratios were taken on the older, slower decode baseline, so the gain will be a little smaller now.
How it was measured: one run at a time on the same box, each in an exclusive dibs run --measure unit with a control run. NPU prefill cells are medians of 3. Vulkan is llama.cpp b10944 on the 890M iGPU. The NPU decode row was re-measured after a firmware fix on the test box; the prefill and Vulkan rows were not, and will be re-measured.
Still open
- Decode at long context is the biggest gap: 19.7 against 22.6 at 2048 tokens (0.87x).
- Prefill default: the bfp16 route is within 15% of Vulkan but stays opt-in until multi-turn is checked through the app. The default route is about 250 tok/s.
- Next prefill steps: one shared hardware context for the matrix multiplies and attention (about +11% at 512 tokens), and residual/norm on the NPU.
- Uno on chat is still slower than plain decode beyond short context (0.82x at 2048); the adaptive policy avoids it.
- A Q4_0 weight layout would speed up models that ship as Q4_0, but not Granite (Q4_1). We keep each GGUF's quant format.
Should this be closed?
Should this be closed?
yes, thank you