Skip to content

[Multimodal] Add Qwen2/2.5/3-VL routing-metadata image adapters - #13

Open
guygir wants to merge 2 commits into
project-cb-lab:mainfrom
guygir:mm-qwen-routing-adapters
Open

guygir wants to merge 2 commits into
project-cb-lab:mainfrom
guygir:mm-qwen-routing-adapters

Conversation

@guygir

@guygir guygir commented Oct 12, 2026 •

Copy link
Copy Markdown

Overview

Depends on #12 . Opt Qwen2-VL, Qwen2.5-VL, and Qwen3-VL image processors
into exact routing-metadata so /render can skip pixel-tensor construction.

Production code under vllm/ once merged, assuming rebased on #12 : +162 / −1 (approx).

Claims

  • Image-only Qwen2/2.5/3-VL routing metadata matches full processing exactly.
  • Video and custom/incompatible processors stay on the full path.
  • On vllm launch render + Qwen2.5-VL-7B-AWQ, 4×1280×720 + ~1000 text
    tokens (6111 prompt tokens), unique media, return_mm_kwargs=false:
offered load stock p50 / p95 adapter p50 / p95
sequential n=15 49.7 / 50.8 ms 13.9 / 15.2 ms
20 RPS × 8s 50.4 / 60.2 ms 13.6 / 15.5 ms
25 RPS × 8s 217 / 564 ms 13.5 / 15.3 ms

This is /render / token-producer latency, not 300-token generate E2E.

Validation

pytest -q tests/models/multimodal/processing/test_qwen2_vl.py \
  tests/models/multimodal/processing/test_qwen3_vl.py -k routing_metadata

Those tests compare full apply() vs apply_routing_metadata() and require
identical token IDs, hashes, and placeholders, plus empty routing kwargs.
CI: .buildkite/test_areas/models_multimodal.yaml processor shard.

Reproduce the cluster /render numbers with
mm-routing-audit/cluster_render_saturation_curve.py against stock
origin/main and this branch.

Details

Qwen prompt updates currently read image_grid_thw from processed tensors,
so PR1's generic path cannot skip HF construction. The adapters compute the
same smart-resize token counts from image dimensions only.

Exact processor and ProcessingInfo class opt-in is required so subclasses
such as Jina-VL do not inherit an incorrect fast path.

AI assistance was used. A human submitter reviewed the diff.


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (Mandatory for agents, optional for humans).

  • AI assistance was used during the creation of this PR.

  • Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.

  • Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.

  • Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.

  • Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.

guygir and others added 2 commits October 12, 2026 22:14
When return_mm_kwargs is false, use exact processor metadata so families
whose prompt updates already ignore processed kwargs skip HF tensor
construction, and fail closed to full apply otherwise.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Guy Girmonsky <guygir@gmail.com>
Qwen prompt updates read image_grid_thw from processed tensors, so the
generic /render path cannot skip HF construction until ProcessingInfo
owns the exact image token counts.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Guy Girmonsky <guygir@gmail.com>
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