Skip to content

add regression test#35834

Merged
DarkLight1337 merged 1 commit intovllm-project:mainfrom
hallerite:main
Mar 3, 2026
Merged

add regression test#35834
DarkLight1337 merged 1 commit intovllm-project:mainfrom
hallerite:main

Conversation

@hallerite
Copy link
Copy Markdown
Contributor

@hallerite hallerite commented Mar 3, 2026

Purpose

Add a regression test verifying that /tokenize correctly expands image placeholder tokens for VLM models.

Before PR #34560, /tokenize did not run the multimodal processor, so it returned ~26 tokens for a message with an image instead of the expected 1451. Confirmed broken on both 0.15.1 and 0.16.0.

Test Plan

pytest tests/entrypoints/openai/test_tokenization_vlm.py -v

Test Result

On HEAD — PASS:
test_tokenize_chat_expands_image_placeholders PASSED
======================= 1 passed in 30.40s ========================

On vllm 0.15.1 / 0.16.0 — FAIL (expected):
/tokenize returned 26 tokens
FAIL — token count 26 is too low, image placeholders were NOT expande


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, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Copy link
Copy Markdown
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 adds a regression test to ensure that the /tokenize endpoint correctly expands image placeholders for VLM models. The test is well-structured and targets the specific regression. My feedback includes a suggestion to improve the test's robustness to make it less brittle against future changes in the model or tokenizer.


# stop_sign.jpg (1300x876) produces 1451 tokens after expansion.
# Without expansion the count would be ~26 (text + one placeholder).
assert response.json()["count"] == 1451
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Hardcoding the exact token count 1451 makes this test brittle. Minor changes to the model's tokenizer or image processor in the future could cause this test to fail, even if the overall functionality is correct. To make the test more robust, consider asserting a range or a minimum value that clearly distinguishes between the buggy behavior (~26 tokens) and the correct behavior. For example, assert response.json()['count'] > 1000 would still effectively catch the regression while being more resilient to small changes.

Suggested change
assert response.json()["count"] == 1451
assert response.json()["count"] > 1000, "Token count is too low, image placeholders were likely not expanded."

Signed-off-by: hallerite <git@hallerite.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 3, 2026

👋 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 ask your reviewers to trigger select CI tests on top of fastcheck CI.

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.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

Copy link
Copy Markdown
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.

Thanks

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) March 3, 2026 05:57
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 3, 2026
@DarkLight1337 DarkLight1337 merged commit b8401cd into vllm-project:main Mar 3, 2026
14 checks passed
Copilot AI pushed a commit to machov/vllm that referenced this pull request Mar 10, 2026
Signed-off-by: hallerite <git@hallerite.com>
avinashsingh77 pushed a commit to avinashsingh77/vllm that referenced this pull request Mar 12, 2026
Signed-off-by: hallerite <git@hallerite.com>
wendyliu235 pushed a commit to wendyliu235/vllm-public that referenced this pull request Mar 18, 2026
Signed-off-by: hallerite <git@hallerite.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants