Repository navigation
Description
Summary
PR #690 adds Gemma 4 per-module quantization override support for the #683 frontier variants. The implementation intentionally accepts arbitrary flattened keys under config.quantization and applies an override only when the matching value is an object with unsigned-integer group_size and/or bits. Malformed values, wrong scalar types, negative values, and typoed prefixes currently fall back to the root defaults without a direct diagnostic.
Problem
This is not a security issue because model configs are local/trusted inputs, but it is a debugging hazard for quantization frontier work. A typo in a key such as language_model.model.layers.0.mlp.gate_proj, or a string value like "bits": "4", can silently route the loader through the root (group_size, bits) and leave the user to infer the mistake from downstream shape reconciliation warnings, load failures, or degraded quality.
Proposed fix
When an exact per-module override key is present but malformed, emit an actionable warning or return a load-time error before constructing the affected projection. At minimum, diagnose non-object override values, non-integer group_size/bits, unsupported bit widths, and non-positive group sizes. Prefer a focused helper around QuantizationArgs::quant_params_for() so future model paths that reuse the override map get the same behavior.
Acceptance criteria
- Gemma 4 config parsing reports an actionable diagnostic when an override value is not an object.
- Gemma 4 config parsing reports an actionable diagnostic when
group_sizeorbitsis present with the wrong type, negative value, zero group size, or unsupported bit width. - Valid root-only quantization configs and valid per-module overrides continue to load unchanged.
- Add unit coverage for valid overrides, malformed override values, and typo/wrong-type cases.
- The diagnostic mentions the offending override key/prefix.
Activity
fix(gemma4): diagnose malformed per-module quant overrides (#695)
fix(gemma4): diagnose malformed per-module quant overrides (lablup#695)