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] Config validation still silently accepts bad input (#4052 incomplete): 20+ bool fields take "False" as True (mock_quantization="False" runs the mock solver), and typo'd keys in dynamic overrides are ignored and persisted #4668
This is a follow-up on #4052 / #4057 ("reject silent kwarg drops", "bool fields reject strings"). The fix covers top-level kwargs and 8 base bool fields. Two parallel paths still accept bad input and silently change, or silently do not change, what gets quantized.
1. Most bool fields still accept "False" (and become True)
BaseQuantizeConfig._validate_bool_fields (gptqmodel/quantization/config.py:5197) checks only sym, true_sequential, lm_head, compile, offload_to_disk, keep_processor_logs, auto_forward_data_parallel, wait_for_submodule_finalizers. Every other bool field is either coerced with bool(x) (bool("False") is True) or stored as the string, which is truthy. Results of passing the string "False" to every bool field of every concrete config:
By contrast, GPTQConfig(exclude_attention_sinks="False") and GPTQConfig(sym="False") correctly raise TypeError.
This has a real effect. GPTQConfig(mock_quantization="False") turns on the "skip heavy computations" mock solver (quantization/gptq.py:1663,2446). Qwen2.5-0.5B-Instruct truncated to 2 layers, GPTQ 4-bit g128, 16 C4 rows, CPU:
static_groups="False" silently enables static groups in the same way.
2. Typo'd keys in dynamic overrides are silently ignored and persisted
_normalize_dynamic_layer_config (config.py:5120, plus the per-class overrides at 6791/7202/7317/7503/7640/7932) checks only the bits and group_size values. It does not check that the keys are known fields. A misspelled override is accepted, has no effect, and is written into the checkpoint:
model.layers.0.mlp.down_proj.qweight I32 [608, 896] # 4864*4/32 -> still 4-bit
model.layers.0.mlp.down_proj.scales F16 [38, 896] # 4864/128 -> still group 128
quantize_config.json dynamic: {'.*down_proj': {'bit': 8, 'group_sise': 32}}
nll 16.193 (identical to the run without `dynamic`); no warning logged
The same call with a top-level typo (GPTQConfig(bit=8)) raises TypeError with a close-match hint since #4057. Bad regexes (dynamic={"+:[": {...}}) are also accepted at construction and fail only later, when the pattern is first matched.
Suggested fix
Derive the bool set from the dataclass annotations (every field typed bool / Optional[bool]) and run _validate_bool_fields over all of them, in every concrete __post_init__, including EXL3/MACaQ/Paro, which override it.
In _normalize_dynamic_layer_config, reject keys that are not init fields of the target config class. Reuse the difflib close-match hint from _validate_quantize_config_factory_kwargs. Also re.compile each pattern (after stripping +:/-:) at construction. from_quant_config can stay lenient for legacy checkpoints, as it does for top-level keys.
Tests that should have caught it
tests/qcfg/test_config_serialization.py ("bool fields reject strings and ints") enumerates a fixed field list instead of every bool field. No test covers unknown keys inside dynamic.
Severity
Medium. Configs built from YAML, CLI or JSON strings silently quantize with a different algorithm. Misspelled per-module overrides silently produce a different mixed-precision layout than the one requested.
Claimed. Both paths: derive the bool set from the dataclass annotations so every bool field rejects strings (including EXL3/MACaQ/Paro overrides), and reject unknown keys in dynamic overrides with the same difflib close-match hint as top-level kwargs. Fix PR to follow.
Activity
Qubitium commentedon Nov 17, 2026
Claimed. Both paths: derive the bool set from the dataclass annotations so every bool field rejects strings (including EXL3/MACaQ/Paro overrides), and reject unknown keys in
dynamicoverrides with the same difflib close-match hint as top-level kwargs. Fix PR to follow.fix(protocol): reject coerced booleans and unknown keys instead of dr…
fix(quantization): validate embedding quant config before replay (#5124)
fix(quantization): validate embedding quant config before replay (#5124…
fix(config): reject bad bool values and unknown `dynamic` keys (Model…