Skip to content

Make microbatch optimization (DBO) work with general models#37926

Merged
njhill merged 3 commits intovllm-project:mainfrom
0xjunhao:fix-dbo
Mar 24, 2026
Merged

Make microbatch optimization (DBO) work with general models#37926
njhill merged 3 commits intovllm-project:mainfrom
0xjunhao:fix-dbo

Conversation

@0xjunhao
Copy link
Copy Markdown
Contributor

@0xjunhao 0xjunhao commented Mar 23, 2026

Purpose

Currently, microbatch optimization only works for text models, and the model must expose an internal model attribute (e.g.

self.model = self.model_cls(
vllm_config=vllm_config, prefix=maybe_prefix(prefix, "model")
)
)

Otherwise, vLLM fails to start. This PR extends microbatch optimization to general models, removing the requirement for text-only models and the need for an internal model attribute.

Test Plan

vllm serve Qwen/Qwen3.5-35B-A3B --trust-remote-code --gpu-memory-utilization 0.8 -dp 2 --enable-expert-parallel --all2all-backend deepep_low_latency --enable-dbo

Test Result

Before the fix:

For multimodal models, it gives the following error:
#34210

For models without an internal model attribute, it gives the following error:

(Worker pid=5836) (Worker_DP1_EP1 pid=5836) ERROR 03-23 20:25:23 [multiproc_executor.py:880]   File "/usr/local/lib/python3.12/dist-packages/vllm/v1/worker/gpu_ubatch_wrapper.py", line 494, in __call__
(Worker pid=5836) (Worker_DP1_EP1 pid=5836) ERROR 03-23 20:25:23 [multiproc_executor.py:880]     return self._run_ubatches(ubatch_metadata, self.model)
(Worker pid=5836) (Worker_DP1_EP1 pid=5836) ERROR 03-23 20:25:23 [multiproc_executor.py:880]                                                ^^^^^^^^^^
(Worker pid=5836) (Worker_DP1_EP1 pid=5836) ERROR 03-23 20:25:23 [multiproc_executor.py:880]   File "/usr/local/lib/python3.12/dist-packages/vllm/v1/worker/gpu_ubatch_wrapper.py", line 164, in __getattr__
(Worker pid=5836) (Worker_DP1_EP1 pid=5836) ERROR 03-23 20:25:23 [multiproc_executor.py:880]     raise AttributeError(
(Worker pid=5836) (Worker_DP1_EP1 pid=5836) ERROR 03-23 20:25:23 [multiproc_executor.py:880] AttributeError: Attribute model not exists in the runnable of cudagraph wrapper: Qwen3_5MoeForConditionalGeneration(

After the fix

The server starts and runs successfully.


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.

@0xjunhao 0xjunhao requested a review from njhill as a code owner March 23, 2026 20:45
Signed-off-by: Junhao Li <junhao@ubicloud.com>
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 successfully extends microbatch optimization to general models by removing the dependency on a model attribute and handling optional input_ids and inputs_embeds. The changes are logical and well-aligned with the goal. I have one suggestion to improve consistency and prevent a potential runtime error, which is detailed in my comment.

Copy link
Copy Markdown
Collaborator

@LucasWilkinson LucasWilkinson left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, LGTM!

@LucasWilkinson LucasWilkinson added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 23, 2026
@mergify
Copy link
Copy Markdown

mergify bot commented Mar 23, 2026

Hi @0xjunhao, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Junhao Li <junhao@ubicloud.com>
@0xjunhao
Copy link
Copy Markdown
Contributor Author

Seems this is the only error and it's unrelated to this PR.

ERROR   -  mkdocstrings: Couldn't load inventory https://psutil.readthedocs.io/en/stable/objects.inv through handler 'python': HTTP Error 404: Not Found

Copy link
Copy Markdown
Contributor

@SageMoore SageMoore left a comment

Choose a reason for hiding this comment

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

Looks reasonable. Thanks for the contribution!

@njhill njhill merged commit b73b5b0 into vllm-project:main Mar 24, 2026
52 checks passed
RhizoNymph pushed a commit to RhizoNymph/vllm that referenced this pull request Mar 26, 2026
HenryTangDev pushed a commit to HenryTangMain/vllm that referenced this pull request Mar 27, 2026
malaiwah pushed a commit to malaiwah/vllm that referenced this pull request Mar 27, 2026
…ject#37926)

Signed-off-by: Junhao Li <junhao@ubicloud.com>
Signed-off-by: Michel Belleau <michel.belleau@malaiwah.com>
khairulkabir1661 pushed a commit to khairulkabir1661/vllm that referenced this pull request Mar 27, 2026
Monishver11 pushed a commit to Monishver11/vllm that referenced this pull request Mar 27, 2026
…ject#37926)

Signed-off-by: Junhao Li <junhao@ubicloud.com>
Signed-off-by: Monishver Chandrasekaran <monishverchandrasekaran@gmail.com>
nithinvc pushed a commit to nithinvc/vllm that referenced this pull request Mar 27, 2026
…ject#37926)

Signed-off-by: Junhao Li <junhao@ubicloud.com>

Signed-off-by: Nithin Chalapathi <nithin.ch10@gmail.com>
JiantaoXu pushed a commit to JiantaoXu/vllm that referenced this pull request Mar 28, 2026
vrdn-23 pushed a commit to vrdn-23/vllm that referenced this pull request Mar 30, 2026
…ject#37926)

Signed-off-by: Junhao Li <junhao@ubicloud.com>
Signed-off-by: Vinay Damodaran <vrdn@hey.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 v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants