Skip to content

Allow Qwen3.8 Flash Next to accept image embds for MTP - #30397

Merged
CISC merged 1 commit into
ggml-org:masterfrom
ORippler:osimons/allow_embds_qwen3.8_mtp
Oct 13, 2026
Merged

CISC merged 1 commit into
ggml-org:masterfrom
ORippler:osimons/allow_embds_qwen3.8_mtp

Conversation

@ORippler

@ORippler ORippler commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

Cont of #30257, closes #30307

Additonal context

Following server + script failed before, no longer fails after:

llama-server -m /mnt/share/gguf/unsloth/Qwen3.8-Flash-Next-GGUF/UD-IQ4_XS/Qwen3.8-Flash-Next-UD-IQ4_XS-00001-of-00003.gguf -md /mnt/share/gguf/ggml-org/Qwen3.8-Flash-Next-GGUF/mtp-Qwen3.8-Flash-Next-Q8_0.gguf --spec-type draft-mtp --port 8080 --mmproj /mnt/share/gguf/unsloth/Qwen3.8-Flash-Next-GGUF/mmproj-BF16.gguf
import base64
import json
import sys
import urllib.request

base = "http://127.0.0.1:8080"
with open(sys.argv[1], "rb") as f:
    image = base64.b64encode(f.read()).decode()

image_content = [
    {"type": "image_url",
     "image_url": {"url": "data:image/png;base64," + image}},
    {"type": "text", "text": "Describe the image."},
]

for label, content in [
    ("image", image_content),
    ("text", "Write a short Python function that adds two numbers."),
    ("image repeat", image_content),
]:
    payload = {
        "model": "qwen-test",
        "messages": [{"role": "user", "content": content}],
        "temperature": 0,
        "max_tokens": 256,
    }
    request = urllib.request.Request(
        base + "/v1/chat/completions",
        data=json.dumps(payload).encode(),
        headers={"Content-Type": "application/json"},
    )
    with urllib.request.urlopen(request, timeout=600) as response:
        result = json.load(response)

    assert result.get("choices"), result
    message = result["choices"][0]["message"]
    assert message.get("content") or message.get("reasoning_content"), result

    with urllib.request.urlopen(base + "/health", timeout=10) as response:
        assert response.status == 200

    print(label, "OK", result.get("timings", {}))

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, used codex to query for related bugs/context

@ORippler
ORippler requested a review from CISC as a code owner October 12, 2026 15:19
@ORippler
ORippler requested a review from ngxson October 12, 2026 15:19
@github-actions github-actions Bot added the model Model specific label Oct 12, 2026

@CISC CISC left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Deepseek4 has the same issue after Vision was added.

@ebr

ebr commented Oct 13, 2026

Copy link
Copy Markdown

Confirming fix on ROCm/HIP (gfx1151, Strix Halo)

  • ROCm 10.0.0, Qwen3.8-Flash-Next:UD-IQ4_XS + mmproj-BF16 + Q8_0 MTP head, --spec-type draft-mtp
  • Before: first image request aborts at that assert (via process_mtmd_chunk -> common_speculative_impl_draft_mtp::process -> graph_mtp)
  • After: image request completes, no crash; draft acceptance 0.80 (64/80) on the same request

@ORippler ORippler added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Oct 13, 2026
@ORippler

Copy link
Copy Markdown
Collaborator Author

I think Deepseek4 has the same issue after Vision was added.

Thanks, removed the assert in #30444

@CISC
CISC merged commit 7f51953 into ggml-org:master Oct 13, 2026
19 checks passed
@ORippler
ORippler deleted the osimons/allow_embds_qwen3.8_mtp branch October 13, 2026 12:06
gsenkowski pushed a commit to gsenkowski/strix-llama.cpp that referenced this pull request Oct 19, 2026
An image chunk of a multimodal prompt reaches the MTP draft context as an
embedding-only batch (no token ids). graph_mtp asserted ubatch.token and
aborted the server ("qwen4exp MTP needs token input").

Follow ggml-org/llama.cpp ggml-org#30257 and ggml-org#30397 (closes ggml-org#30307): accept either
tokens or embeddings, take the token embedding from ubatch.embd when there
are no token ids, and size the embd input by n_embd_inp() with the hidden
state at n_embd_out(), as the other MTP graphs do. The merge of ggml-org#30397 did
not reach this fork's own copy of graph_mtp.

Builds on the CPU backend; not run with a qwen4exp model or an image prompt.

Assisted-by: Claude
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019zrr5zPyKJ6SnVE7BjRcUe
NineBallo added a commit to NineBallo/strix-llama.cpp that referenced this pull request Oct 19, 2026
An image chunk of a multimodal prompt reaches the MTP draft context as an
embedding-only batch (no token ids). graph_mtp asserted ubatch.token and
aborted the server ("qwen4exp MTP needs token input"), so every request
containing an image crashed llama-server.

Follow upstream ggml-org#30257 and the merged fix
ggml-org#30397 (closes ggml-org#30307): accept either
tokens or embeddings, take the token embedding from ubatch.embd when there
are no token ids, and size the embd input by n_embd_inp() - the width the
mtmd embeddings arrive at - with the handed-over hidden state still at
n_embd_out(), as the other MTP graphs do.

The fork's own rewrite of qwen4exp.cpp kept the assert through the
upstream syncs, so ggml-org#30397 never reached this copy of graph_mtp.
auRose94 pushed a commit to auRose94/llama.cpp that referenced this pull request Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. model Model specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: qwen4exp (Qwen3.8-Flash-Next) + MTP aborts on image input after #30257 (GGML_ASSERT(ubatch.token …) left in graph_mtp)

3 participants