Skip to content

[BUG] #5316 (fix of #5307) incomplete: ParoConfig/MacaqConfig/VPTQConfig numeric options and group_size still accept NaN/inf - ParoConfig(opt_rotation_lr=nan) quantizes silently at +13.8% PPL, MacaqConfig(ridge=nan) silently disables the ridge #5437

Closed

Description

@Qubitium

Found on main @ 1405751, RTX 4090 (CUDA 13.2, torch 2.15, transformers 5.23.0).

What is wrong

#5316 (fix of #5307) added _validate_finite_float for MSEConfig, FOEMConfig, GPTAQConfig and HessianConfig only. Every other calibrated config still accepts NaN / inf in its numeric options and quantizes silently with the option effectively broken. A constructor-only sweep (each float field set to nan, inf, -1) on main accepts:

(MacaqConfig(bits=nan|inf|-1, group_size=...) is silently replaced by the default 4 / 32, which hides the user error the same way.)

Measured (Qwen2.5-0.5B-Instruct, 128 C4 docs, fp16, save -> reload -> wikitext-2 PPL 80x512)

config PPL
ParoConfig(bits=4, group_size=128) 19.590
ParoConfig(bits=4, group_size=128, opt_rotation_lr=float("nan")) 22.292 (+13.8%), no warning, finite logits
MacaqConfig() 22.528
MacaqConfig(ridge=float("nan")) 22.790 (+1.2%), no warning

Repro

import torch
from gptqmodel import GPTQModel, CalibrationConfig
from gptqmodel.quantization import config as C
for cfg in (C.ParoConfig(bits=4, group_size=128, opt_rotation_lr=float("nan")), C.MacaqConfig(ridge=float("nan")),
            C.VPTQConfig(npercent=float("nan")), C.RTNConfig(group_size=float("nan"))):
    print(type(cfg).__name__, "accepted")          # all four construct without error
m = GPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", C.ParoConfig(bits=4, group_size=128, opt_rotation_lr=float("nan")), dtype=torch.float16)
m.quantize(CalibrationConfig(dataset=c4_docs[:128]))  # completes silently; PPL 22.29 vs 19.59

Suggested fix

Apply the #5316 _validate_finite_float helper (finite + range) to every numeric field of ParoConfig, MacaqConfig, VPTQConfig, and to group_size on the base quantize config (an int, -1, or a positive divisor; reject float NaN/inf). Reject out-of-range MacaqConfig.bits/group_size instead of silently replacing them. A generic dataclass sweep test like the one above would keep new fields covered.

Test that should have caught it

tests/test_calibration_option_validation_5307.py lists four configs by hand. A parametrized sweep over every config dataclass's float fields (nan, inf, negative) would catch these.

Severity

Medium-low (user error input, but the failure is silent: up to +13.8% PPL with no warning, the #4953/#5307 class).

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 19, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim: agent-4e3a0639ecaf is working on this issue now.

    Started 2026-11-19T05:32:12Z. 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: Extend #5316 finite/range validation to ParoConfig, MacaqConfig and VPTQConfig numeric fields and to group_size, reject out-of-range Macaq bits/group_size instead of silently replacing them, and add a generic dataclass sweep test.

  2. Qubitium commented on Nov 19, 2026

    @Qubitium
    CollaboratorAuthor

    Released: #5444 merged as c990aad1b.

    What changed

    • gptqmodel/quantization/config.py: new _validate_group_size() rejects non-finite / non-integral values and normalizes 128.0 → 128; called from BaseQuantizeConfig.__post_init__, EXL3Config and MacaqConfig (which overwrite the value after the base check).
    • ParoConfig: all nine float options (rotation/finetune LRs, weight decay, eps, betas, SGD momentum/dampening, clamp bounds) now go through _validate_finite_float.
    • MacaqConfig: ridge validated finite; non-MXFP4 bits/group_size rejected (-1 still accepted as the "unset" sentinel); block_size forced to 32.
    • VPTQConfig: npercent finite; group_num, kmeans_iters, kmeans_seed, block_size type/range checked via _validate_smooth_int.
    • damp_auto_increment (GPTQ/QTQ/VPTQ) validated.

    Verification

    • New tests/test_config_numeric_validation_5437.py (29 tests, parametrized sweep over every numeric field of every QuantizeConfig subclass). On main before the fix: 27 failed / 2 passed. After: 29 passed.
    • NaN-accepting configs went from 13 → 0 (group_size accepted NaN for every config).
    • Regression: paro+macaq 344 passed, vptq 329 passed, config/serialization 203 passed; ruff clean.
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