Skip to content

server: fix speculation after an image - #28715

Merged
ggerganov merged 2 commits into
ggml-org:masterfrom
jesdga95:server-draft-pos-after-image
Sep 11, 2026
Merged

ggerganov merged 2 commits into
ggml-org:masterfrom
jesdga95:server-draft-pos-after-image

Conversation

@jesdga95

Copy link
Copy Markdown
Contributor

Overview

Pass the actual position to the drafter after an image, instead of the token count. Affects every drafter, not just DFlash. Follow up after #28587, a user reported degraded performance after vision input (ROCm). I was able to reproduce similar results locally.

Additional information

RTX 5090, Qwen3.8-27B-UD-Q5_K_S + mmproj-qwen3.8-27b-F16, master df03399b8:

drafter master patched
DFlash2 51 t/s, acc 0.02 152 t/s, acc 0.35
MTP 122-129 t/s, acc 0.57-0.61 127-134 t/s, acc 0.60-0.66

DFlash seems to have a much larger impact but regular MTP also seems to get slightly lower values.

Requirements

  • I have read and agree with the contributing guidelines: YES
  • AI usage disclosure: Yes, used Fable 5.1 to debug and understand surrounding code.

Pass the actual position to the drafter after an image, instead of the
token count. Affects every drafter, not just DFlash.
@jesdga95
jesdga95 requested a review from a team as a code owner September 10, 2026 18:57
@ggerganov

Copy link
Copy Markdown
Member

This is correct, but we also need to rename n_past to pos0 since we use n_past to denote number of tokens and we want this parameter to have the meaning of "position".

n_past is used to denote number of tokens and this parameter is meant to be a position
@jesdga95
jesdga95 requested review from a team and ggerganov as code owners September 10, 2026 19:21
@jesdga95

Copy link
Copy Markdown
Contributor Author

@ggerganov renamed

@ggerganov
ggerganov merged commit b0dcb81 into ggml-org:master Sep 11, 2026
26 checks passed
@jesdga95
jesdga95 deleted the server-draft-pos-after-image branch September 11, 2026 10:35
Patt92 pushed a commit to Patt92/llama.cpp that referenced this pull request Sep 11, 2026
* server: fix speculation after an image

Pass the actual position to the drafter after an image, instead of the
token count. Affects every drafter, not just DFlash.

* rename draft n_past to pos0

n_past is used to denote number of tokens and this parameter is meant to be a position

(cherry picked from commit b0dcb81)
roverdrubber pushed a commit to roverdrubber/llama.cpp that referenced this pull request Sep 12, 2026
* server: fix speculation after an image

Pass the actual position to the drafter after an image, instead of the
token count. Affects every drafter, not just DFlash.

* rename draft n_past to pos0

n_past is used to denote number of tokens and this parameter is meant to be a position

(cherry picked from commit b0dcb81)
pl752 pushed a commit to pl752/llama.cpp that referenced this pull request Sep 15, 2026
* server: fix speculation after an image

Pass the actual position to the drafter after an image, instead of the
token count. Affects every drafter, not just DFlash.

* rename draft n_past to pos0

n_past is used to denote number of tokens and this parameter is meant to be a position
liquidspikes added a commit to liquidspikes/llama.cpp that referenced this pull request Sep 16, 2026
AvitusA pushed a commit to AvitusA/llama.cpp that referenced this pull request Sep 16, 2026
…ft origin

ggml-org#28715 switched the draft origin to the target position (pos_next()), which
is right for position-mirroring drafters (MTP) but wrong for DFlash/DSpark
in this branch: those keep one dense draft row per target token, so after an
M-RoPE image the position undershoots the row index and every draft step
fails (turns run undrafted at ~33 t/s). Use the token count for them, as the
pre-rebase server did, and keep pos_next() for the others.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014XyG2LrZogxN6UW2yy4tfq
quimmedes pushed a commit to quimmedes/cafe-llama.cpp that referenced this pull request Sep 16, 2026
* server: fix speculation after an image

Pass the actual position to the drafter after an image, instead of the
token count. Affects every drafter, not just DFlash.

* rename draft n_past to pos0

n_past is used to denote number of tokens and this parameter is meant to be a position
zsogitbe pushed a commit to zsogitbe/llama.cpp that referenced this pull request Sep 17, 2026
* server: fix speculation after an image

Pass the actual position to the drafter after an image, instead of the
token count. Affects every drafter, not just DFlash.

* rename draft n_past to pos0

n_past is used to denote number of tokens and this parameter is meant to be a position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants