Skip to content

[BUG] Re-saving a W4AFP8 checkpoint written with format=gptq_v2 adds +1 to every zero point, and the result no longer loads (regression from 08f1b2b / incomplete #4171) #4323

Closed

Description

@Qubitium

Severity: high (silent corruption of the re-saved checkpoint). Status: confirmed end-to-end on an RTX 4090. Kind: regression from 08f1b2b; incomplete fix of #4171 item 2.

Where

  1. gptqmodel/models/writer.py:913: _load_native_w4a_for_save uses model.load_state_dict(values, strict=False, assign=True).
  2. The new _incoming_qzeros_is_live check (nn_modules/qlinear/__init__.py:1666, used at :1758) runs after the copy. With assign=True the live buffer is the incoming tensor, so the check returns True and the conversion/relabel is skipped. The module therefore keeps runtime marker 1 while holding v2 words (same mechanism as [BUG] load_state_dict(..., assign=True) of v1 qzeros into a v2-runtime kernel skips the v1→v2 conversion: silent corruption (regression from 08f1b2b) #4304).
  3. The writer then applies _correct_gptq_v1_qzeros, which adds +1.
  4. The new "declare source layout" block (writer.py ~2536-2550) runs only in the non-W4A branch, so it does not prevent this.

Repro

from gptqmodel import GPTQModel, QuantizeConfig
cfg = QuantizeConfig(bits=4, group_size=128, sym=True, desc_act=False, activation="w4afp8", format="gptq_v2")
m = GPTQModel.load("meta-llama/Llama-3.2-1B-Instruct", quantize_config=cfg)
m.quantize(calib); m.save("a")
GPTQModel.load("a").save("b")
GPTQModel.load("b")   # raises

Actual:

  • All 112/112 qzeros tensors differ between a and b.
  • Loading b raises ValueError: W4AFP8 first release requires symmetric GPTQ zero point 8 in every group.

Expected: byte-identical qzeros. The format=gptq control run gives 0 changed tensors and the same NLL (2.5403).

Unit-level check: calling _load_native_w4a_for_save on a W4AFP8Linear or TorchLinear shell with format=GPTQ_V2 gives qzeros file==resave False and runtime marker 1.

At 9dad249 this path raised "Missing native W4A checkpoint tensors" instead, so the silent corruption is new.


Found during an AI-assisted review (Claude Code, round 11) of 842d666; repros were run at that commit 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

    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.

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