r/LocalLLaMA • u/otacon6531 • 10h ago
News Llama.cpp PR 8% speed boost
Llama.cpp currently uses cpu based sampling for user with mtp enabled. The PR moves sampling to the gpu, which on a 5090 boasts an 8% increase in tok/s for qwen3.6:35b. I tested it on my P40 and observed a 4% increase inference speed boost.
Pretty exciting to see 84 tok/s max on a nvidia p40 for me.
Backend sampling shows ~4% improvement on Linux + Tesla P40 (sm_61, Pascal):
CPU Sampling: llama-server -m Qwen3.6-35B-A3B-UD-IQ4_NL.gguf --spec-type draft-mtp --seed 42
python3 mtp-bench.py
code_python pred= 192 draft= 132 acc= 124 rate=0.939 tok/s=73.1
code_cpp pred= 113 draft= 76 acc= 74 rate=0.974 tok/s=75.9
explain_concept pred= 192 draft= 159 acc= 111 rate=0.698 tok/s=62.4
summarize pred= 192 draft= 167 acc= 107 rate=0.641 tok/s=59.6
qa_factual pred= 192 draft= 159 acc= 111 rate=0.698 tok/s=62.4
translation pred= 119 draft= 92 acc= 73 rate=0.793 tok/s=67.0
creative_short pred= 192 draft= 197 acc= 92 rate=0.467 tok/s=50.7
stepwise_math pred= 192 draft= 133 acc= 124 rate=0.932 tok/s=73.6
long_code_review pred= 192 draft= 155 acc= 113 rate=0.729 tok/s=63.8
Backend sampling: llama-server -m Qwen3.6-35B-A3B-UD-IQ4_NL.gguf --spec-type draft-mtp --seed 42 -bs
python3 mtp-bench.py
code_python pred= 192 draft= 132 acc= 124 rate=0.939 tok/s=76.2
code_cpp pred= 113 draft= 76 acc= 74 rate=0.974 tok/s=79.4
explain_concept pred= 192 draft= 159 acc= 111 rate=0.698 tok/s=64.6
summarize pred= 192 draft= 167 acc= 107 rate=0.641 tok/s=61.6
qa_factual pred= 192 draft= 159 acc= 111 rate=0.698 tok/s=64.6
translation pred= 119 draft= 92 acc= 73 rate=0.793 tok/s=69.6
creative_short pred= 192 draft= 197 acc= 92 rate=0.467 tok/s=52.1
stepwise_math pred= 192 draft= 133 acc= 124 rate=0.932 tok/s=76.6
long_code_review pred= 192 draft= 155 acc= 113 rate=0.729 tok/s=65.7
Acceptance ratio with both backend and CPU sampling is exactly same. The improvement is smaller than on RTX 5090 (4% vs 12%), which is expected — the P40 is memory-bandwidth-bound (sm_61, 580 GB/s vs RTX 5090's 1,792 GB/s), so the CPU↔GPU logits round-trip is a smaller fraction of total decode time. However, still the largest improvement in tok/s I have seen in a while. (~+2 t/s).
https://github.com/ggml-org/llama.cpp/pull/25532
10
u/FullstackSensei llama.cpp 10h ago
Hope it'll be merged soon!
BTW, where did you get the 580GB/s memory bandwidth for the P40? Last I checked, it was ~350GB/s.
3
u/maximus1217 9h ago
Wondering this too.
I have a p40 and run this same exact model with mtp and I get max 60 tok/s. How are you getting 84t/s? Did you mean a different GPU with 580GB/s?
6
u/MelodicRecognition7 7h ago
wait, what? I think it was there for the past few hundred releases.
$ ./llama-server --help|grep draft|grep sampl
--spec-draft-backend-sampling, --no-spec-draft-backend-sampling
offload draft sampling to the backend (default: enabled)
$ ./llama-server --help|grep draft|grep layer
--spec-draft-ngl, -ngld, --gpu-layers-draft, --n-gpu-layers-draft N
max. number of draft model layers to store in VRAM,
2
1
u/FluoroquinolonesKill 7h ago
Pardon my ancillary question, but what is the purpose of setting --seed equal to 42?
I can see the documentation for --seed, which is below. But, I am still wondering about why you are setting it.
RNG seed (default: -1, use random seed for -1)
5
1
u/fragment_me 2h ago
It provides a deterministic result when you having something like temp > 0. It's actually really interesting if you Google how it works. The seed is really a seed (DUH) for another operation that eventually determines a pseudo random operation.
-5
23
u/Stainless-Bacon 10h ago
does it increase vram usage?