Skip to content

[Bugfix][MoE] Filter packed expert weights during EP loading - #49558

Merged
esmeetu merged 4 commits into
vllm-project:mainfrom
aoshen02:agent/ep-filter-packed-weights
Aug 4, 2026
Merged

esmeetu merged 4 commits into
vllm-project:mainfrom
aoshen02:agent/ep-filter-packed-weights

Conversation

@aoshen02

@aoshen02 aoshen02 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Treat per-expert .weight_packed tensors as heavy weights eligible for EP-local filtering.
  • Keep scale and metadata tensors from every expert unchanged.
  • Cover local packed weights, remote packed weights, and remote scale tensors in the existing unit suite.

Root cause

The EP filter previously recognized only names ending in .weight. Quantized expert checkpoints can store the primary expert payload in a packed representation whose serialized key ends in .weight_packed. These keys are produced when quantized expert weights are packed for storage or loading; the suffix describes the payload layout, not a different ownership rule.

The filter runs on checkpoint tensor names before the loader materializes or unpacks the tensor. If .weight_packed is not recognized as a heavy expert weight, non-local expert payloads bypass EP filtering and are redundantly read on every EP rank. Scale and metadata tensors intentionally remain unfiltered because they are small and may be required for quantized-kernel setup across experts.

Changes

  • Recognize both .weight and .weight_packed as filterable heavy expert payloads.
  • Continue filtering by the numeric expert ID and the rank's local_expert_ids.
  • Leave scale, metadata, and other auxiliary tensors unchanged.
  • Add focused tests for local and remote packed payloads and remote scale tensors.

Scope and compatibility

This change applies only to per-expert tensor names with a numeric expert ID. Fused expert layouts and tensors without an explicit numeric expert ID remain unchanged and continue through their existing loader paths.

Related upstream work

vLLM #48891 fixes a separate multithreaded safetensors path that previously did not receive local_expert_ids at all. This PR is complementary: it fixes recognition of .weight_packed payloads once EP filtering is enabled.

Validation

  • Pure-function packed EP filter checks: passed.
  • uvx ruff check vllm/model_executor/model_loader/ep_weight_filter.py tests/model_executor/model_loader/test_ep_weight_filter.py: passed.
  • uvx ruff format --check vllm/model_executor/model_loader/ep_weight_filter.py tests/model_executor/model_loader/test_ep_weight_filter.py: passed.
  • git diff --check: passed.
  • Focused pytest was attempted, but collection on the host was blocked before reaching these tests because the local environment lacks the compiled vLLM CUDA flash-attention extension.

The available loading experiments measured the filtering path only; later post-load failures were unrelated to this change. No end-to-end accuracy claim is made.

AI assistance

AI assistance was used to investigate the root cause, prepare this minimal patch, and run the checks above. The human submitter will review every changed line and validate the runtime behavior before merge.

Port the focused fix from Inferact/mke#91.

Co-authored-by: OpenAI Codex <noreply@openai.com>


Signed-off-by: aoshen02 <aoshen02@users.noreply.github.com>
@mergify mergify Bot added the bug Something isn't working label Jul 23, 2026
@aoshen02
aoshen02 marked this pull request as ready for review July 23, 2026 07:54
@aoshen02
aoshen02 requested a review from 22quinn as a code owner July 23, 2026 07:54

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@aoshen02 aoshen02 added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 23, 2026
Signed-off-by: aoshen02 <aoshen@inferact.ai>
@aoshen02
aoshen02 force-pushed the agent/ep-filter-packed-weights branch from 76f3ae6 to 85c6035 Compare August 4, 2026 07:32
@esmeetu
esmeetu enabled auto-merge (squash) August 4, 2026 07:38
@esmeetu
esmeetu merged commit 7153fd7 into vllm-project:main Aug 4, 2026
88 checks passed
@aoshen02
aoshen02 deleted the agent/ep-filter-packed-weights branch August 4, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working 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