Skip to content

[BugFix] Add bagel text2text/img2text think mode support#2503

Merged
hsliuustc0106 merged 2 commits intovllm-project:mainfrom
princepride:update-bagel-system-think-prompt
Apr 7, 2026
Merged

[BugFix] Add bagel text2text/img2text think mode support#2503
hsliuustc0106 merged 2 commits intovllm-project:mainfrom
princepride:update-bagel-system-think-prompt

Conversation

@princepride
Copy link
Copy Markdown
Collaborator

PLEASE FILL IN THE PR DESCRIPTION HERE ENSURING ALL CHECKLIST ITEMS (AT THE BOTTOM) HAVE BEEN CONSIDERED.

Purpose

Because previous code lack system prompt for thinking mode of text2text and img2text task, so the model can't generate thinking progress.

Test Plan

python3 ./examples/offline_inference/bagel/end2end.py   --stage-configs-path vllm_omni/model_executor/stage_configs/bagel_think.yaml   --modality text2text   --prompts "Where is the capital of France?" --think

Test Result

**before: **

The capital of France is Paris.

**after: **

<think>Hmm, let's see. The user is asking where the capital of France is. I think I remember that France is a major country in Europe, so its capital must be one of the bigger cities there. Maybe Paris? I've heard that before. But wait, let me make sure I'm not confusing it with another country. Like, Germany's capital is Berlin, right? So France's should be different.\n\nWait, I recall learning that the Eiffel Tower is in Paris, which is in France. The Eiffel Tower is a famous landmark, so that probably makes it a good candidate for the capital. Also, when I think about European capitals, they're often spread out geographically. France is in Western Europe, so the capital would be centrally located. Paris is near the center of the country, which makes sense because capitals usually are.\n\nBut let me check if there's any other possibility. Maybe someone might confuse it with a city like London, but London is in the UK. Or Rome for Italy. No, those are definitely not in France. So Paris is the most likely answer. Also, the French government, like the President and National Assembly, are based in Paris at the Élysée Palace and the National Assembly buildings. That confirms it. I think that settles it. The capital of France is Paris.</think>\nThe capital of France is **Paris**. Located in the northern part of the country, Paris is a major cultural, historical, and economic hub, home to landmarks such as the Eiffel Tower, Louvre Museum, and Notre-Dame Cathedral. It serves as the seat of the French government and is a global center for finance, fashion, and cuisine.

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan. Please provide the test scripts & test commands. Please state the reasons if your codes don't require additional test scripts. For test file guidelines, please check the test style doc
  • The test results. Please paste the results comparison before and after, or the e2e results.
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model. Please run mkdocs serve to sync the documentation editions to ./docs.
  • (Optional) Release notes update. If your change is user-facing, please update the release notes draft.

BEFORE SUBMITTING, PLEASE READ https://github.com/vllm-project/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)

Signed-off-by: princepride <wangzhipeng628@gmail.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2dbf218631

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread examples/offline_inference/bagel/end2end.py
Copy link
Copy Markdown
Collaborator

@hsliuustc0106 hsliuustc0106 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Two blocking issues found.

What I validated

  • All CI gates pass (DCO, pre-commit, build, docs) ✅
  • Test evidence shows think mode working for text2text ✅
  • VLM_THINK_SYSTEM_PROMPT is a clean analog of GEN_THINK_SYSTEM_PROMPT
  • Output handling refactor is a reasonable cleanup ✅

Blocking Issues

1. Prompt format drops ChatML roles, breaking non-think text2text

The original text2text format uses ChatML roles: <|im_start|>user\n{p}<|im_end|>\n<|im_start|>assistant\n. The new code produces <|im_start|>{p}<|im_end|><|im_start|> — missing user\n, assistant\n, and \n separators. This changes the prompt even when args.think is False (regression).

For the think case, the system prompt also lacks a system\n role. Compare with img2text which uses <|im_start|>user\n...<|im_end|>\n<|im_start|>assistant\n — text2text should follow the same ChatML convention:

think_prefix = f"<|im_start|>system\n{VLM_THINK_SYSTEM_PROMPT}<|im_end|>\n" if args.think else ""
final_prompt_text = f"{think_prefix}<|im_start|>user\n{p}<|im_end|>\n<|im_start|>assistant\n"

2. Title claims img2text support but img2text branch is unchanged

The PR title says "text2text/img2text think mode support" and the description mentions both, but the img2text branch in end2end.py is not modified. Either update the title/scope to match, or add think mode for img2text.

Non-blocking

  • The output handling refactor (lines 224-228) changes think-mode output printing for all modalities, including text2img. The test evidence only covers text2text — worth a quick sanity check that text2img think mode still prints correctly.

Comment thread examples/offline_inference/bagel/end2end.py
Comment thread examples/offline_inference/bagel/end2end.py
Comment thread examples/offline_inference/bagel/end2end.py
@princepride
Copy link
Copy Markdown
Collaborator Author

princepride commented Apr 5, 2026

I've add img2text think mode

Signed-off-by: princepride <wangzhipeng628@gmail.com>
Copy link
Copy Markdown
Collaborator

@hsliuustc0106 hsliuustc0106 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text2text path missing system/user/assistant role markers in prompt format

Comment thread examples/offline_inference/bagel/end2end.py
@princepride
Copy link
Copy Markdown
Collaborator Author

@hsliuustc0106 Can you help approve it?

@princepride princepride added the ready label to trigger buildkite CI label Apr 6, 2026
@hsliuustc0106 hsliuustc0106 merged commit 5b2c4f9 into vllm-project:main Apr 7, 2026
8 checks passed
skf-1999 pushed a commit to Semmer2/vllm-omni that referenced this pull request Apr 7, 2026
…t#2503)

Signed-off-by: princepride <wangzhipeng628@gmail.com>
vraiti pushed a commit to vraiti/vllm-omni that referenced this pull request Apr 9, 2026
…t#2503)

Signed-off-by: princepride <wangzhipeng628@gmail.com>
bob-021206 pushed a commit to jasonlee-1024/vllm-omni that referenced this pull request Apr 21, 2026
…t#2503)

Signed-off-by: princepride <wangzhipeng628@gmail.com>
Signed-off-by: bob-021206 <binyan_github@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready label to trigger buildkite CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants