Skip to content

[EPLB] Simplify EPLB rearrange by only returning one map#36267

Merged
tlrmchlsmth merged 12 commits intovllm-project:mainfrom
neuralmagic:sage/eplb-rearrange-refactor
Mar 19, 2026
Merged

[EPLB] Simplify EPLB rearrange by only returning one map#36267
tlrmchlsmth merged 12 commits intovllm-project:mainfrom
neuralmagic:sage/eplb-rearrange-refactor

Conversation

@SageMoore
Copy link
Copy Markdown
Contributor

@SageMoore SageMoore commented Mar 6, 2026

Purpose

On main EPLB rearrange returns 3 maps: physical expert -> logical expert, logical expert -> physical expert, and logical expert -> replica count. The latter two are derivable from the physical expert -> logical expert mapping.

With this change, we only have to keep track of the physical expert -> logical expert map in when running EPLB. Once weight transfer has finished and EPLB is ready to make the changes visible to the model, it will generate the other two maps and write them directly into the model state.

This change deletes a lot of code and reduces the amount of state that EPLB has to maintain when running async. Functionally the only change is "delaying" the creation of the second two maps until after weight transfer has completed when running async. The rest is purely cosmetic.

It also opens the door for post-processing the result of EPLB rearrange without having to re-update all of the maps.

Test Plan

Sync EPLB Server Command

vllm serve deepseek-ai/DeepSeek-V2-Lite -dp 2 --enable-expert-parallel --all2all_backend deepep_low_latency --enable-eplb --eplb-config '{"window_size":20,"step_interval":20}'

Async EPLB Server Command

vllm serve deepseek-ai/DeepSeek-V2-Lite -dp 2 --enable-expert-parallel --all2all_backend deepep_low_latency --enable-eplb --eplb-config '{"window_size":20,"step_interval":20,"use_async":"true"}'

Test Result

Sync EPLB

|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.3867|±  |0.0282|
|     |       |strict-match    |     5|exact_match|↑  |0.3833|±  |0.0281|

Async EPLB

|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.3733|±  | 0.028|
|     |       |strict-match    |     5|exact_match|↑  |0.3733|±  | 0.028|

Signed-off-by: Sage Moore <sage@neuralmagic.com>
Signed-off-by: Sage Moore <sage@neuralmagic.com>
Signed-off-by: Sage Moore <sage@neuralmagic.com>
Signed-off-by: Sage Moore <sage@neuralmagic.com>
Signed-off-by: Sage Moore <sage@neuralmagic.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 refactors the EPLB rearrange logic to simplify state management by deriving two expert mapping tensors from a single one, instead of computing and storing all three. This is a good simplification that reduces complexity. The overall changes look correct and align with the stated purpose. However, I've found a couple of critical issues in the new compute_logical_maps helper function where it doesn't correctly handle negative indices for unused experts, which could lead to incorrect behavior or crashes. I've provided detailed comments and suggestions to address these bugs.

Note: Security Review is unavailable for this PR.

Signed-off-by: Sage Moore <sage@neuralmagic.com>
Signed-off-by: Sage Moore <sage@neuralmagic.com>
Signed-off-by: Sage Moore <sage@neuralmagic.com>
Signed-off-by: Sage Moore <sage@neuralmagic.com>
@SageMoore SageMoore marked this pull request as ready for review March 11, 2026 15:40
Copy link
Copy Markdown
Contributor

@ilmarkov ilmarkov left a comment

Choose a reason for hiding this comment

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

Makes sense. Thank you!

@tlrmchlsmth tlrmchlsmth added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 18, 2026
@tlrmchlsmth tlrmchlsmth merged commit c32a58c into vllm-project:main Mar 19, 2026
56 checks passed
@SageMoore SageMoore deleted the sage/eplb-rearrange-refactor branch March 19, 2026 13:01
fxdawnn pushed a commit to fxdawnn/vllm that referenced this pull request Mar 19, 2026
…t#36267)

Signed-off-by: Sage Moore <sage@neuralmagic.com>
Co-authored-by: Tyler Michael Smith <tyler@neuralmagic.com>
SouthWest7 pushed a commit to SouthWest7/vllm that referenced this pull request Mar 27, 2026
…t#36267)

Signed-off-by: Sage Moore <sage@neuralmagic.com>
Co-authored-by: Tyler Michael Smith <tyler@neuralmagic.com>
khairulkabir1661 pushed a commit to khairulkabir1661/vllm that referenced this pull request Mar 27, 2026
…t#36267)

Signed-off-by: Sage Moore <sage@neuralmagic.com>
Co-authored-by: Tyler Michael Smith <tyler@neuralmagic.com>
Monishver11 pushed a commit to Monishver11/vllm that referenced this pull request Mar 27, 2026
…t#36267)

Signed-off-by: Sage Moore <sage@neuralmagic.com>
Co-authored-by: Tyler Michael Smith <tyler@neuralmagic.com>
Signed-off-by: Monishver Chandrasekaran <monishverchandrasekaran@gmail.com>
JiantaoXu pushed a commit to JiantaoXu/vllm that referenced this pull request Mar 28, 2026
…t#36267)

Signed-off-by: Sage Moore <sage@neuralmagic.com>
Co-authored-by: Tyler Michael Smith <tyler@neuralmagic.com>
vrdn-23 pushed a commit to vrdn-23/vllm that referenced this pull request Mar 30, 2026
…t#36267)

Signed-off-by: Sage Moore <sage@neuralmagic.com>
Co-authored-by: Tyler Michael Smith <tyler@neuralmagic.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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants