Skip to content

[BUG] AWQ export / vLLM + SGLang interop: regex -: dynamic exclusions are written verbatim into modules_to_not_convert, so vLLM crashes at load and SGLang silently loads the excluded layers wrong #6190

Done

Description

@Qubitium

Summary

An AWQ checkpoint that excludes modules with a regex -: rule, written in the style the docs use (-:.*\.20\.mlp\.experts(\.|$) in docs/support-matrix.md, or -:.*\.5\.self_attn\..*), publishes the raw regex in quantization_config.modules_to_not_convert:

'dynamic': {'-:.*\\.5\\.self_attn\\..*': {}},
'modules_to_not_convert': ['.*\\.5\\.self_attn\\..*'],

vLLM (is_layer_skipped(..., match_mode="substring")) and SGLang (is_layer_skipped_awq: module_name in prefix) both treat modules_to_not_convert as plain substrings, not regexes. The pattern never matches model.layers.5.self_attn.q_proj, so both engines build AWQ layers for modules whose checkpoint tensors are dense weights.

Writing the key also turns off vLLM's own fallback. When modules_to_not_convert is absent, AutoAWQConfig.maybe_update_config finds the unquantized layers from the safetensors dtypes. When the key is present, it returns early. So the same checkpoint with no modules_to_not_convert loads correctly in vLLM, and the exported regex is what breaks it.

  • vLLM 0.34: engine start fails in weight loading: AttributeError: 'QKVParallelLinear' object has no attribute 'data' (linear.py:1259 weight_loader).
  • SGLang 0.5.23: no error. Layer-5 attention is left as an AWQ layer with no qweight loaded, so the output is wrong without any warning. PPL is 26.88 against 25.35 in GPT-QModel.

GPTQ checkpoints are not affected because vLLM/SGLang evaluate GPTQ dynamic as regexes. Only the AWQ modules_to_not_convert mirror is wrong.

Introduced by

85f18c0 (#4034, the fix for #4013), which added excluded_module_patterns() / modules_to_not_convert to the AWQ payload. _unescape_module_pattern (later) converts only pure-literal escaped names back to plain names. Any pattern with regex syntax is still exported verbatim, and tests/test_checkpoint_compat.py::test_awq_dynamic_exclusions_are_written_to_modules_to_not_convert asserts this (".*mlp.down_proj$"). Still present at HEAD 9123364.

Location

gptqmodel/quantization/config.py:4404-4423 (_dynamic_exclusion_patterns) and :8946-8952 (AWQConfig._update_output_payload), HEAD 9123364:

        raw = pattern[2:]
        ...
        literal = _unescape_module_pattern(raw)
        exported = raw if literal is None else literal     # regex exported as-is
        excluded = self.excluded_module_patterns()
        if excluded:
            out["modules_to_not_convert"] = excluded

docs/checkpoint-interop.md says: "-: exclusions are written to modules_to_not_convert as plain module names ... so substring-matching consumers such as vLLM can skip them". That is true only for literal rules.

Reproduction (ran it: RTX 4090, GPT-QModel HEAD 9123364, vLLM 0.34.0, SGLang 0.5.23)

from datasets import load_dataset
from gptqmodel import GPTQModel, AWQConfig, CalibrationConfig
ds = load_dataset("allenai/c4", data_files="en/c4-train.00001-of-01024.json.gz", split="train")
calib = [r["text"] for r in ds.select(range(512)) if len(r["text"]) > 300][:128]
cfg = AWQConfig(bits=4, group_size=128, sym=False, dynamic={r"-:.*\.5\.self_attn\..*": {}})
m = GPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", cfg)
m.quantize(CalibrationConfig(dataset=calib, batch_size=4))
m.save("qwen25_awq_excl")
from vllm import LLM
LLM(model="qwen25_awq_excl", enforce_eager=True, max_model_len=2048)
# AttributeError: 'QKVParallelLinear' object has no attribute 'data'
# RuntimeError: Engine core initialization failed.

Wikitext-2 test PPL (20 x 512 tokens; vLLM/SGLang prompt logprobs vs GPT-QModel's own forward). The tensors are identical in every row. Only modules_to_not_convert in config.json/quantize_config.json was edited:

modules_to_not_convert vLLM SGLang GPT-QModel
as saved: ['.*\\.5\\.self_attn\\..*'] crash at engine init 26.875 (silent, no warning) 25.346
['model.layers.5.self_attn'] (plain name) 25.369 25.325 25.346
key removed 25.370 - 25.346

The MoE form documented in docs/support-matrix.md (-:.*\.20\.mlp\.experts(\.|$)) goes through the same code path for AWQ checkpoints.

Expected vs actual

Expected: an AWQ checkpoint with -: exclusions loads in vLLM and SGLang with the excluded modules dense, as the docs describe. Actual: any exclusion written as a regex is exported verbatim. vLLM refuses to start, and SGLang silently runs the excluded layers as uninitialized AWQ layers.

Suggested fix

At save time, write the concrete names of the modules that the -: rules actually excluded (the writer knows them: they are the modules that stayed dense), e.g. ["model.layers.5.self_attn.q_proj", ...] or their common parent. Do not write the regex text. Plain names work in all three consumers: HF (should_convert_module prefix/regex match), vLLM and SGLang (substring). The regex stays in dynamic for GPT-QModel's own reload. If concrete names cannot be computed, omitting modules_to_not_convert is better than writing a regex, because vLLM then autodetects the dense layers from the safetensors dtypes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions