Skip to content

spec : zero-fill draft-cache holes left by mtmd chunks - #30220

Draft
Chazyl wants to merge 1 commit into
ggml-org:masterfrom
Chazyl:dflash-mtmd-zero-fill
Draft

Chazyl wants to merge 1 commit into
ggml-org:masterfrom
Chazyl:dflash-mtmd-zero-fill

Conversation

@Chazyl

@Chazyl Chazyl commented Oct 9, 2026 •

Copy link
Copy Markdown

Overview

Fixes #27408. Follow-up to #28587.

With --spec-type draft-dflash and an mmproj model, every image request returns HTTP 500
(failed to process speculative batch). #28587 skips M-RoPE-pinned mtmd embedding batches in
the DFlash process() and assumes "the draft can jump over the gap" -- but that gap is not
harmless: the next token batch fails the draft KV cache's consecutive-position check. This
patch detects the per-sequence gap at the top of process() and seeds it with zero-feature
injections. Drafted tokens are still verified by the target, so output stays distribution-exact;
only draft acceptance immediately after an image is degraded.

Additional information

Requirements

@Chazyl
Chazyl requested a review from a team as a code owner October 9, 2026 09:54
@ggml-gh-bot

ggml-gh-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

Hi @Chazyl, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Oct 9, 2026
@github-actions
github-actions Bot marked this pull request as draft October 9, 2026 10:00
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Oct 9, 2026
Follow-up to ggml-org#28587. That PR skips M-RoPE-pinned mtmd embedding batches in the
DFlash process() ("the draft can jump over the gap"), but the gap it leaves in
the draft KV cache is not harmless: the next token batch fails the KV cache's
consecutive-position check and llama-server returns HTTP 500 for any request
whose prompt contains an image (issue ggml-org#27408). The same hole appears when the
target reuses a cached prompt prefix the draft cache never saw.

Detect the per-sequence gap at the top of the DFlash process() and seed it with
zero-feature injections. Drafted tokens are still verified by the target, so this
only degrades draft acceptance right after an image -- output stays
distribution-exact.

Tested on 2x RTX 5060 Ti (CUDA, b11434): Qwen3.6-35B-A3B Q4_K_M + mmproj Q8_0 +
DFlash sidecar. Image requests go from HTTP 500 to 200 with no speculative-batch
errors; text-only n=6 quality is unchanged (paired P=0.505) and speed is within
noise. The approach is due to @dagnarf (z-lab#1); this is the
minimal port to upstream.

Signed-off-by: Chazyl ARFI <arfi.chazyl@gmail.com>
@Chazyl
Chazyl force-pushed the dflash-mtmd-zero-fill branch from e173f7c to 73647e8 Compare October 9, 2026 10:12

This branch has not been deployed

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

Labels

None yet

Projects

None yet

1 participant