Skip to content

[BUG] GPTAQ/FOEM crash on a non-invertible Hessian; unrouted MoE experts are zeroed with fallback disabled; NaN retry loses act-order #4179

Closed

Description

@Qubitium

Severity: medium
Version: 7.11.0 @ 6c3421c

1. GPTAQ / FOEM crash when hessian_inverse gives up

  • hessian_inverse returns (None, 1.0) after all damp and diagonal-floor attempts fail. Plain GPTQ handles that by falling back to RTN.
  • GPTAQ (quantization/gptaq.py:226-230) and FOEM (quantization/foem.py:271-275) dereference it and abort the whole run:
GPTAQ RAISED AttributeError 'NoneType' object has no attribute 'T'
FOEM  RAISED TypeError 'NoneType' object is not subscriptable
  • Trigger: e.g. one NaN or inf activation in calibration.
  • Fix: share GPTQ's RTN fallback.

2. A module with zero calibration samples is quantized to all zeros when fallback is disabled

  • With fallback=None or threshold=False, an unrouted MoE expert has H = 0. quantizer._neutralize_dead_columns (via gptq.py:2244-2250) then treats every column as dead, so the whole weight becomes 0.
  • The only signal is a WARN and loss 999999999. gptq_processor.py:684-688 itself calls this a hazard.
  • Fix: raise, or force RTN, when nsamples == 0.

3. NaN-loss mock retry loses act-order

  • retry_hessian_diag (gptq.py:2397-2401, :2626-2631) is captured after H has been permuted by desc_act / act_group_aware.
  • The retry rebuilds H = diag(permuted_diag) but clones W in natural order. argsort of an already-sorted diagonal is about the identity, so the retry quantizes in natural order (g_idx is not act-ordered).

4. GPTAQ / FOEM ignore act_group_aware and TP padding

  • act_group_aware defaults to True (config.py:~5465). GPTAQ and FOEM never apply it, but the saved meta still records act_group_aware=True.
  • They don't truncate _tp_pad_cols, so the reshape fails when TP padding is active.
  • FOEM's nsamples counts sequences, not tokens, so its loss isn't comparable with GPTQ's. GPTAQ already fixed this.

5. RTN scale floor below fp16 range

  • rtn.py:213-219 calls mse_optimal_quant without eps=SCALE_STORAGE_FLOOR. The default 1e-8 underflows to 0 when scales are stored as fp16. The GPTQ fallback passes the correct floor.
  • With SmoothRowCol, RTN also doesn't divide scale_min by the smoothing factor.

Found during an AI-assisted review (Claude Code) of 6c3421c; repros were run on RTX 4090/5090 (CUDA 13) and Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions