Skip to content

bug(gemma4): diagnose malformed per-module quant overrides #691

Closed

Description

@inureyes

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_size or bits is 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.

Related

Activity

  1. added
    status:ready
    type:bug
    priority:low
    area:models
    on Jul 8, 2026
  2. self-assigned this
    on Jul 8, 2026
  3. added
    status:in-progress
    status:review
    status:done
    and removed
    status:ready
    status:in-progress
    status:review
    on Jul 8, 2026
  4. added a commit that references this issue on Jul 8, 2026
    cc19322
  5. added a commit that references this issue on Oct 27, 2026
    c665a78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:modelspriority:lowstatus:donetype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions