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] #5444 (fix of #5437) incomplete: per-module dynamic overrides skip every numeric check - damp_percent=nan/5.0/-1, damp_auto_increment<0, group_size=nan accepted; NaN damp silently replaced by Hessian floor and written as bare NaN into quantize_config.json #5503
Found on main @ c2e23c4, RTX 4090 + CPU (transformers 5.23.0).
What is wrong
#5444 (fix of #5437) says it rejects "NaN/inf in every numeric quantize option". It covers the top-level fields of each config class, and tests/test_config_numeric_validation_5437.py sweeps those fields. The same options set per module through dynamic are still not checked at all. Neither the finite check nor the existing range checks run on them:
BaseQuantizeConfig.__post_init__ / GPTQConfig.__post_init__ validate group_size, damp_percent (0 < x < 1) and damp_auto_increment (>= 0, finite) only on the top-level attributes.
The dynamic validators (_validate_dynamic_layer_keys, _validate_dynamic_boolean_overrides, _validate_dynamic_smoothers in quantization/config.py) check key names, bools and smoothers, but not numeric values. Only negative group_size is caught.
fromgptqmodel.quantizationimportconfigasCforkey, valin [("damp_percent", 5.0), ("damp_percent", -1.0), ("damp_percent", float("inf")),
("damp_auto_increment", -0.5), ("group_size", float("nan")), ("group_size", 100), ("group_size", -7)]:
try: C.GPTQConfig(bits=4, group_size=128, dynamic={"+:.*down_proj": {key: val}}); print("accepted", key, val)
exceptExceptionase: print("rejected", key, val)
# the same values as top-level fields are rejected:C.GPTQConfig(bits=4, damp_percent=float("nan")) # ValueError: `damp_percent` must between 0 and 1.
What happens at quantize time (Qwen2.5-0.5B-Instruct, 2-layer copy, GPTQ 4-bit g128, dynamic={"+:.*layers\.1\.mlp\.down_proj": {...}}, 16 C4 rows):
damp_percent=nan: calibration runs. Every damp-recovery attempt logs Starting compatible damp recovery at damp_percent=nan / Damp recovery failed after reaching damp_percent=nan, 7 times. The module is then rescued by the Hessian diagonal floor path (+5.14e-07 up to +5.14e-02), so this override is silently replaced by an unrelated floor. save() writes "dynamic": {"+:.*layers\\.1\\.mlp\\.down_proj": {"damp_percent": NaN}} into quantize_config.json. A bare NaN is not valid JSON, so strict parsers reject the file.
damp_percent=5.0: quantizes and saves with 5x the Hessian mean as damping on that module, with no warning. The same value at the top level is a ValueError.
group_size=nan / 100: accepted by the config, then fails in quantize() at select_quant_linear (... only supports [-1, 16, 32, ...] group_size: actual group_size = nan). That is loud, but it comes after load, not at config construction like the top-level field.
Suggested fix
Run the per-module override values through the same validators the top-level fields use: _validate_group_size plus the supported-set check, the damp_percent(0, 1) check, _validate_finite_float for damp_auto_increment, and, for Paro/MACaQ/VPTQ, the float options #5444 added. Do this in each class's _normalize_dynamic_layer_config, or by building the effective per-module config and validating it. Extend the #5437 sweep to put each numeric field into a dynamic rule as well.
Test that should have caught it
tests/test_config_numeric_validation_5437.py sweeps only the top-level fields. The same parametrization through dynamic={"+:.*": {field: nan}} would have failed.
Severity
Low to medium. A per-module override silently quantizes with an out-of-range damping, or replaces a NaN with the Hessian floor, and it persists non-standard JSON. RCO/automated recipes write dynamic rules programmatically, so a NaN from upstream arithmetic is plausible.
Activity
Qubitium commentedon Nov 19, 2026
Agent claim:
agent-root-5503-dynamic-numericis working on this issue now.