Skip to content

[Bugfix] Skip unregistered checkpoint tensors in Merged/QKVParallelLinear.load_weights#9

Open
afierka-intel wants to merge 46 commits into
mainfrom
afierka/fix-linear-skip-unmatched-checkpoint-keys
Open

[Bugfix] Skip unregistered checkpoint tensors in Merged/QKVParallelLinear.load_weights#9
afierka-intel wants to merge 46 commits into
mainfrom
afierka/fix-linear-skip-unmatched-checkpoint-keys

Conversation

@afierka-intel

Copy link
Copy Markdown
Owner

Summary

MergedColumnParallelLinear.load_weights() and QKVParallelLinear.load_weights() used getattr(self, name, self) — the layer module itself as a "not found" sentinel. When a checkpoint provides a tensor with no matching registered param, the if param is None and name == "bias": continue guard only catches the literal name "bias"; any other unmatched name (e.g. a GPTQ exporter's g_idx when desc_act=False) falls through and routes the whole module into param.weight_loader(param, loaded_weight, shard_id), crashing with AttributeError: '<LayerClass>' object has no attribute 'data' deep inside weight_loader instead of being skipped.

Why this isn't a duplicate

Searched gh issue list/gh pr list for AttributeError has no attribute data weight_loader, MergedColumnParallelLinear has no attribute, QKVParallelLinear has no attribute — no open issue/PR addresses this specific sentinel bug in linear.py. (Separately, while investigating this I found vllm-project/vllm#35865 already covers a related-but-distinct problem — modules_in_block_to_quantize list-of-lists flattening and packed_modules_mapping propagation into per-layer delegate quant configs for the moe_wna16 override path — so I did not duplicate that work here.)

Root cause

if "." in name:
    submodule, _, attr = name.rpartition(".")
    param = getattr(self.get_submodule(submodule), attr, self)  # <-- sentinel = self
else:
    param = getattr(self, name, self)  # <-- sentinel = self
if param is None and name == "bias":  # <-- only catches literal "bias"
    continue
param.weight_loader(param, loaded_weight, shard_id)  # <-- crashes if param is `self`

Fix: use None as the sentinel (so a real miss is detectable), and extend the skip condition to any unmatched checkpoint key ending in bias or g_idx — both are legitimate cases where a real quantized checkpoint exports a tensor the layer never registered as a param (bias when the layer's bias=False; g_idx when desc_act=False, since some GPTQ exporters still emit a trivial per-layer g_idx regardless).

How I hit this

While testing the tensor-descriptor MoE kernel work in afierka-intel/vllm#6 (VLLMZ-1811), I needed --quantization moe_wna16 to route Qwen/Qwen1.5-MoE-A2.7B-Chat-GPTQ-Int4 through the Triton-kernel code path instead of the native Marlin/XPU path. That model's real checkpoint exports g_idx and per-expert bias tensors for every quantized linear layer, despite desc_act=false and has_bias=False — exposing this sentinel bug during weight loading. Not specific to XPU or to that PR's kernel change; reproducible on any platform with any checkpoint that has this shape.

Test plan

  • New regression tests in tests/model_executor/layers/test_linear_load_weights.py: construct a bare MergedColumnParallelLinear/QKVParallelLinear (no full model), call .load_weights() directly with an unmatched bias/g_idx tensor and confirm it's skipped (empty loaded list, no exception), plus a control test confirming a real matched weight still loads and is reported.
  • Verified the new tests fail against the pre-fix code with the exact reported AttributeError, and pass with the fix — confirms the tests exercise the real bug, not a tautology.
  • pre-commit run (ruff check/format, mypy, SPDX headers, etc.) all green locally.
  • Ran the existing kernel-level MoE test suite (tests/kernels/moe/test_fused_moe_kernel_gptq_awq.py, 33 tests) and the new E2E model-level test for VLLMZ-1811 (tests/models/quantization/test_gptq_awq_moe_td.py) on real B70 (Intel Arc Pro) hardware with this fix applied (plus the two other independent fixes for [Bugfix] fixes wna16 quantization for dense layers. vllm-project/vllm#35865-adjacent issues, applied locally only, not part of this PR) — model loads and generates correctly end-to-end.

AI assistance was used (Claude Code) for investigation and implementation; I reviewed every changed line and ran the tests above personally.

aarushjain29 and others added 30 commits July 15, 2026 09:20
Signed-off-by: aarushjain29 <aarushi.jain2@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
…llm-project#48688)

Signed-off-by: Turner Jabbour <doubleujabbour@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Jee Jee Li <jeejeelee@inferact.ai>
…uest() (vllm-project#48098)

Signed-off-by: mahadrehmann <mahadrehman04@gmail.com>
Signed-off-by: Mahad Rehman <114791389+mahadrehmann@users.noreply.github.com>
Co-authored-by: muhammadfawaz1 <135441198+professorsab@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Chauncey <chaunceyjiang@gmail.com>
…g different `kernel_block_size` (vllm-project#48125)

Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
…ol-call parsers (vllm-project#48034)

Signed-off-by: Tahsin Tunan <tahsintunan@gmail.com>
… test (vllm-project#47873)

Signed-off-by: Tahsin Tunan <tahsintunan@gmail.com>
…k control port (vllm-project#47636)

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…stream (vllm-project#48526)

Signed-off-by: pei.zhang <pei.zhang@amd.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
…t#41934)

Signed-off-by: tzielinski-habana <tomasz.zielinski@intel.com>
Signed-off-by: Tomasz Zielinski <85164140+tzielinski-habana@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Chendi.Xue <chendi.xue@intel.com>
Signed-off-by: Sean Chen <seachen@redhat.com>
…llm-project#47770)

Signed-off-by: giuseppegrossi <ggrossi@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…m-project#48252)

Signed-off-by: Sage Ahrac <sagiahrak@gmail.com>
Signed-off-by: Sage <80211083+sagearc@users.noreply.github.com>
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…proposer (vllm-project#47460)

Signed-off-by: Alagappan Valliappan <avalliappan@nvidia.com>
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
… Blackwell (vllm-project#48167)

Signed-off-by: mgoin <mgoin64@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…2310)

Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
…LM shuffle (M%128) (vllm-project#46880)

Signed-off-by: Mike G <180722391+mikekg@users.noreply.github.com>
vllm-project#47881)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Signed-off-by: giuseppegrossi <ggrossi@amd.com>
… improvement (vllm-project#47463)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
…llm-project#47309)

Signed-off-by: liuruikang <liuruikang.cs@gmail.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matthew Bonanni <mbonanni@redhat.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
… as custom_class (vllm-project#48754)

Signed-off-by: mgoin <mgoin64@gmail.com>
…vllm-project#48519)

Signed-off-by: kliuae <kuanfu.liu@embeddedllm.com>
Co-authored-by: TJian <tunjian.tan@embeddedllm.com>
majian4work and others added 16 commits July 15, 2026 17:59
…roject#47677)

Signed-off-by: Ma Jian <jian1.ma@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Signed-off-by: maxyanghu <hyoung2991@gmail.com>
Co-authored-by: Roger Wang <hey@rogerw.io>
Co-authored-by: Shang Wang <shangw@nvidia.com>
Signed-off-by: brijrajk <22271048+brijrajk@users.noreply.github.com>
Signed-off-by: Mike G <180722391+mikekg@users.noreply.github.com>
Signed-off-by: Qiang Li <qiang.li2@amd.com>
Signed-off-by: qli88 <qiang.li2@amd.com>
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
…tized drafts (vllm-project#48068)

Signed-off-by: zixi-qi <zixi@inferact.ai>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t=False (vllm-project#48741)

Signed-off-by: Josephasafg <ajgard7@gmail.com>
Co-authored-by: Michael Gokhman <michael.gokhman@yahoo.com>
Signed-off-by: AmeenP <ameenp360@gmail.com>
Signed-off-by: AmeenP <ameen@primeintellect.ai>
Co-authored-by: AmeenP <ameen@primeintellect.ai>
Co-authored-by: Jee Jee Li <pandaleefree@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Pavani Majety <pmajety@nvidia.com>
Signed-off-by: charlifu <charlifu@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
…`test_bert_for_masked_lm` (vllm-project#48784)

Signed-off-by: Micah Williamson <micah.williamson@amd.com>
…arately from target (vllm-project#48787)

Signed-off-by: mgoin <mgoin64@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…Linear/QKVParallelLinear.load_weights

getattr(self, name, self) used the layer module itself as a "not found"
sentinel, so a checkpoint tensor with no matching registered param (e.g.
bias when the layer was built with bias=False, or a GPTQ exporter's g_idx
when desc_act=False) fell through the `param is None and name == "bias"`
guard for any name other than the literal string "bias" -- routing the
whole module into `param.weight_loader(param, loaded_weight, shard_id)`
and crashing with AttributeError deep inside weight_loader instead of
being skipped.

Reproduced while loading Qwen/Qwen1.5-MoE-A2.7B-Chat-GPTQ-Int4 (a real
GPTQ checkpoint that exports a per-layer g_idx even with desc_act=False,
and per-expert bias despite has_bias=False on the model side) via
--quantization moe_wna16.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Artur Fierka <artur.fierka@intel.com>
@github-actions

Copy link
Copy Markdown

👋 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.

PRs do not trigger a full CI run by default. 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.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.