You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[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
Severity: medium (silent corruption). Status: confirmed by repro. Kind: regression from 08f1b2b (the #4166 fix).
Where
gptqmodel/nn_modules/qlinear/__init__.py:1758: elif not self._incoming_qzeros_is_live(...) (helper at :1666).
Cause
The "is live" check runs after super()._load_from_state_dict.
With assign=True, the incoming checkpoint tensor has already become self.qzeros at that point, so incoming is live is true.
The loaded tensor is therefore treated as an accelerate refill, and the v1→v2 conversion is skipped.
torch DCP set_model_state_dict also uses assign=True for meta-device models, so it is affected too.
Repro
importsafetensors.torchfromgptqmodelimportGPTQModel, BACKENDckpt="<local GPTQ v1 checkpoint dir, e.g. a Llama-3.2-1B-Instruct GPTQ 4bit g128>"m=GPTQModel.load(ckpt, backend=BACKEND.TORCH) # PPL 9.57sd= {k: v.cuda() fork, vinsafetensors.torch.load_file(f"{ckpt}/model.safetensors").items() ifk.endswith("qzeros")}
m.model.load_state_dict(sd, strict=False) # PPL 9.57; words converted 0x77777777 -> 0x88888888m.model.load_state_dict(sd, strict=False, assign=True) # PPL 1,206,986; words stay 0x77777777
Expected: both calls give the same result.
Before the regression: at 08f1b2b~1, assign=True gives PPL 9.57.
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.
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.
A second trigger without assign=True (confirmed at 842d666 by another reviewer):
nn_modules/qlinear/__init__.py:1752 checks if layout_code != self._runtime_qzeros_format(): self._restore_qzeros_format(layout_code). This compares the incoming marker against the receiver's live layout from before the copy, not against the layout the kernel decodes.
A freshly constructed module always has _qzeros_format = 1 (constructor ~1367). That includes TorchLinear, Triton, TorchFused, Machete, W4A and the other kernels that decode v2.
So an incoming qzeros_format=1 payload is treated as already matching, and the v1 words are never converted.
Any module loaded from a v1 gptq checkpoint emits marker 1, so copying its state_dict() into a fresh module triggers this.
Activity
Qubitium commentedon Nov 16, 2026
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.Qubitium commentedon Nov 16, 2026
A second trigger without
assign=True(confirmed at842d666by another reviewer):nn_modules/qlinear/__init__.py:1752checksif layout_code != self._runtime_qzeros_format(): self._restore_qzeros_format(layout_code). This compares the incoming marker against the receiver's live layout from before the copy, not against the layout the kernel decodes._qzeros_format = 1(constructor ~1367). That includes TorchLinear, Triton, TorchFused, Machete, W4A and the other kernels that decode v2.qzeros_format=1payload is treated as already matching, and the v1 words are never converted.gptqcheckpoint emits marker 1, so copying itsstate_dict()into a fresh module triggers this.fresh.qzero_format()stays 1.9dad249: 2.5e-4.TorchLinear(format=GPTQ).pack()→state_dict()→ freshTorchLineargives error 0.15.This re-breaks the v1↔v2 state_dict copy contract fixed in #4070/#4091. The same
assign=Truemechanism also corrupts W4AFP8gptq_v2re-saves (#4323).fix: convert v1 qzeros on assign=True state dict loads (#4304) (#4330)
fix(w4a): declare the source qzero layout before a native re-save (#4323