Skip to content

[Core][Bugfix] Fix Online MM Beam Search #19688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2025

Conversation

alex-jw-brooks
Copy link
Contributor

@alex-jw-brooks alex-jw-brooks commented Jun 16, 2025

Purpose

Fixes #19687

Test Plan

Running the sample script in the issue should produce output considering the mm data correctly. We should also update an async multimodal beam search test to correctly check the output to be safe.

Test Result

Sample response for the repro case provided in the issue, which now correctly passes the mm data through.

------------
Result 1: This image displays a gradient of colors ranging from red to violet.<|end|>
------------
Result 2: This image displays a gradient of colors ranging from red to violet, arranged in a checkered pattern.<|end|>

One of the online beam search tests with vision has also been updated to check the content to validate the fix.

@DarkLight1337 can you please take a look?

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @alex-jw-brooks, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

I've addressed a bug affecting offline multimodal beam search where the multimodal data was not being correctly propagated. This involved adjusting the data retrieval mechanism in the engine protocol and updating a relevant test case to validate the fix with specific expected outputs. A minor refactor to the beam search sorting key function was also included.

Highlights

  • Multimodal Beam Search Fix: I've corrected how multimodal data and prompt tokens are accessed within the beam search logic to resolve issues where this data was not being passed correctly, specifically addressing the problems outlined in issue [Bug]: Async Beam Search Doesn't Pass Multimodal Data Correctly #19687.
  • Test Update: I've modified an existing vision beam search test (test_single_chat_session_image_base64encoded_beamsearch) to specifically assert against expected output for different images, ensuring that multimodal data is correctly processed during beam search.
  • Code Refactoring: I've extracted the logic for creating the beam search sorting key into a dedicated helper function (create_sort_beams_key_function) for better code organization.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added the frontend label Jun 16, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to fix an issue with multimodal data not being correctly passed through in offline beam search. The core change in vllm/engine/protocol.py modifies how prompt_token_ids and multi_modal_data are sourced for beam search, using the raw prompt input instead of processed_inputs. This is acknowledged as a workaround in a TODO comment, which is good. The refactoring in vllm/entrypoints/llm.py to use create_sort_beams_key_function improves code structure.

The main concern is with the updated test in tests/entrypoints/openai/test_vision.py. While adding temperature=0.0 and strengthening the assertion logic are positive changes, there's a potential mismatch between the max_completion_tokens=10 setting, the content/length of the newly added EXPECTED_MM_BEAM_SEARCH_RES strings, and the sample output provided in the PR description. This could affect the test's correctness and reliability.

@alex-jw-brooks alex-jw-brooks changed the title [Core][Bugfix] Fix Offline MM Beam Search [Core][Bugfix] Fix Online MM Beam Search Jun 16, 2025
tokenizer.eos_token_id,
length_penalty)
tokenizer = self.get_tokenizer()
sort_beams_key = create_sort_beams_key_function(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Small refactor to share this between sync / async because it's identical

Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) June 16, 2025 15:47
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jun 16, 2025
auto-merge was automatically disabled June 16, 2025 16:28

Head branch was pushed to by a user without write access

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) June 19, 2025 08:06
@alex-jw-brooks
Copy link
Contributor Author

Hey @DarkLight1337, thanks for the quick review! I think the test failure is unrelated

@DarkLight1337 DarkLight1337 merged commit ead2110 into vllm-project:main Jun 19, 2025
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Async Beam Search Doesn't Pass Multimodal Data Correctly
2 participants