Repository navigation
llama-bench: random tokens skew MoE prefill under -ncmoe (-16% to +38%), should llama-bench support real text prompts? #33768
zhouyiyang9508
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Following up on the MoE question in #18722 (comment) ("unless there is evidence that random has problems").
Ran into a gap while benchmarking MoE models with
-ncmoe.llama-benchfeedsstd::rand() % n_vocabintest_prompt:llama.cpp/tools/llama-bench/llama-bench.cpp
Lines 2150 to 2156 in 230c2d5
Comparing
llama-benchagainstllama-server(prompt caching disabled,pp2048, A100-40GB, baseline = real markdown docs):Qwen3-32B(dense): within 0.2%Qwen3-30B-A3B: -8.9% at-ncmoe 12, flips to +7.1% at-ncmoe 48(-15.9% to +3.8% vs code)Qwen3-Next-80B-A3B: -4.4% at-ncmoe 20, flips to +5.7% at-ncmoe 36(-12.6% to -0.9% vs code)gpt-oss-120b: +35.5% (-ncmoe 20) to +38.3% (-ncmoe 30) faster onllama-benchChecked the BF16 router logits on
Qwen3-30B-A3B(512-token microbatches) to see why the sign flips:0..11: random IDs hit 108.4 / 128 experts (vs 87.9 for code)24..47: random IDs drop to 71.1 / 128 (top-10 share 72.6% vs 48.2% for code)Since
-ncmoe Nkeeps MoE experts of layers0..N-1on CPU, shallow offload makes random tokens slower and deeper offload makes them faster.Curious which direction makes the most sense here:
pp4096), so results stay comparable across machines.--prompt-file <path>flag for custom text.llama-benchsynthetic-only and just add a short MoE note intools/llama-bench/README.md.Happy to follow up with a PR depending on what maintainers prefer.
Raw numbers on A100-40GB (8b8de44, Q4_K_M, pp2048, -b 2048 -ub 512, cache_prompt=false, 5 runs)
-ncmoellama-benchllama-benchvs docs (vs code)Qwen3-32B(dense)Qwen3-30B-A3B(128E top-8)Qwen3-30B-A3B(128E top-8)Qwen3-30B-A3B(128E top-8)Qwen3-Next-80B-A3B(512E)Qwen3-Next-80B-A3B(512E)gpt-oss-120b(128E top-4)gpt-oss-120b(128E top-4)At
-ncmoe 24onQwen3-30B-A3B, the same pattern reproduced on L4 (sm_89) and RTX PRO 6000 Blackwell (sm_120).All reactions