Skip to content

fix(vlm): preserve literal <image> text in Qwen rollout prompts - #2594

Open
MitsuiChen14 wants to merge 2 commits into
THUDM:mainfrom
MitsuiChen14:fix/qwen-literal-image
Open

MitsuiChen14 wants to merge 2 commits into
THUDM:mainfrom
MitsuiChen14:fix/qwen-literal-image

Conversation

@MitsuiChen14

Copy link
Copy Markdown

A Qwen rollout with one screenshot can also contain the literal text <image>, for example in a tool response. The Qwen processor counts both the native vision span and that text as attachments. With slime's pinned SGLang patch stack, the legacy loader exhausts its image iterator and the request fails before generation.

Add a processor patch to the v0.5.21 and latest bundles and apply it during Docker and conda setup. Token-ID requests use native image spans. For string requests (including slime's default image rollout), when native spans already account for all supplied images, preserve bare <image> as text. Raw /generate shorthand and mixed shorthand/native prompts that need both slots retain their existing behavior. Use the same selection for artifact normalization and uncached loading.

Related: sgl-project/sglang#54931 covers token-ID requests upstream. This also covers slime's rendered string prompts and works with its legacy loader override. The change does not alter the SGLang version pin.

Validation used offline containers, a small local tokenizer and one generated PIL image. The regression calls the Qwen3.5 processor and checks image offsets and the returned text token IDs with the literal before and after the real image, for both string and token-ID input. A control checks raw and mixed shorthand normalization.

Processor environment Before After
SGLang v0.5.21 with slime's existing Docker patch stack 4 failed, 1 passed 5 passed
SGLang v1.0.0 with this standalone processor patch 4 failed, 1 passed 5 passed

Also ran python tests/test_qwen_vl_image_placeholder.py in the published slimerl/slime:latest image (5 passed). These are processor integration tests; a full image rebuild, HTTP generation and RL training were not exercised.

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

Development

Successfully merging this pull request may close these issues.

1 participant