HOTEXP splits the MoE experts of Qwen3-30B-A3B by measured usage frequency: the experts your workload actually routes to ("hot") live on the GPU, the rest ("cold") stay on the CPU — inside a single GGUF, with a patched llama.cpp that runs both branches in one graph.
Stock llama.cpp can only move experts to the CPU in whole layers
(--n-cpu-moe N: the first N layers go to the CPU entirely). HOTEXP instead
chooses per layer, per expert: with a 3 GiB hot budget it covers 82% of
all expert selections on the GPU while the model still fits a small card.
These GGUFs contain extra tensors (hot expert slices + routing tables) that stock llama.cpp cannot load. Apply the patches below first (they also include the author's earlier MTP/nextn support for this architecture, which the HOTEXP patch builds on):
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
git checkout 1ab7e5ad2d4e7295c94c3b966a3e0b70fa365865
git apply 01-mtp.patch
git apply 02-hotexp.patch
cmake -B build -DGGML_CUDA=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build -j --target llama-server llama-cli
| file | size | SHA-256 |
|---|---|---|
Qwen3-30B-A3B-Instruct-2507-IQ3_XXS-HOTEXP.gguf |
13,632,706,848 B | da1b25362e440cda949a5bc305a5e199af42f06fedf1a0bedde055a4792f606a |
Qwen3-30B-A3B-Instruct-2507-IQ3_XXS-HOTEXP-4G.gguf |
13,632,706,848 B | af2b587986c672af204918e9a8fc03168d5419d6c08b71be7c01105e302ece99 |
01-mtp.patch / 02-hotexp.patch |
llama.cpp patches (apply in order) | |
expert_hist.py |
measures the expert-usage histogram | |
split_hot_experts.py |
builds a split GGUF from a histogram allocation | |
coverage.png / speed.png |
the graphs on this page |
The two GGUFs differ only in the hot/cold split:
llama-server -m Qwen3-30B-A3B-Instruct-2507-IQ3_XXS-HOTEXP.gguf \
-ngl 99 -ot 'blk\..*\.ffn_(gate|down|up)_exps\.weight=CPU'
-ngl 99 puts everything on the GPU by default; the -ot override pushes
only the cold expert tensors back to the CPU (hot tensors are named
..._exps_hot.weight and do not match the pattern).
blk.N.ffn_*_exps_hot.weight, cold slices keep the stock names, and three
small tables (ffn_hot_local, ffn_cold_local, ffn_hot_mask, plus
ffn_cold_mask) map global expert ids to branch-local ids.mul_mat_id with branch-local ids and
branch weights (hot weight = weight × mask, cold = the remainder), and the
outputs are summed. On the CPU branch a new ggml op,
GGML_OP_MUL_MAT_ID_MASKED, skips zero-weight (foreign) pairs instead of
computing them.Same-session pairs, greedy decoding, 256 tokens, IQ3_XXS, prompt = a fixed
Japanese AI-history text. Laptop base is its best n-cpu-moe setting (40).
The laptop was measured twice: under WSL2 and natively on Windows (its
native OS, MSVC + CUDA 13.3 build of the same patches). The graph shows the
native-Windows numbers.
| device | base decode | HOTEXP decode | base prefill | HOTEXP prefill |
|---|---|---|---|---|
| Tesla V100 32GB (desktop) | 22.26 tok/s | 33.41 tok/s (1.50×) | 21.9 tok/s | 76.1 tok/s (3.47×) |
| GTX 1060 6GB (desktop) | 23.76 tok/s | 20.61 tok/s (0.87×) | 58.3 tok/s | 72.6 tok/s (1.25×) |
| RTX 3050 Laptop 4GB (WSL2) | 10.08 tok/s | 9.78 tok/s (0.97×) | 32.7 tok/s | 13.7 tok/s (0.42×) |
| RTX 3050 Laptop 4GB (Windows native) | 8.48 tok/s | 13.29 tok/s (1.57×) | 9.37 tok/s † | 32.26 tok/s † |
† The native-Windows base prefill (9.37) is anomalously low next to the same machine's WSL2 base prefill (32.7), so the prefill ratio on that row is unreliable. The decode win (1.57×) is the solid result on that row.
Honest caveats:
mul_mat_id path eat it). On the 4 GB laptop
under WSL2, decode tied and prefill was slower — but natively on Windows,
the platform this project targets, the same laptop gave HOTEXP a clear
decode win (1.57×) and prefill recovered to base level. The OS/runtime
layer matters as much as the hardware; HOTEXP is still not a free lunch on
entry-level cards.The MTP (multi-token prediction) head backport for the same base model: kabe0515/Qwen3-30B-A3B-Instruct-2507-MTP-GGUF
By kabedayo. Base model © the Qwen team (Apache-2.0). llama.cpp © its contributors (MIT).