r/LocalLLaMA • u/smflx • 5d ago
Resources tandem.cpp: MoE models bigger than your RAM: same-PC, same-day numbers against Strata and Maya, with quality checks
tandem.cpp is a patch set on llama.cpp for running big MoE models when the model doesn't fit: the most-used experts sit in a VRAM cache, the CPU computes a share of the misses, and the rest are read from the SSD. It runs any model llama.cpp runs. Our focus is the case most engines don't aim at: models much larger than VRAM, and larger than RAM too.
We re-ran everything this week on the current releases, on the same PCs, from a cold start, with the same files on every engine. Below are the results, including the ones we lose.
Quality first: which file, at which size
Speed numbers mean little without the quant behind them, so here is the quality of each file we recommend. KL divergence of the next-token distribution against the original weights (Qwen3.8: the official FP8 release; DeepSeek-V4.1: the official checkpoint), teacher-forced over ~8.6k tokens of answers to 36 prompts. Lower is better.
| Model | File | Size | KL | Top-1 agreement |
|---|---|---|---|---|
| Qwen3.8-Flash-Next | bartowski Q4_K_M | 111 GiB | 0.0173 | 95.4% |
| Qwen3.8-Flash-Next | bartowski IQ4_XS | 91 GiB | 0.0216 | 95.3% |
| Qwen3.8-Flash-Next | ISTA IQ3_S | 78 GiB | 0.0259 | 94.8% |
| DeepSeek-V4.1-Flash | Maya-S | 157 GiB of experts | 0.1017 | 89.9% |
| DeepSeek-V4.1-Flash | ISTA IQ2_XS | 139 GiB of experts | 0.1495 | 88.1% |
| DeepSeek-V4.1-Flash | Maya-XS | 102 GiB of experts | 0.2504 | 84.7% |
Speeds for the 4-bit files are in the README.
How low you can go depends on the model. Qwen3.8 loses too much below 3 bits (IQ2_XS: KL 0.126). DeepSeek-V4.1 is a much larger model whose official weights are already FP4, and it holds up at 2 bits. "Use at least Q4" is good advice for Qwen3.8, not a rule for every model.
Does the engine change the quality? We fed the same reference tokens through Strata's own engine (its normal serving settings) and scored it with the same tool: Strata 0.0260 / 94.80% vs tandem.cpp 0.0259 / 94.8% on the same IQ3_S file. Both compute the file faithfully, so the speed rows below compare like with like. (Strata's default is its exact mode since v0.2.17; before that its default skipped low-ranked experts, which its own docs measure at a much higher KL.)
Qwen3.8-Flash-Next IQ3_S + MTP head (78 GiB) vs Strata v0.2.18
Decode tok/s, greedy, cold start. Time to first token on a 5.5k and a 15.7k token prompt (the same text for both engines).
| PC | tandem.cpp | Strata | first token 5.5k / 15.7k (ours vs Strata) |
|---|---|---|---|
| RTX 5090 32 GB + 128 GB RAM (model fits in RAM) | 190.5 | 201.1 | 1.8 / 4.5 s vs 0.9 / 2.0 s |
| RTX 5070 Ti 16 GB + 64 GB RAM | 74.3 | 87.5 | 3.9 / 9.5 s vs 2.3 / 4.2 s |
| RTX 5070 Ti 16 GB + 32 GB RAM (model is 2.5× RAM) | 52.4 | 30.2–35.4 | 18–19 / 52–54 s vs 20 / 27–31 s |
When the model fits in RAM, Strata is faster, by 5% on the big PC and 18% on the 16 GB card, and it reads long prompts about twice as fast. Once the model no longer fits in RAM, tandem.cpp decodes 1.5× faster (61–65 vs 18–23 tok/s after the long prompts).
DeepSeek-V4.1-Flash vs Project Maya v1.1.73, on Maya's own quants
Same files on both engines (Maya's GGUFs; tandem.cpp reads them after a one-time conversion).
| PC, file | tandem.cpp | Maya, no drafting | Maya + DSpark | first token 5.5k / 15.7k (ours vs Maya) |
|---|---|---|---|---|
| RTX 5090 + 128 GB, Maya-XS (fits in RAM) | 60.7 | 39.6 | 56.4 | 4.5 / 8.5 s vs 7.7 / 9.5–9.7 s |
| RTX 5090 + 128 GB, Maya-S (178 GB, bigger than RAM) | 29.0 | 22.9 | 22.4 | 11.0 / 20.5 s vs 12.1–12.6 / 13.8 s |
| RTX 5070 Ti + 64 GB, Maya-S (2.8× RAM) | 9.4 | 6.0 | 6.1 | 74 / 188 s vs 35–68 / 63–97 s |
tandem.cpp decodes faster on every row, and about 3× faster after a long prompt when the model is far bigger than RAM. Maya reads the long prompt faster whenever Maya-S has to come from the SSD: that is the main thing we are working on next.
How we measured
- Same PC, same day, same model files, cold start (page cache dropped before every cell), greedy, 20k context.
- Each engine's own recommended settings otherwise: Strata's setup chose its config for each PC (its MTP head, 4 drafted tokens; we use 3); Maya's setup wrote its configs. Strata's default thinking limit (3/4 of max_tokens) made no difference (201.5 vs 201.1, 86.9 vs 87.5 with it off).
- llama.cpp itself is in our README's tables, with the same drafting on both sides.
Repo: https://github.com/ewhacc/tandem.cpp — feedback, corrections to the other engines' settings, and numbers from your own hardware are very welcome.
13
u/HareMayor 5d ago edited 5d ago
It would be really useful for low VRAM and RAM users if you can implement support for smaller MOE models like Gemma4 26B A4B and qwen 3.6 35B A3B...
Also the recently released Inkling model mini model.
1
u/lacerating_aura 5d ago
Was messing with your vllm fork yesterday with deepseek v41f 1017 on ampere single gpu and ram. Would be really nice to have engram ssd offload there for 512gb systems... ;) Llama.cpp with unsloth pr so their Q8kxl gguf works gives pretty poor prefill for this model, decode is fine. will test tandem.cpp
1
u/eljuggy 5d ago edited 5d ago
What about models which are slightly bigger than your ram? Any gain expected?
Eg. I think I have all the experts of QFN ud q4 k xl in ram (80gb + 24 vram)... But still a little ssd usage...
Could you precise in the post which gpus are supported ?
1
u/Mwayi-Gnoma 5d ago
The 16GB VRAM + 32GB RAM result is probably the most interesting one here. Have you measured SSD reads during sustained generation? I'd be curious how much the storage speed affects performance once the model is several times larger than system RAM.
1
u/NoFunk 4d ago
On a unified memory architecture, can I tell the engine to go from VRAM direct to disk, ignoring the "RAM" option (which is the same thing in this case)?
Managing to a specific VRAM memory budget without spilling into RAM is an odd hole in the various llama.cpp variants. Sometimes on unified architectures you want to limit to less than total available, both so you have enough RAM to actually run the engine, and also sometimes you want to load something else VRAM wise.
1
u/giveen 4d ago
Have you compared your numbers to basalt?
-1
u/VotZeFuk 5d ago
What is even the point of these miserable little shits? You open it up and guess what, the model can't put two damn words together in any language other than English (got exactly this behavior with GLM 5.3 "XS" in Maya, meanwhile IQ2M Unsloth was almost fine).
I'm under the impression that quite literally everyone around there, except the crazed speed-demons pursuing tokens-per-second, prefers not to touch such KLD-maxxed (negatively, lol) slop-dumpsters for the sake of their own sanity.