Skip to content

[BUG] lm_head=True is rejected as "tied weights" on untied composite/VLM models whose nested text_config says tied, e.g. Qwen3-VL-30B-A3B (regression from 82ab6f1, #4184) #4369

Closed

Description

@Qubitium

Severity: medium. Status: confirmed at function level on the real config; A/B tested against 842d666. Kind: regression from 82ab6f1.

Where

  • gptqmodel/looper/module_looper.py:185-203: _config_declares_tied_embeddings.
  • gptqmodel/looper/module_looper.py:1392-1408: _lm_head_is_tied.
  • The error is raised at :1947.

Description

  • The new walker returns True if any nested text_config has tie_word_embeddings=True.
  • In transformers 5, the class-level _tied_weights_keys always contains lm_head.weight, so the "declared tied" branch is taken as well.
  • Qwen3-VL-30B-A3B-Instruct has top-level tie_word_embeddings=False. Its text_config defaults to True, but HF does not tie the weights: find_tied_parameters returns [].
  • The same false positive occurs after untie_word_embeddings(), which clears only the top-level flag, on any composite model whose text_config says tied.

Repro

import torch
from types import SimpleNamespace
from transformers import AutoConfig, AutoModelForImageTextToText
from gptqmodel.looper.module_looper import ModuleLooper
cfg = AutoConfig.from_pretrained("Qwen/Qwen3-VL-30B-A3B-Instruct")
with torch.device("meta"): m = AutoModelForImageTextToText.from_config(cfg)
m.tie_weights()
fake = SimpleNamespace(gptq_model=SimpleNamespace(model=m, lm_head="lm_head", turtle_model=None))
print(m.get_input_embeddings().weight is m.get_output_embeddings().weight,  # False
      ModuleLooper._lm_head_is_tied(fake))                                  # True at HEAD, False at 842d666
  • Expected: _lm_head_is_tied returns False, so quantize() with lm_head=True proceeds.
  • Actual: it raises NotImplementedError("quantization of lm_head layer with tied weights is not supported").
  • Suggestion: decide by actual storage identity (get_input_embeddings().weight vs get_output_embeddings().weight, or find_tied_parameters), not by nested config flags.

Found during an AI-assisted review (Claude Code, round 12) of def6e61; repros were run at that commit (A/B against 842d666 where noted) on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

Activity

  1. added
    bug
    on Nov 16, 2026
  2. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    Confirmed independently by a second reviewer. HF's get_expanded_tied_weights_keys() returns no lm_head key for Qwen3-VL-30B-A3B, because HF reads the top-level self.config.tie_word_embeddings.

    Cross-checks with the current code:

    • Qwen2.5-VL-7B and llava-next-8b: untied, return False. Correct.
    • gemma-3-4b and Qwen3-VL-2B: truly tied, return True. Correct, and an improvement over 842d666.

    So the fix only needs to read the same config HF ties from.

  3. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    Taking this. I'll investigate against current main, add a targeted regression test, and open a PR. Will report back here if the claim turns out to be invalid or already fixed.

  4. self-assigned this
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions