
llama.cpp v0.7.0 に MoE キャッシュが追加された - Strata 旋風の中では地味かもしれないがうれしい機能
まとめ
llama.cpp に MoE キャッシュ(--moe-cache-mib)が追加された。
gemma-4-26B-A4B-it-qat に関しては、テキスト生成が 263 t/s 。MoE キャッシュ無しだと、130 t/s 。
Gemma は約 2 倍、Qwen は約 1.4 倍程度の速度アップ。
--moe-cache-mib とは?
CPU に置いた MoE の expert のうち、直近に使われた expert を GPU にキャッシュし、キャッシュがいっぱいになったら一番長く使われていないものから入れ替える機能。値はキャッシュに使う VRAM の量(MiB)。
Gemma と Qwen でやってみる
Gn: gemma-4-26B-A4B-it-qat:UD-Q4_K_XL
Qn: Qwen3.6-35B-A3B-MTP:UD-Q4_K_XL
MoE Cache: --moe-cache-mib
GPU: 1 - RTX5070Ti
GPU: 2 - RTX5070Ti + RTX5070
検証コマンド
G1
CUDA_VISIBLE_DEVICES=0 \
llama serve -hf unsloth/gemma-4-26B-A4B-it-qat-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 262144 --n-cpu-moe 99 --threads 6 --threads-batch 12 \
--moe-cache-mib 6656G2
CUDA_VISIBLE_DEVICES=0 \
llama serve -hf unsloth/gemma-4-26B-A4B-it-qat-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 131072 --n-cpu-moe 99 --threads 6 --threads-batch 12 \
--moe-cache-mib 9216G3
CUDA_VISIBLE_DEVICES=0 \
llama serve -hf unsloth/gemma-4-26B-A4B-it-qat-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 262144 --n-cpu-moe 14 --threads 6 --threads-batch 12G4
CUDA_VISIBLE_DEVICES=0 \
llama serve -hf unsloth/gemma-4-26B-A4B-it-qat-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 131072 --n-cpu-moe 8 --threads 6 --threads-batch 12G5
llama serve -hf unsloth/gemma-4-26B-A4B-it-qat-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 262144 -ngl 99 --threads 6 --threads-batch 12 \
-ts 10,7G6
llama serve -hf unsloth/gemma-4-26B-A4B-it-qat-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 262144 -ngl 99 \
-sm tensor -ts 5,3 --no-spec-draft-backend-samplingQ1
CUDA_VISIBLE_DEVICES=0 \
llama serve -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 262144 --n-cpu-moe 99 --threads 6 --threads-batch 12 \
--moe-cache-mib 7168Q2
CUDA_VISIBLE_DEVICES=0 \
llama serve -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 131072 --n-cpu-moe 99 --threads 6 --threads-batch 12 \
--moe-cache-mib 9216Q3
CUDA_VISIBLE_DEVICES=0 \
llama serve -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 262144 --n-cpu-moe 26 --threads 6 --threads-batch 12Q4
CUDA_VISIBLE_DEVICES=0 \
llama serve -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 131072 --n-cpu-moe 22 --threads 6 --threads-batch 12Q5
llama serve -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 114688 -ngl 99 --threads 6 --threads-batch 12 \
-ts 16,12Q6
llama serve -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \
--spec-type draft-mtp --spec-draft-n-max 3 -np 1 -fa on -ctv q8_0 -ctk q8_0 \
-c 16384 -ngl 99 \
-sm tensor --no-spec-draft-backend-samplingリクエスト(10 構成で共通)
curl -s http://127.0.0.1:9931/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"messages":[{"role":"user","content":"Flappy Bird のクローンを index.html のみで作成して。localstorage は使用しない。"}],"stream":false}'