Llama.cpp PR 带来 8% 速度提升
摘要
一个 llama.cpp PR 将采样从 CPU 移至 GPU,在 RTX 5090 上为 Qwen3.6-35B 推理带来 8% 的 token 速度提升,在 Tesla P40 上约为 4%。
Llama.cpp 目前对启用 MTP 的用户使用基于 CPU 的采样。该 PR 将采样移至 GPU,在 5090 上为 qwen3.6:35b 带来了 8% 的 tok/s 提升。我在我的 P40 上测试,观察到推理速度提升了 4%。看到我在 nvidia p40 上最高达到 84 tok/s 是非常令人兴奋的。后端采样在 Linux + Tesla P40 (sm_61, Pascal) 上显示出约 4% 的提升:
CPU 采样:
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
后端采样:
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
后端采样和 CPU 采样的接受率完全相同。改进幅度小于 RTX 5090(4% vs 12%),这在意料之中——P40 受内存带宽限制(sm_61,580 GB/s vs RTX 5090 的 1,792 GB/s),因此 CPU↔GPU logits 往返占整个解码时间的比例较小。不过,这仍然是我一段时间以来看到的 tok/s 最大提升。(约 +2 t/s)。
https://github.com/ggml-org/llama.cpp/pull/25532
相似文章
一个 llama.cpp PR 让 Q2_0 在 x86 CPU 上提速 3.0–3.6 倍,8B 解码从 2.39 升至 8.20 tok/s
一个 llama.cpp 拉取请求为 Q2_0 × Q8_0 点积添加了 x86 VNNI 实现,在 Bonsai 模型上实现了 3.0–3.6 倍的纯 CPU 加速,内核级逐位精确,且 token 一致性达 99.2%。
@populartourist: llama.cpp 发布版本 b9235 添加了一些用于提升推理性能的新工具。使用 llama.c 对 RTX 5090 上的 Qwen3.6 27B 进行了基准测试…
llama.cpp 发布版本 b9235 引入了推测性 n-gram 调优,在 RTX 5090 上的 Qwen3.6 27B 上实现了高达约 7 倍的吞吐量提升,其中 k4v96 配置在 10k 和 70k token 测试中表现出最佳的持续性能。
提示:使用这个llama.cpp的PR提升Intel ARC上的提示处理速度
一个llama.cpp的PR显著提升了Intel ARC GPU上的提示处理速度,基准测试显示在B580上从245t/s提升到462t/s。目前该改进仅适用于F16 KV量化,计划后续支持其他量化方式。
比较 llama.cpp 行/张量分割与 ik_llama 图分割的双GPU推理速度
一位用户使用llama.cpp(行/张量切分)和ik_llama(图切分)在两张RTX 3080 20GB上对双GPU推理速度进行了基准测试,使用Qwen3.6-27B GGUF模型,比较了token生成和提示处理速度。
@pupposandro:在 Strix Halo 上比 llama.cpp 快 2.5 倍。我们刚刚为 AMD Ryzen AI MAX+ 395 iGPU(gfx1151,……)发布了 DFlash + PFlash
一套新工具集(DFlash + PFlash)在 AMD Ryzen AI MAX+ 395 iGPU 上实现了比 llama.cpp 快 2.5 倍的推理速度,展示了 Qwen3.6-27B 在 128 GiB 统一内存下的显著加速效果。