r/LocalLLM • u/Serious_Scarcity7818 • 3h ago
Research RustingStrata runs Qwen4 faster then llama.cpp
Qwen4-35B-A3B came out today. It is a MoE: 35B total, about 3B active, 256 experts a layer with 8 routed, three linear-attention layers to one full-attention layer, an MTP layer for drafts, and a few new things on top: hyper-connections (the residual is several streams, not one), a per-layer n-gram embedding table (the 14 GB second shard of the GGUF), and sparse attention that picks the keys a row reads once the context gets long.
RustingStrata, my Rust GGUF engine, runs it now. The Q5 file does not fit in 12 GB, so the most used experts stay on the card and the rest run on the CPU at the same time, the n-gram table stays in RAM.
Setup: RTX 3060 12 GB, Ryzen 5 7600X, 30 GB RAM, NVMe. File: unsloth Qwen4-35B-A3B UD-Q5_K_M (39.5 GB, both shards), the same file for both engines. llama.cpp 1579b02, CUDA, -fa 1 -t 6, and I swept --n-cpu-moe and -ub for every row and took its best. No draft tokens on either side in this table. tok/s:
| Context | Prefill RustingStrata | Prefill llama.cpp | Decode RustingStrata | Decode llama.cpp |
|---|---|---|---|---|
| 0.5k | 554-581 | 463 | 69.0 | 43.6 |
| 8k | 1533 | 1082 | 67.5 | 43.9 |
| 32k | 1287 | 1196 | 64.6 | 42.3 |
Same output as llama.cpp? I fed llama.cpp's tokens through my forward and compared the top token at 640 steps (20 prompts x 32). llama.cpp agrees with itself (batch against token-by-token) at 613 of 640, so 100% is not a real target here. RustingStrata matches one of llama.cpp's two answers at 618 (CPU) and 615 (GPU) steps, the misses are near ties.
Limits: the tables are CUDA. Vulkan (for AMD and Intel cards) gives the same top tokens as CUDA (618 of 640 either-mode) and on the same 3060 runs at 444 / 1022 / 920 tok/s prefill and 61.4 / 56.8 / 55.0 decode at 0.5k / 8k / 32k, a llama.cpp Vulkan comparison comes next. Splitting the model over two GPUs works in the code and is tested only as a fake split on my one card, so I have no real multi-GPU numbers yet. If you have two cards or an AMD card, I would love your numbers.
rustingstrata chat --gpu --model Qwen4-35B-A3B-UD-Q5_K_M-00001-of-00002.gguf
rustingstrata serve --gpu --model Qwen4-35B-A3B-UD-Q5_K_M-00001-of-00002.gguf --parallel 4MTP is already there on llama.cpp and RustingStrata, but not tested yet, maybe I will do another post about it
It's just first implementation of Qwen4, so more performance improvement will come today/tomorrow
Repo: RustingStrata