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] #5032 (fix of #5010) incomplete: fail-closed load only requires qweight (GPTQ/AWQ) and QQQ buffers - a checkpoint missing scales/qzeros or any FP8/NF12/GGUF/Paro/VPTQ/BnB tensor loads into placeholders: NaN or wrong logits, BnB-4bit illegal memory access #5218
Found on main @ 396b5f0, RTX 5090 (sm_120), torch 2.15 + CUDA 13.2.
What is wrong
#5032 (fix of #5010) made GPTQModel.load fail closed when a checkpoint lacks a kernel's payload. Its contract (utils/model.py:3184-3201, validate_checkpoint_qweights) says: "A truncated checkpoint must raise, not corrupt the context." In practice only two declarations exist:
PackedGroupedQuantLinear.CHECKPOINT_REQUIRED_BUFFERS = ("qweight",) (nn_modules/qlinear/__init__.py:1276), for the GPTQ/AWQ family;
BaseQuantLinear defaults to (), so for GPTQ/AWQ the other tensors (scales, qzeros) are never checked, and the FP8, NF12, GGUF, BitsAndBytes, Paro, VPTQ, MACaQ and EXL3 kernels declare nothing. The dense guard (_raise_on_unmaterialized_checkpoint_parameters) skips quantized modules. So a checkpoint missing any of these tensors loads into the torch.empty/zero placeholder. Depending on the tensor, that gives silently wrong logits, NaN, an illegal memory access that poisons the CUDA context, or an unrelated device-mismatch error at the first forward.
Repro
For each format, quantize a 2-layer Qwen2.5-0.5B-Instruct with GPTQModel (fp16, default config), save() it, delete one tensor of one module (model.layers.0.self_attn.q_proj.<suffix>) from the safetensors file, then GPTQModel.load() it and run one forward. The forward is compared with the intact checkpoint's logits.
Make the declaration complete instead of "qweight only". Each kernel should list every checkpoint buffer it cannot rebuild:
PackedGroupedQuantLinear: qweight, scales, plus qzeros when the format stores zeros. g_idx stays optional.
TorchFP8Linear: weight, weight_scale_inv. NF12: nf12_packed, nf12_exp_base, nf12_escapes. GGUF: qweight. Paro: all of its packed/rotation tensors. VPTQ: indices, centroids.weight, ... BnB: weight plus the quant-state set. MACaQ and EXL3: their packed tensors.
Better still, derive the default from the module's persistent buffers/parameters that the checkpoint must provide, with an explicit opt-out list (as CHECKPOINT_OPTIONAL_EMPTY_BUFFERS already does for QQQ). New kernels would then fail closed by default.
Tests that should have caught it
tests/test_qqq_save_after_forward_5010.py covers QQQ and qweight only. Add a parametrized test over every saveable format that removes each tensor of one module and asserts GPTQModel.load raises the fail-closed ValueError.
Severity
Medium. A truncated or partially-copied checkpoint, or one from an interrupted upload or a third-party tool, silently gives NaN or wrong logits, or poisons the CUDA context. This is the failure class #5010/#5032 set out to close, and the docstring claims it is closed.
Agent claim:agent-4e3a0639ecaf is working on this issue now.
Started 2026-11-18T12:06:22Z. The claim expires 4.0h after this comment is last edited (heartbeat). Other agents: do not start this issue while the claim is live.
Scope: make fail-closed checkpoint loading complete: every quant kernel declares all checkpoint buffers it cannot rebuild (GPTQ/AWQ scales/qzeros, FP8, NF12, GGUF, BnB, Paro, VPTQ, MACaQ, EXL3), with a per-format truncated-checkpoint regression matrix
Agent claim released:agent-4e3a0639ecaf finished this issue.
PR: #5239 — base main, head fd289b753 (branch fix/5218-fail-closed-load), 13 files, +723/−20.
Fix
validate_checkpoint_qweights is now complete and presence-aware. Every kernel declares the checkpoint payload it cannot rebuild — GPTQ/AWQ/Marlin/BitBLAS qweight+scales+qzeros (plus g_idx when desc_act), FP8 weight+weight_scale_inv, NF12, GGUF, BnB (4/8-bit union), Paro, VPTQ (dotted codebook paths), MACaQ, TT blockfloat, EXL3 (both sign/codebook recipes), AllSpark — and the validator resolves each dotted suffix on the live module, skipping only tensors that instance never allocates (so a valid AllSpark/plain-MXFP4/plain-VPTQ load is not refused). Missing required tensors raise the existing Missing required quantized weights ... error naming the tensor.
Evidence
21-case per-kernel matrix (tests/test_fail_closed_checkpoint_5218.py): RED (implementation stashed) 20 failed, 2 passed, 1 skipped; GREEN 22 passed, 1 skipped (GPU 4), 21 passed, 2 skipped on CPU.
End-to-end FP8/NF12 quantize→save→drop-one-tensor→load cases fail closed with the module key in the message.
Not verified: BitBLAS (not installed), native CUDA kernels (GGUF/VPTQ/EXL3/BnB-CUDA) and inherited Marlin/Machete/Swordfish/ExLlamaV2/MLX were not separately constructed.
Activity
Qubitium commentedon Nov 18, 2026
Two more rows from the same sweep. Both load silently with wrong logits:
desc_act=True(Marlin)g_idxg_idxis not optional, soPackedGroupedQuantLinearshould require it whendesc_actis set.qzeros/scales🤖 Generated with Claude Code
Qubitium commentedon Nov 18, 2026
Agent claim:
agent-4e3a0639ecafis working on this issue now.Started 2026-11-18T12:06:22Z. The claim expires 4.0h after this comment is last edited (heartbeat). Other agents: do not start this issue while the claim is live.
Scope: make fail-closed checkpoint loading complete: every quant kernel declares all checkpoint buffers it cannot rebuild (GPTQ/AWQ scales/qzeros, FP8, NF12, GGUF, BnB, Paro, VPTQ, MACaQ, EXL3), with a per-format truncated-checkpoint regression matrix
fix(load): require every kernel's checkpoint payload (#5218) (#5239)
Qubitium commentedon Nov 18, 2026
Agent claim released:
agent-4e3a0639ecaffinished this issue.PR: #5239 — base
main, headfd289b753(branchfix/5218-fail-closed-load), 13 files, +723/−20.Fix
validate_checkpoint_qweightsis now complete and presence-aware. Every kernel declares the checkpoint payload it cannot rebuild — GPTQ/AWQ/Marlin/BitBLASqweight+scales+qzeros(plusg_idxwhendesc_act), FP8weight+weight_scale_inv, NF12, GGUF, BnB (4/8-bit union), Paro, VPTQ (dotted codebook paths), MACaQ, TT blockfloat, EXL3 (both sign/codebook recipes), AllSpark — and the validator resolves each dotted suffix on the live module, skipping only tensors that instance never allocates (so a valid AllSpark/plain-MXFP4/plain-VPTQ load is not refused). Missing required tensors raise the existingMissing required quantized weights ...error naming the tensor.Evidence
tests/test_fail_closed_checkpoint_5218.py): RED (implementation stashed) 20 failed, 2 passed, 1 skipped; GREEN 22 passed, 1 skipped (GPU 4), 21 passed, 2 skipped on CPU.uvx [email protected] check gptqmodel docs/eora tests setup.pyclean.Not verified: BitBLAS (not installed), native CUDA kernels (GGUF/VPTQ/EXL3/BnB-CUDA) and inherited Marlin/Machete/Swordfish/ExLlamaV2/MLX were not separately constructed.