Skip to content

fix: strip mtp label for GLM-4 architecture to prevent MTP crash (#2451) - #2621

Closed
bong-water-water-bong wants to merge 5 commits into
lemonade-sdk:mainfrom
bong-water-water-bong:split/glm4-mtp-fix
Closed

bong-water-water-bong wants to merge 5 commits into
lemonade-sdk:mainfrom
bong-water-water-bong:split/glm4-mtp-fix

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Contributor

Problem

GLM-4 MoE models (e.g., GLM-4.5-Air-UD-Q4K-XL-GGUF) embed MTP layers in the GGUF, triggering speculative decoding (--spec-type draft-mtp). The GLM-4 MoE graph builder in llama.cpp asserts on missing multimodal metadata when constructing the MTP draft context, crashing on the first prompt.

Fix

After apply_gguf_capability_labels() runs, check if the GGUF architecture starts with "glm4" (case-insensitive). If so, strip the mtp label so the model runs without speculative decoding. The model loads and runs correctly — just without the MTP optimization.

Changes

  • src/cpp/server/backends/llamacpp/llamacpp_server.cpp+14 lines

Fixes #2451

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added engine::llamacpp llama.cpp backend (LlamaCppServer); GPU/CPU LLM inference (Vulkan, ROCm, Metal) bug Something isn't working labels Jul 9, 2026
Adds a new mlx-engine backend wrapping lemon-mlx-engine
(https://github.com/lemonade-sdk/lemon-mlx-engine) as a WrappedServer
subprocess, enabling Apple Silicon MLX inference via Lemonade.

Changes:
- New mlx backend descriptor at src/cpp/include/lemon/backends/mlx/mlx.h
- New MlxServer class (mlx_server.h, mlx_server.cpp) forwarding
  chat/completions + completions APIs, unsupported for responses
- Registered in LEMON_BACKENDS (CMakeLists.txt) for auto-generated
  descriptor registry, factory, install specs, and support matrix
- Backend version pin (b1013-stable for metal/rocm/cpu) in
  backend_versions.json with rocm-stable-runtime field
- Two sample models (Qwen3-0.6B-MLX suggested, Qwen3-4B-MLX opt-in)
  in server_models.json
- get_device_type_from_recipe updated in model_types.h for mlx-engine
- Support matrix entries in mlx.h descriptor: metal (macOS),
  rocm/gfx1150-120X (linux), cpu fallback (linux/macos)
- Test harness capabilities catalog updated for mlx-engine
bong-water-water-bong and others added 3 commits August 9, 2026 15:02
… org

mlx_server.cpp: replace undefined SPEC with mlx::spec(), keep the
anonymous namespace and mlx namespace inside lemon::backends (the early
} // namespace backends put them at lemon:: scope), and include mlx.h
for the descriptor. The mlx backend is in LEMON_BACKENDS unconditionally,
so every Windows build has been broken since the backend was added -
first surfaced by the Validate New llama.cpp Release run.

build-container.yml: push to ghcr.io/${{ github.repository }} instead of
the stale ghcr.io/lemonade-sdk org, which denies the repo's GITHUB_TOKEN
(permission_denied: The requested installation does not exist).
fix: mlx backend fails to compile; publish containers to correct ghcr org
…onade-sdk#2451)

GLM-4 MoE models (e.g. GLM-4.5-Air-UD-Q4K-XL-GGUF) embed MTP layers in the
GGUF, triggering speculative decoding (draft-mtp). But the GLM-4 MoE graph
builder in llama.cpp asserts on missing multimodal metadata when constructing
the MTP draft context, crashing on first prompt.

Fix: after apply_gguf_capability_labels(), strip the mtp label for models whose
GGUF architecture starts with 'glm4' (case-insensitive). These models load and
run correctly without MTP acceleration until upstream fixes glm4-moe.cpp.

Fixes lemonade-sdk#2451.
@bong-water-water-bong

Copy link
Copy Markdown
Contributor Author

Closing: stacked on the closed mlx-engine backend work. The unique commit — strip mtp label for GLM-4 architecture (e9cd20d) — is being re-opened as a clean single-purpose PR off main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working engine::llamacpp llama.cpp backend (LlamaCppServer); GPU/CPU LLM inference (Vulkan, ROCm, Metal)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GLM-4.5-Air-UD-Q4K-XL-GGUF failing on Strix Halo

1 participant