Skip to content

spec: keep DFlash vision positions contiguous - #4

Open
Sphinx-8 wants to merge 1 commit into
z-lab:dflash2from
Sphinx-8:fix/dflash2-vision-linear-positions
Open

spec: keep DFlash vision positions contiguous#4
Sphinx-8 wants to merge 1 commit into
z-lab:dflash2from
Sphinx-8:fix/dflash2-vision-linear-positions

Conversation

@Sphinx-8

Copy link
Copy Markdown

Problem

DFlash2 uses a one-dimensional draft KV cache, while multimodal target batches can carry multi-dimensional M-RoPE positions with repeated or jumping values. Copying those positions into the draft batch makes the draft sequence non-consecutive and vision requests fail during llama_decode.

A second mismatch appears after multimodal prefill: dp.n_past is measured on the target sequence, but the text-only draft cache advances on its own position scale.

Change

  • Assign injected target features strictly increasing positions per sequence, beginning at the current draft-cache maximum plus one.
  • Start each speculative draft block at the actual next draft-cache position instead of the target token count.

This keeps target positions untouched. It is intentionally narrow and is offered for comparison with the zero-fill approach in #1. The initial dense-position direction was also discussed in ggml-org#27342.

Validation

Base: z-lab dflash2 at 1deefcc.

Hardware/runtime: DGX Spark GB10, CUDA; Qwen3.8 27B target BF16, DFlash2 draft BF16, F16 vision projector, speculative depth 4.

Measured vision requests, each cell after three warmups:

Prompt/context Parallelism Result Mean TTFT Mean decode Acceptance
Native image, about 1k prompt tokens 1 10/10 2.50 s 12.32 tok/s 62.66%
Native image, about 1k prompt tokens 2 10/10 4.32 s 11.61 tok/s 62.34%
Image plus about 7k text tokens 1 10/10 11.02 s 11.36 tok/s 60.23%
Image plus about 7k text tokens 2 10/10 19.85 s 8.19 tok/s 60.27%
Image plus about 129.5k text tokens 1 10/10 237.08 s 8.72 tok/s 64.85%

No request errors occurred across the 50 measured requests. A separate two-slot, 262144-context-per-slot smoke test passed 2/2 concurrent vision requests with active DFlash2.

The patched current branch also builds llama-server successfully on aarch64 with GCC 13.3.0. Patch SHA-256 from the validated deployment: ad8e244316fb51c088258d532f271c32e15289045605cd2c5eb093f13f8ef91f.

Disclosure

Implementation and PR text were prepared with OpenAI Codex under Sphinx-8 direction. All reported measurements came from actual runs on the stated hardware; no results are inferred.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant