Skip to content

server : unify mtmd image processing with post-decode callback#24520

Closed
ggerganov wants to merge 3 commits into
masterfrom
gg/server-spec-mtmd
Closed

server : unify mtmd image processing with post-decode callback#24520
ggerganov wants to merge 3 commits into
masterfrom
gg/server-spec-mtmd

Conversation

@ggerganov

@ggerganov ggerganov commented Jun 12, 2026

Copy link
Copy Markdown
Member

Overview

Add `mtmd_helper_post_decode_callback` to `mtmd_helper_eval_chunk_single` and `mtmd_helper_decode_image_chunk`, invoked after each successful `llama_decode()`.

The server uses this callback to decode the batch on the draft context, keeping it in sync with the target context during multi-modal prompt processing. This eliminates the need for a second `process_chunk` call on `ctx_dft`.

Requirements

Add mtmd_helper_post_decode_callback to mtmd_helper_eval_chunk_single and
mtmd_helper_decode_image_chunk, invoked after each successful llama_decode().

The server uses this callback to run common_speculative_process on the batch,
keeping the draft context in sync with the target context during multi-modal
prompt processing. This eliminates the need for a second process_chunk call
on ctx_dft and removes the llama-ext.h workaround include.

Assisted-by: pi:llama.cpp/Qwen3.6-27B
@ngxson

ngxson commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

fyi, I'm solving the same problem via #24384 , so probably this doesn't need to be fixed

Move the post-decode callback construction inside server_tokens::process_chunk()
so that server-common.h no longer depends on mtmd-helper.h. The caller now
passes ctx_tgt and ctx_dft directly.

Assisted-by: pi:llama.cpp/Qwen3.6-27B
@ggerganov

Copy link
Copy Markdown
Member Author

fyi, I'm solving the same problem via #24384 , so probably this doesn't need to be fixed

Ok, leaving this PR for reference if it can be helpful in any way.

@ggerganov

Copy link
Copy Markdown
Member Author

Superseded by #24645

@ggerganov ggerganov closed this Jun 15, 2026
@ggerganov ggerganov deleted the gg/server-spec-mtmd branch June 15, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants