llama : bump LLAMA_MAX_EXPERTS to 1024 for Kimi-K3 (896 experts) - #26192
Closed
GrEarl wants to merge 1 commit into
Closed
llama : bump LLAMA_MAX_EXPERTS to 1024 for Kimi-K3 (896 experts)#26192GrEarl wants to merge 1 commit into
GrEarl wants to merge 1 commit into
Conversation
pwilkin
approved these changes
Jul 27, 2026
|
Hi @GrEarl, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLAMA_MAX_EXPERTShas been 512 since Qwen3 Next. Kimi-K3 has 896 routed experts, so it trips the arch-generic assert inllama_model_base::load_hparamsbefore any arch hook runs:moonshotai/Kimi-K3reportsnum_experts = 896intext_config, andconvert_hf_to_gguf.pyon #26185 emitsgguf: expert count = 896. This cannot be worked around on the file side: understatingexpert_countcontradictsne[2] = 896on theffn_*_expstensors.LLAMA_MAX_EXPERTSsizes exactly one object in the tree:Only
[0, n_expert_used)of it is ever written or read, so raising the bound to 1024 costs 4 KB of stack inbuild_moe_ffnand changes no behaviour for existing models.This unblocks #26185 (
model: add Kimi-K3 text model), which is otherwise complete on the conversion side — I verified itsrepack_mxfp4_blocksis bit-exact against an independent implementation (0 mismatches over 11,010,048 values on a real K3 expert tensor) and that the converter reachesprepare_tensors()with a fully mapped tensor set for all 93 layers. Details in #26185 (comment)Not verified: I have not built or run inference with a Kimi-K3 GGUF, so this change is argued from the assert and the single array it bounds, not from a successful load.
AI usage disclosure: yes. The line references were read from master with an AI agent; the reasoning and the one-line change are as described above.