Repository navigation
BailingMoE3 Support - #26608
BailingMoE3 Support#26608
Conversation
|
Testing on Strix Halo It freezes on Vulkan (120 Gb VRAM)Infinite launch on ROCm (120 Gb VRAM)You can't opt out of MTPCrash if you try to disable MTP with a hack |
They are not loaded. Other models with baked in mtp behaved the same. "model has unused tensor" is proof its not loaded. Looks like a very good model for its sparsity. |
|
/bot review |
Automated code reviewI've completed a static review of PR #26608 (BailingMoE3 / Ling 3.0 flash support). The change adds a new hybrid arch (KDA recurrent + MLA attention + MoE + MTP) by adapting the established Kimi-Linear KDA, DeepSeek2/Kimi MLA, and Qwen3-Next MTP patterns. The core graph logic, tensor layouts, and MLA absorption path look correct, and the registration across Will slow the review (verify before merge)(point 1) Tokenizer pre-type is not added for the new model. (point 2) (point 3) MTP final-norm relies on a borrowed name mapping. (point 4) MTP graph is not exercised by Nits / consistency(point 5) MTP input class choice. (point 6) MXFP4_MOE heuristic fix is bailingmoe3-specific. (point 7) Minor MTP deviation. (point 8) Scope gateThe PR is single-purpose (one new arch), CPU-only inference path (no backend kernels added), addresses the linked issue #26590, and the AI-usage disclosure is filled in. No This review was generated automatically by pi coding agent using |
|
Fails for vulkan on AMD. |
This was a metadata compatibility issue. AtomicChat’s converter assumes the safe-gate form and omits the bailingmoe3.kda.safe_gate field. The loader now defaults it to true when absent. |
|
Retest on Strix Halo BuildLaunch via ROCm (7.2)The Laguna-S-2.1 / Qwen3.5-122B-A10B take about 3 minutes to start. UPD: Was able to launch it by adding the Launch via ROCm (7.2)UPD2: I don't know why TOP_K hardware acceleration isn't supported, but I moved it to the CPU using the Launch via ROCm (7.2)UPD3: There is also a problem with the model itself, it contains assembly errors. Caution This can lead to a loop, and increased consumption of the context window, but the UPD4: I checked the Ling-3.0-flash-MXFP4_MOE.gguf model in the agent coding, and it is completely broken; the agent cannot read or modify the file (in an empty context). Read file |
|
Tool calling with multiple arguments is broken on bailingmoe3 (Ling-3.0-flash). Single-argument calls parse correctly; 2+ argument calls have the first argument's value swallow the rest of the call as a literal string. Reproduced identically across four independent combinations:
Example request/response: -lv 5 differential-analysis dump (verbatim): Separately, but related: the stock embedded chat template does not stop generation at </tool_call> — the model emits a stray <|DSML|end|DSML|> token afterward, which the server doesn't recognize as end-of-generation, so it keeps emitting duplicate tool_calls until max_tokens is hit. Tried and ruled out via manual chat-template edits (multiple permutations of \n placement around <arg_key>/<arg_value>, including matching models/templates/GLM-4.6.jinja's exact layout): none produce correct multi-argument parsing; some regress to empty {} arguments instead. Possibly the same root cause as #24807 (Qwen3.6-35B-A3B, same TAG_WITH_TAGGED tag-based argument format with tags instead of <arg_key>/<arg_value>, same class of Until()-over-capture bug). Happy to provide full -lv 5 logs, curl repro commands, or test against a patch. |
|
The released Ling 3.0 configuration contains trained per-layer SwiGLU limits that were previously omitted. Commit c51308d adds the routed-expert and shared-expert clamp arrays during conversion and loads them as optional GGUF metadata. The existing graph implementation applies the clamps. |
|
Commit 0266ebc fixes the Bailing V3 argument delimiter inference and adds a regression test for multi-argument tool calls. The parser now uses </arg_value> as the value terminator and tolerates whitespace before </tool_call>. All 522 auto-parser assertions pass. |
|
Retried on my amd vulkan setup. For some reason it is trying to use ROCm? |
Could you provide the complete CMake configuration, launch command, and --list-devices output? Also, can you please retry with a fresh Vulkan-only build directory: Then explicitly use -dev Vulkan0 -fa on, initially with -c 65536 -b 512 -ub 256. If that works, increase the context afterward. If ROCm0 is still selected with -dev Vulkan0, it may indicate a device-routing problem. |
|
anecdotal usage report: after a few turns and some context (~20k) the inference just hangs even though the GPU is still being utilized. Not sure how to provide useful information for this. |
This comment has been minimized.
This comment has been minimized.
|
i made some fixs and also after 160k token i am getting "/n" this word in the claude code and claude code doest recognizing it |
…pport Weights are out under MIT, so the "still not released" verdict this file carried is retired and the section moves to the top of the priority order. Target slot is deep, not fast: 5.1B active is the same count gpt-oss-120b carries. From config.json - 124B/5.1B, 42 layers as 35 Kimi Delta Attention plus 7 gated MLA in a 5:1 stack, 512 routed experts top-8 plus 1 shared, moe_intermediate_size 768, native 262144 with rope_scaling null, and num_nextn_predict_layers 1 bundled in every GGUF. IQ3_XXS (51.2 GB, 47.7 GiB, 3.30 bpw) is the tier that fits, and it is smaller than deep is today at 59.0 GiB. Q3_K_M fits with about 10 GiB of margin, MXFP4_MOE and everything from Q4_K_S up do not. Predicted 16-20 t/s base by two methods that agree: decomposing active params gives 1.89B routed experts, 2.79B non-expert of which KDA projections alone are 1.93B, and 0.40B token_embd, summing to 5.08B against the published 5.1B; at IQ3_XXS with non-expert protected that is 3.0-3.7 GB/token, and 16-20 t/s at the 60.5 GB/s hybrid correction. The tg_ceiling formula at the top of this file independently gives 15.9. That is a wash with deep's measured 19.6. Three reasons to track it. Only 7 of 42 layers hold a KV cache and those 7 are MLA, so the full 262144 context costs about 1.1 GB - the MiniMax-M2.1 depth collapse is structurally impossible here. The pin-tensor-types lever applies harder than it did to Laguna, since publishers keep the 1.93B of KDA projections at high precision and retargeting them to IQ4_XS predicts +38%. And GPQA-D 85.0 with SWE-bench Pro 56.6 is the harder discriminator the deep bar demands, since another 10/10 on reason-eval-hard cannot rank a replacement. Four blockers. bailingmoe3 is in no shipping llama.cpp - not this tree, and a code search of ggml-org/llama.cpp returns zero hits; support is PR ggml-org#26608, open as of 2026-08-09, 850 additions over 17 files awaiting 2 of 3 code-owner approvals. AtomicChat's model card claims it is already upstream, which is false. Multi-argument tool calls are broken in that PR, the first argument swallowing the rest as a literal string, which disqualifies it here on its own. Vulkan freezes are reported and MTP cannot be disabled without crashing, on a box that has already paid two hard power cycles - though the hard op is not missing, this tree already ships gated_delta_net_f32_d128_kda. And 3.30 bpw across 512 experts of 5.9M params each is the hardest quant case there is. One open question the config cannot settle: mtp_loss_scaling_factor is 0. If the head carried no loss term the speculation upside evaporates, so acceptance is the first thing to measure - the record is split between KAT's grafted donor head at 0.76 and GLM-4.7-Flash's declared-but-missing nextn tensors. Nothing measured on this box. Do not download until the PR merges and the tool calling bug closes. Assisted-by: Claude Opus 5
And did you convert it, or download it from somewhere? |
https://huggingface.co/AtomicChat/Ling-3.0-flash-GGUF/blob/main/IQ4_XS_STOCK/Ling-3.0-flash-IQ4_XS_STOCK-00001-of-00002.gguf |
hmm it seems to have updated, i just checked hashes and it mismatches from the latest one, redownloading |
TBH, it clearly says this is meant for some fork, not official llama.cpp so I wouldn't bother. It might just be differently named tensors, if so supporting alternate names can be acceptable (follow-up though, not in this PR), but chances are there would be other issues. |
|
For anyone looking to test this arch, reference GGUFs built with this branch's converter are available here:
Conversion notes and per-quant validation are on the model cards. |
|
Test report: Strix Halo (gfx1151 / Radeon 8060S, 128 GB unified) — Vulkan/RADV on Linux Following the earlier freeze/hang reports on this hardware, I ran a structured stability test of this branch ( TL;DR: the base arch looks fully stable and fast on RADV. The "inference hangs after a few turns" issue reproduces deterministically here and is specific to the MTP speculative path — the main thread blocks forever in MTP off — all clean
MTP on (
|
|
Test report: CUDA, GTX 1080ti on debian Things seem to work well with the tiny model at Q8_0 quant. The only quirk I have caught so far is that in one chat it did not close the thinking tab when it gave the final response. I am not sure if this is a chat template thing, or just a hiccup. |
Assisted-by: Claude Code (GLM 5.3)
117745a to
3ba9516
Compare
Metal (Apple Silicon) validation — runs clean, no fence-hang, but net-slower for this MoETried this PR (commit Setup — Results:
Net: on Metal the |
|
Lint fix pushed (04f9d09) and approvals were reset by the new commit. Ready for re-review. |
* Adding support for bailingmoe3
* Adds speculative decoding support
* Make BailingMoE3 safe gate metadata optional
* bailingmoe3: apply trained SwiGLU clamps
* common: fix Bailing V3 tool argument parsing
* llama-model-saver, instantiate float vector metadata writer
* bailingmoe3: support Q-LoRA (Ling-3.0-tiny)
Ling-3.0-flash sets q_lora_rank: None and projects Q directly, so the current
implementation loads a single ATTN_Q tensor. Ling-3.0-tiny sets q_lora_rank: 256
and routes Q through a LoRA bottleneck instead:
q_a_proj -> q_a_layernorm -> q_b_proj
Conversion therefore failed with:
ValueError: Can not map tensor 'model.layers.3.attention.q_a_layernorm.weight'
Add the missing path, mirroring the existing deepseek2 MLA implementation:
* constants.py - add ATTN_Q_A / ATTN_Q_B / ATTN_Q_A_NORM to BAILINGMOE3
* tensor_mapping.py - map model.layers.{bid}.attention.q_{a,b}_proj and
q_a_layernorm
* conversion - emit attention.q_lora_rank when the config has it
* bailingmoe3.cpp - read n_lora_q; create the Q-LoRA tensors and build Q
through the bottleneck when q_lora_rank > 0
Everything is gated on q_lora_rank > 0. Ling-3.0-flash's config has no
q_lora_rank, the converter only emits the key when present, hparams.n_lora_q
defaults to 0, and get_key(..., required=false) leaves the target untouched when
the key is absent - so flash keeps taking the existing direct-Q branch.
The LoRA path produces the same shape as the direct projection, so the
nope/rope split, RoPE application and wk_b absorption downstream are unchanged.
* small mtp change
* bailingmoe3: support separate MTP GGUF and Q-LoRA MTP
* gguf: remove duplicate add_kda_gate_lower_bound definition
---------
Co-authored-by: bloomer <[email protected]>
Co-authored-by: Dyluhn <[email protected]>
* Adding support for bailingmoe3
* Adds speculative decoding support
* Make BailingMoE3 safe gate metadata optional
* bailingmoe3: apply trained SwiGLU clamps
* common: fix Bailing V3 tool argument parsing
* llama-model-saver, instantiate float vector metadata writer
* bailingmoe3: support Q-LoRA (Ling-3.0-tiny)
Ling-3.0-flash sets q_lora_rank: None and projects Q directly, so the current
implementation loads a single ATTN_Q tensor. Ling-3.0-tiny sets q_lora_rank: 256
and routes Q through a LoRA bottleneck instead:
q_a_proj -> q_a_layernorm -> q_b_proj
Conversion therefore failed with:
ValueError: Can not map tensor 'model.layers.3.attention.q_a_layernorm.weight'
Add the missing path, mirroring the existing deepseek2 MLA implementation:
* constants.py - add ATTN_Q_A / ATTN_Q_B / ATTN_Q_A_NORM to BAILINGMOE3
* tensor_mapping.py - map model.layers.{bid}.attention.q_{a,b}_proj and
q_a_layernorm
* conversion - emit attention.q_lora_rank when the config has it
* bailingmoe3.cpp - read n_lora_q; create the Q-LoRA tensors and build Q
through the bottleneck when q_lora_rank > 0
Everything is gated on q_lora_rank > 0. Ling-3.0-flash's config has no
q_lora_rank, the converter only emits the key when present, hparams.n_lora_q
defaults to 0, and get_key(..., required=false) leaves the target untouched when
the key is absent - so flash keeps taking the existing direct-Q branch.
The LoRA path produces the same shape as the direct projection, so the
nope/rope split, RoPE application and wk_b absorption downstream are unchanged.
* small mtp change
* bailingmoe3: support separate MTP GGUF and Q-LoRA MTP
* gguf: remove duplicate add_kda_gate_lower_bound definition
---------
Co-authored-by: bloomer <[email protected]>
Co-authored-by: Dyluhn <[email protected]>
* Adding support for bailingmoe3
* Adds speculative decoding support
* Make BailingMoE3 safe gate metadata optional
* bailingmoe3: apply trained SwiGLU clamps
* common: fix Bailing V3 tool argument parsing
* llama-model-saver, instantiate float vector metadata writer
* bailingmoe3: support Q-LoRA (Ling-3.0-tiny)
Ling-3.0-flash sets q_lora_rank: None and projects Q directly, so the current
implementation loads a single ATTN_Q tensor. Ling-3.0-tiny sets q_lora_rank: 256
and routes Q through a LoRA bottleneck instead:
q_a_proj -> q_a_layernorm -> q_b_proj
Conversion therefore failed with:
ValueError: Can not map tensor 'model.layers.3.attention.q_a_layernorm.weight'
Add the missing path, mirroring the existing deepseek2 MLA implementation:
* constants.py - add ATTN_Q_A / ATTN_Q_B / ATTN_Q_A_NORM to BAILINGMOE3
* tensor_mapping.py - map model.layers.{bid}.attention.q_{a,b}_proj and
q_a_layernorm
* conversion - emit attention.q_lora_rank when the config has it
* bailingmoe3.cpp - read n_lora_q; create the Q-LoRA tensors and build Q
through the bottleneck when q_lora_rank > 0
Everything is gated on q_lora_rank > 0. Ling-3.0-flash's config has no
q_lora_rank, the converter only emits the key when present, hparams.n_lora_q
defaults to 0, and get_key(..., required=false) leaves the target untouched when
the key is absent - so flash keeps taking the existing direct-Q branch.
The LoRA path produces the same shape as the direct projection, so the
nope/rope split, RoPE application and wk_b absorption downstream are unchanged.
* small mtp change
* bailingmoe3: support separate MTP GGUF and Q-LoRA MTP
* gguf: remove duplicate add_kda_gate_lower_bound definition
---------
Co-authored-by: bloomer <[email protected]>
Co-authored-by: Dyluhn <[email protected]>
* Adding support for bailingmoe3
* Adds speculative decoding support
* Make BailingMoE3 safe gate metadata optional
* bailingmoe3: apply trained SwiGLU clamps
* common: fix Bailing V3 tool argument parsing
* llama-model-saver, instantiate float vector metadata writer
* bailingmoe3: support Q-LoRA (Ling-3.0-tiny)
Ling-3.0-flash sets q_lora_rank: None and projects Q directly, so the current
implementation loads a single ATTN_Q tensor. Ling-3.0-tiny sets q_lora_rank: 256
and routes Q through a LoRA bottleneck instead:
q_a_proj -> q_a_layernorm -> q_b_proj
Conversion therefore failed with:
ValueError: Can not map tensor 'model.layers.3.attention.q_a_layernorm.weight'
Add the missing path, mirroring the existing deepseek2 MLA implementation:
* constants.py - add ATTN_Q_A / ATTN_Q_B / ATTN_Q_A_NORM to BAILINGMOE3
* tensor_mapping.py - map model.layers.{bid}.attention.q_{a,b}_proj and
q_a_layernorm
* conversion - emit attention.q_lora_rank when the config has it
* bailingmoe3.cpp - read n_lora_q; create the Q-LoRA tensors and build Q
through the bottleneck when q_lora_rank > 0
Everything is gated on q_lora_rank > 0. Ling-3.0-flash's config has no
q_lora_rank, the converter only emits the key when present, hparams.n_lora_q
defaults to 0, and get_key(..., required=false) leaves the target untouched when
the key is absent - so flash keeps taking the existing direct-Q branch.
The LoRA path produces the same shape as the direct projection, so the
nope/rope split, RoPE application and wk_b absorption downstream are unchanged.
* small mtp change
* bailingmoe3: support separate MTP GGUF and Q-LoRA MTP
* gguf: remove duplicate add_kda_gate_lower_bound definition
---------
Co-authored-by: bloomer <[email protected]>
Co-authored-by: Dyluhn <[email protected]>
Upstream llama.cpp (ggml-org#26608) names the full-rank KDA gates ssm_f_a/ssm_g_a and keeps the MTP block as the last layer. Accept both names, skip the MTP block, and ignore nextn_predict_layers in older files that set the key but have no MTP tensors (otherwise the last trunk layer is lost). Assisted-by: Claude
Overview
Adding support for BailingMoE 3,
Additional information
This allows for running the new Ling 3.0 flash model with MTP support. This addresses issue #26590.
Requirements