From aedb01074f2f240d5bbe030e28f08909dbb96427 Mon Sep 17 00:00:00 2001 From: hrx-compat lane Date: Sat, 14 Nov 2026 16:22:37 -0400 Subject: [PATCH] tests: give the blackmamba synthetic fixture the expert hparams its MoE branch needs (engine #2444) test-llama-archs aborted on blackmamba at llama-model-loader.cpp:1345 GGML_ASSERT(t_meta.ne[dim] >= 1). blackmamba takes its Switch-MoE branch whenever n_ff(i) != 0 (models/blackmamba.cpp:58) and sizes ffn_* from hparams.n_ff_exp(), but the fixture builder has 67 arch-specific hparam blocks and none for LLM_ARCH_BLACKMAMBA, so the generic non-zero n_ff took the MoE branch with no expert width and n_ff_exp stayed 0. Fix is in the fixture, not the loader: the mandatory key is correct for a model whose layers take the MoE branch, and making it optional only moved the failure to the shape assert (tried, measured, reverted). Measured: test-llama-archs -a '^blackmamba$' -o -> exit 0, fixture written (blackmamba-dense.gguf, 4.65 MB). Before: abort at the loader assert. --- tests/test-llama-archs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test-llama-archs.cpp b/tests/test-llama-archs.cpp index 141563f81fe3..084698867375 100644 --- a/tests/test-llama-archs.cpp +++ b/tests/test-llama-archs.cpp @@ -366,6 +366,15 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe) { arch == LLM_ARCH_KOLIBRI1) { n_head_kv = 2; // GQA coverage } + if (arch == LLM_ARCH_BLACKMAMBA) { + // engine#2444: blackmamba takes its Switch-MoE branch whenever n_ff(i) != 0 (blackmamba.cpp:58), and that branch + // sizes ffn_gate_inp/ffn_* from n_ff_exp -- so a fixture written with the generic non-zero n_ff and no expert + // width aborts in the loader (t_meta.ne[dim] >= 1). The generic hparams are not enough for this arch. + ms.add_kv(LLM_KV_EXPERT_COUNT, uint32_t(2)); + ms.add_kv(LLM_KV_EXPERT_USED_COUNT, uint32_t(2)); + ms.add_kv(LLM_KV_EXPERT_FEED_FORWARD_LENGTH, n_ff); + } + if (arch == LLM_ARCH_BEAM) { n_head = 4; n_head_kv = 2;