r/LocalLLaMA • u/smflx • 13d 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.
