Skip to content

[BUG] Loading a QQQ checkpoint rounds s_group (fp16) and s_channel (fp32) through the model dtype: reloaded model is worse than in-session (Llama-3.2-1B PPL 35.28 → 36.97) #4458

Closed

Description

@Qubitium

Severity: medium. Kind: pre-existing, identical at def6e61. This is the load path; #4303/#4379 covered re-save. Confirmed at 489aed6 on an RTX 5090.

Repro

  1. Quantize any bf16 Llama/Qwen with QQQConfig(bits=4, group_size=128, desc_act=False, offload_to_disk=False).
  2. Record m.model.model.layers[0].self_attn.q_proj.s_group before save.
  3. Compare it with the same tensor after GPTQModel.load(out).

Result

  • The checkpoint is correct. Its tensors equal the in-session tensors bit-exactly.
  • The load rounds both scales. After loading into a bf16 model, s_group 17.546875 becomes 17.5 and s_channel 4.20998e-4 becomes 4.21524e-4. B is unchanged.
  • dtype=float16 only half-helps. Loading with it fixes s_group, but s_channel is still rounded.
model in-session PPL reloaded PPL
Llama-3.2-1B-Instruct 35.281 36.968 (+4.8%)
Qwen2.5-0.5B-Instruct 21.313 21.355

This is the same with AUTO (which picks QQQTorchLinear on sm_120) and with TORCH. Every other method tested (RTN, GPTQ variants, GPTAQ, FOEM, GSQ, AWQ, ParoQuant, MACaQ) gives an in-session PPL equal to its reload.

Cause

  • gptqmodel/models/loader.py:3355-3365: load_checkpoint_in_model_then_tie_weights(dtype=model_dtype) casts every float buffer. Only EXL3 gets restore_checkpoint_buffer_dtypes, and the QQQ scales are not in the keep-fp32 lists.
  • nn_modules/qlinear/qqq.py:406-407 later casts them back to fp32/fp16, but the bf16 rounding has already happened.

Expected: s_group and s_channel load at their checkpoint dtype.


Found during an AI-assisted review (Claude Code, round 13) of 489aed6; repros were run at that commit (A/B against def6e61 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

    A second reviewer confirmed this independently at 489aed6 on a Radeon AI PRO R9700, and on a CPU load. It isn't device-specific.

    Proof that the load path alone causes the loss (Llama-3.2-1B QQQ 4-bit g128, bf16, 80-window PPL):

    Model PPL
    default reload 37.378
    same loaded model, exact file scales written back into s_group / s_channel 34.352

    That is +8.8% from the load path alone.

    Extent:

    • All 224 QQQ scale tensors differ from the file, while still showing their original dtype.
    • Max relative error is 3.4e-3 for s_group and 1.3–1.8e-3 for s_channel.
    • s_group feeds round((code-8)*s_group) → int8, so the rounding changes the effective int8 weights.
    • The saved file is byte-identical to the in-session state dict.

    More precise location:

    • gptqmodel/utils/model.py:3270-3279 (load_checkpoint_in_model_then_tie_weights) restores the checkpoint dtype only for buffers named scales, plus the AWQ-torch bias and the bnb state.
    • models/loader.py:3365 enables restore_checkpoint_buffer_dtypes only for FORMAT.EXL3.
    • Adding s_channel/s_group, or enabling the restore for all formats, should fix it.

    (AI-assisted review, round 13 at 489aed6)

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions