glm 5.3 flash now 2-4 times faster on new llama fork. 2x3090 from 12 to 24 t/s

#58
by neuralll - opened

If you have 2-4 GPUs, prepare for a big smile ๐Ÿ™‚ โ€” forked llama.cpp: real multi-GPU speedup for MoE models bigger than VRAM
If you've got 2-4 GPUs sitting mostly idle running a big MoE model, this is for you.
Stock llama.cpp splits big models across GPUs by layer

So only one GPU computes at a time, the rest sit idle. More GPUs = more VRAM, not more speed.

I forked llama.cpp and built a VRAM-filling MoE expert cache instead:

Every GPU caches the experts actually being used, live, updated as you generate,
while the CPU handles cache misses in parallel instead of one-after-another.
Numbers on my box (2x RTX 3090, 128GB DDR4, 3700X), same prompt/temp 0, stock vs fork:
r/machinelearningnews - If you have 2-4 GPUs, prepare for a big smile ๐Ÿ™‚ โ€” forked llama.cpp: real multi-GPU speedup for MoE models bigger than VRAM

image

(Qwen's gain is small honestly โ€” stock's autofit already fit most of it on GPU there, so little room for the cache to help. The big wins are on models where default placement leaves most expert work on the CPU.)

Credit where due:

the expert-cache mechanism builds on u csantiago78's PR #27861
(github.com ggml-org llama.cpp pull 27861) โ€” they had it working first.
I'd independently been chasing the same hot-expert-cache idea and burned real time fighting the scheduler before finding their PR; no point reinventing a wheel that already worked, so I built on top of it

(VRAM-filling auto-sizing, usage-based eviction that only swaps when it pays back, CPU/GPU overlap,
added fused kernels). sdroege independently explored similar prefill-based cache warming in the same PR thread โ€” worth a look too.

GLM-5.3-Flash support is from timkhronos's PRs #27773/ #27917
( github com ggml-org llama.cpp pull 27773).

Repo: github com neurall llama.cpp (Linux CUDA and windows release binary attached,
portable across CPU/GPU variants)

Upped Aditional 10% faster but not necesary
Pre-quantized GLM-5.3-Flash GGUF (10% faster attention weights, experts unchanged):

huggingface co neuralll GLM-5.3-Flash-GSQ-RCO-3.0bit-Q4Kattn-GGUF
If you've got 2+ GPUs and a model too big for one, try it and tell me what breaks โ€” different GPU counts, different models, whatever. Feedback genuinely welcome.

looking for job too

How does this compare to --cache-mod-mib which is now upstream? I've tried that with various settings, and I've never gotten it faster (it's always lost a few t/s each time).

I have about the same HW as you: 2ร—3090 + 128 GB + EPYC 7402 (48 threads, 8-channel DDR4-3200 โ‰ˆ 136 GB/s).

Problem: Stock llama.cpp with GLM-5.3-Flash UD-IQ4_XS only fills 14 GB VRAM total and runs at ~10 t/s. Clearly wrong tensor placement โ€” most experts are stuck on CPU.
Here's what I'm running:

llama-server
-m .../GLM-5.3-Flash-UD-IQ4_XS-00001-of-00005.gguf
--mmproj .../mmproj-F16.gguf
-ngl 99 --n-cpu-moe 0
-c 16384 --jinja
-fa on --temp 1.0 --top-p 0.95
--chat-template-kwargs '{"reasoning_effort":"max"}'
-t 24

My questions:

Could you share your fork's cmdline? Specifically โ€” does --n-cpu-moe even matter with the expert cache, or does it auto-fill both cards?
What -t value do you use? I only have 24 threads set but the EPYC has 48 โ€” is that hurting my CPU-miss penalty?

Also, interesting that your table shows Qwen3.8-Flash-Next at only 29.7/32.1 t/s โ€” with strata mine stays at 129 t/s decode and hits 170 t/s on structured log-files.
Maybe the 3700X vs EPYC bandwidth difference (34 GB/s vs ~136 GB/s) explains it?

Hello Dear Aurel. Thank you for taking the time to testing the fork. Yes it's true that for nearly or fully in ram models strata has decode roughly twice as fast. But working on it. ;)
as wor switches you don't need any. just run the server. most knobs need to turn them self on the fly as needed.even ctx is dynamic now. as for bw yes . usually gains are biggest on 30-30% in vram ie on lowend hw not on high bw hw nearly fitting in ram. mimo was 20x faster pp on 128g x16 x16 hw yet on 256g x16 x16 just 12 times. mine new 3975wx is literally 4 3700x just as chipplets. but its not 4x50 or 40 more like 122-144 so bw plays a role mostly in decode. as prefill is mostly pcie bw bound before compute limits.at leadt for mine 2x 4x16. on fork pls don't use -c its dynamic per req now dont use -ngl either it kills autofit dont use -t it self tunes for prefill and decode. ie I built it to discover and use optimal params on fly as what's good for prefill is often not good for decode and -t and -c are nice examples of that

Sign up or log in to comment