Skip to content

fix(container/vllm): patch exaone_moe lm_head prefix so K-EXAONE 2.0 NVFP4 loads - #14569

Closed
chw001 wants to merge 1 commit into
ai-dynamo:mainfrom
chw001:chw001/exaone-moe-lm-head-prefix
Closed

chw001 wants to merge 1 commit into
ai-dynamo:mainfrom
chw001:chw001/exaone-moe-lm-head-prefix

Conversation

@chw001

@chw001 chw001 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

LGAI-EXAONE/K-EXAONE-2.0-750B-A37B-NVFP4 cannot be served on vLLM 0.28.0 or 0.29.0 — it fails during weight load:

vllm/model_executor/layers/vocab_parallel_embedding.py  weight_loader
RuntimeError: The size of tensor a (3072) must match the size of tensor b (6144)
              at non-singleton dimension 1

This adds the vLLM patch directory plus the apply step, and one patch fixing it.

Root cause

vllm/model_executor/models/exaone_moe.py constructs ParallelLMHead without a prefix, so it defaults to "". VocabParallelEmbedding.__init__ then calls quant_config.get_quant_method(self, prefix=""), and ModelOptNvFp4Config.is_layer_excluded("") matches none of the checkpoint's 223 exclusion patterns. lm_head is therefore quantized and allocated as a packed NVFP4 param [vocab, hidden/2] = [.., 3072], which rejects the checkpoint's unquantized BF16 lm_head.weight [153600, 6144].

Verified CPU-only against the checkpoint's own quantization config:

exclude_modules: 223
is_layer_excluded('lm_head') = True
is_layer_excluded('')        = False
get_quant_method(ParallelLMHead, prefix='lm_head') -> UnquantizedLinearMethod
get_quant_method(ParallelLMHead, prefix='')        -> NVFP4 linear method

The header weights confirm the checkpoint is correct — lm_head.weight and model.embed_tokens.weight are both BF16 [153600, 6144], and both are listed in ignore / exclude_modules.

This only manifests for checkpoints that exclude lm_head from quantization, which is why BF16-validated upstream support PRs never hit it.

Changes

  • container/deps/vllm/patches/ + apply step in vllm_runtime.Dockerfile (patch --fuzz=5 -p1 into site-packages, filename order, cuda only) — same mechanism used for the SGLang/vLLM hotfixes elsewhere.
  • 01-exaone-moe-lm-head-prefix.patch — adds prefix=maybe_prefix(prefix, "lm_head").

Test plan / results

config patch result
Dynamo DGD, --quantization modelopt_fp4 no crash @ shard 53
Dynamo DGD, flag removed no crash @ shard 53
raw vLLM 0.29.0 no crash @ shard 53
raw vllm serve 0.28.0 yes 53/53 shards, KV 3,475,818 tokens, finish_reason=stop, coherent
Dynamo DGD (vllm-runtime-nightly) B200 TP4 yes worker Ready, coherent through frontend

Patch verified to apply at exact offsets to vLLM 0.28.0 (no fuzz needed).

Upstream

The real fix belongs in vLLM: exaone_moe.py already imports maybe_prefix and uses it for "model" a few lines above, and qwen3_moe.py / exaone4.py both pass the prefix correctly — exaone_moe.py is the outlier. Current vLLM main is still unfixed (and has since dropped org_num_embeddings/padding_size from the same call). I'll file the upstream one-liner; this patch is a bridge until it lands and a base image carries it.

Note

Draft to trigger the build pipeline. Overlaps in intent with #12513, which introduces the same patch directory on its own branch — whichever merges second needs a trivial renumber/rebase.

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@chw001
chw001 temporarily deployed to external_collaborator September 10, 2026 00:19 — with GitHub Actions Inactive
@chw001
chw001 temporarily deployed to external_collaborator September 10, 2026 00:19 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi chw001! Thank you for contributing to ai-dynamo/dynamo.

Just a reminder: The NVIDIA Test Github Validation CI runs an essential subset of the testing framework to quickly catch errors.Your PR reviewers may elect to test the changes comprehensively before approving your changes.

🚀

@github-actions github-actions Bot added fix external-contribution Pull request is from an external contributor backend::vllm Relates to the vllm backend container labels Sep 10, 2026
…NVFP4 loads

K-EXAONE-2.0-750B-A37B-NVFP4 cannot be served on vLLM 0.28.0 or 0.29.0:

  vocab_parallel_embedding.py weight_loader
  RuntimeError: The size of tensor a (3072) must match the size of tensor b
                (6144) at non-singleton dimension 1

vllm/model_executor/models/exaone_moe.py constructs ParallelLMHead without a
`prefix`, so it defaults to "". VocabParallelEmbedding.__init__ then calls
quant_config.get_quant_method(self, prefix=""), and is_layer_excluded("")
matches none of the checkpoint's 223 exclusion patterns. lm_head is therefore
quantized and allocated as a packed NVFP4 param [vocab, hidden/2], which
rejects the checkpoint's unquantized BF16 lm_head.weight [153600, 6144].

Adds the vLLM patch directory and the apply step (patch --fuzz=5 -p1 into
site-packages, applied in filename order, cuda only), matching the mechanism
used for the SGLang/vLLM hotfixes elsewhere.

Verified:
  - patch applies at exact offsets to vLLM 0.28.0
  - raw vllm serve + patch: loads 53/53 shards, KV cache 3,475,818 tokens,
    coherent output, finish_reason=stop
  - Dynamo DGD + patch on B200 TP4: worker Ready, coherent through the frontend
  - without the patch, three separate runs crash at shard 53 (DGD with and
    without --quantization modelopt_fp4, and raw vLLM 0.29.0)

Upstream fix should land in vLLM (exaone_moe.py already imports maybe_prefix
and uses it for "model"; qwen3_moe.py and exaone4.py both pass the prefix
correctly). This patch is a bridge until then.
@chw001
chw001 force-pushed the chw001/exaone-moe-lm-head-prefix branch from c51bd6a to 73fa6a1 Compare September 10, 2026 00:21
@chw001
chw001 temporarily deployed to external_collaborator September 10, 2026 00:21 — with GitHub Actions Inactive
@dynamo-ops

Copy link
Copy Markdown
Contributor

/ok to test 73fa6a1

@chw001

chw001 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of #14599, which targets release/1.4.1-k-exaone-236b-post.1 per the guidance that container PRs go on the release branches.

Same two files (the container/deps/vllm/patches/ seam plus 01-exaone-moe-lm-head-prefix.patch); the patch was verified to apply to both vLLM 0.26.0 and 0.28.0.

The upstream one-line fix in vllm/model_executor/models/exaone_moe.py is still the real resolution — this container patch is a bridge until that lands.

@chw001 chw001 closed this Sep 10, 2026

This branch was previously deployed

1 inactive deployment
external_collaborator — 73fa6a16 Deployed Sep 10, 2026 by chw001 via ok-to-test #16189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend::vllm Relates to the vllm backend container external-contribution Pull request is from an external contributor fix size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants