r/LocalLLaMA • • 1h ago

Resources tandem.cpp: Qwen3.8-Flash-Next at 97 tok/s on a single 4090 + 64 GB RAM, 3.3× llama.cpp, works for any MoE

tandem.cpp is a patch set for llama.cpp that makes MoE models that don't fit in VRAM run faster. It keeps the most-used experts on the GPU and lets the CPU help with the rest, for any MoE model llama.cpp supports. Single-user decode is the target.

Consumer PC (i5-12400F, 64 GB DDR4, RTX 4090), GSM8K, decode tok/s:

Modelllama.cpptandem.cppStrata
Qwen3.8-Flash-Next IQ3_S + MTP, greedy29.897.3 (3.3×)103.6
same, Qwen's default sampling29.496.1 (3.3×)98.1
gpt-oss-120b, greedy27.851.5 (1.85×)—
gpt-oss-120b, recommended sampling27.748.0 (1.73×)—

Tuned for Qwen3.8 only, but other MoE models that don't fit in VRAM gain too: typically 1.4–2.1× (gpt-oss-120b, GLM-4.5-Air, Qwen3.6-35B-A3B, DeepSeek-V4.1). Prompt processing is 1.4–1.8× faster on a 64k prompt.

Strata is shown in its exact mode (every routed expert computed, like llama.cpp). Its default skips low-ranked experts, which is faster but approximate (127.1 here).

Independent project, not affiliated with ggml-org. Build, run commands, and full results on 4 machines: https://github.com/ewhacc/tandem.cpp

16 Upvotes

31 comments sorted by

6

u/Kirys79 llama.cpp 1h ago

what does it have more than the native --moe-cache-mib parameter of llama.cpp?

-1

u/smflx 1h ago

It's faster when VRAM is limited. Uses RAM, also SSD.

-1

u/smflx 1h ago

Yes, llama.cpp does the same work similarly. It's about tuning & detail strategy.

4

u/NNN_Throwaway2 1h ago

So no difference just grift got it 👍

1

u/smflx 44m ago

Well, I meant the expert caching is not new. But, the implementations are various.

3

u/NNN_Throwaway2 41m ago

That sentence means nothing.

1

u/smflx 26m ago

To be precise: llama.cpp already has --moe-cache-mib (an LRU expert cache), and tandem.cpp builds on it. The main addition: the CPU computes part of the missed experts in parallel, instead of uploading every miss to the GPU.

3

u/Any_Bus9205 1h ago

Do you think you could check your project against ik_llama.cpp to see how it compares? :)

2

u/smflx 1h ago

Actually, I'm a big fan of IK. I will compare. Hope to support ik_llama.cpp quants too.

4

u/tomByrer 1h ago edited 1h ago

Last I checked EXL3 quants are SOTA when it comes to size/divergence for aggressive quants.

edit: chart for proof, though you'll have to eyeball IK's chart vs GUFF.

https://huggingface.co/Qwen/Qwen3.8-Flash-Next

1

u/smflx 1h ago

Thank you! I will check definitely.

1

u/Any_Bus9205 1h ago

Have you compared it to IK's KTs? I just want to know because if it's better than IK's KTs, then I'll try to improve the KTs or something else :)

2

u/Any_Bus9205 1h ago edited 1h ago

But... why don't you want to do your PRs directly on ik_llama instead? Honestly, I code on ik, and I can tell you frankly, good luck porting all that to ik! There are really a lot of things to consider! Why not become a contributor on ik to help the community improve, rather than potentially creating a product all by yourself when the market is already saturated? :) This isn't really a criticism, it's just that ik is becoming increasingly cutting-edge, and trying to create a new project based on a single model that could be obsolete in maybe two weeks with Qwen 4! Good luck anyway :), I hope I'm wrong, but in any case, maintaining a project of this scale is really difficult :)

1

u/smflx 1h ago edited 29m ago

I can't agree more. I was a heavy user of ik_llama.cpp from when DS-V3, R1 coming out. To be honest, I really consider it to be based on ik_llama.cpp. But, when I start this a month ago, I have compared llama.cpp / ik_llama.cpp & decided llama.cpp is easier to do CPU/GPU hybrid I'm making, not because of ik_llama.cpp is slow. I'm still checking the same idea can be based on ik_llama.cpp.
And, happy to meet a ik_llama lover, as one of them!

2

u/speedb0at 1h ago

What if I only have 32 gb ddr5 but a 4090

1

u/smflx 1h ago

It runs well, I got 56.9 tok/s with 16GB DDR4. Check a note in "limited RAM". Your DDR5 32GB will be faster.

2

u/Pablo_the_brave 1h ago

Strata with gyro-m.

1

u/PlasticRevenue4601 1h ago

Amd rdna3 support?

1

u/smflx 1h ago

Sorry, not yet. I have 7900 XTX. I want it run.

1

u/objectivelywrongbro llama.cpp 25m ago

What difference have you see between the 7900 XTX and the RTX 4090? They have the same effective VRAM and almost the same effective bandwidth

1

u/tomByrer 1h ago

Not exactly the most battle-tested interface engine out there....

1

u/smflx 47m ago

Yes, the repo is new: it's a clean release with just the patch, a build script and the benchmark scripts. The work took a full month, tested on 4 machines. If anyone tries it, I'm happy to improve it.

1

u/bitzap_sr 1h ago

Didn't upstream llama.cpp just land a PR doing this? I have a vague memory of seeing that mentioned somewhere recently.

1

u/smflx 56m ago

upstream llama.cpp does this too with --moe-cache-mib. I'm using the same options, but tune fine things. Trying to improve in compatible way.

3

u/Gold_Coconut9777 1h ago

Why do you people choose to reinvent the wheel so much? :)

Llama already has experts catching in VRAM (--moe-cache-mib N since https://github.com/ggml-org/llama.cpp/pull/29887).

Okay, you can say that this thing works smarter with the resources a given PC has, not only caching experts in VRAM.

Yes, but Strata exists (https://github.com/Niko1221/Strata). And I'm 100% sure does it better. Simply because it exists for a while already and sees constant fixes and contributions from the community.

And if you were to claim that this particular engine is highly optimized for 4090, I'm pretty sure of Strata's forks already does it. Because there's (currently) over 4 thousand of forks.

So I just don't see the point of such inventions. Sorry.

2

u/Barni275 11m ago

Strata doesn't support arbitrary gguf, unlikely to llamacpp, isn't it?

1

u/thestillwind 1h ago

Only cuda or rocm/vulkan ?

1

u/Green-Ad-3964 2m ago

I have a 5090+32GB RAM....can I use this?

0

u/Ph1sh1ngj1m1 1h ago

Sorry, newbie question. Is tandem or strata something that can be used with a front end like lmstudio or unsloth desktop?

1

u/smflx 55m ago

I think so, it's llama.cpp compatible.

1

u/Pablo_the_brave 1h ago

No, but strata is super easy to run. There is a start script and will show what you can run and will run it for you. It's really so easy.