Skip to content

[BUG] Subset early-stop fires on the declared-last module: Falcon-H1 feed_forward.gate_proj (runs after up_proj) gets 0 samples -> GPTQ silently RTN, AWQ crashes; same for bailing_hybrid self_attn.g_proj #4679

Closed

Description

@Qubitium

Found on main @ 12c1273, AMD R9700 (ROCm 10.1) + CPU.

What is wrong

The subset capture stops the layer forward as soon as the last declared module of the subset runs. looper/stage_subset.py:1043-1069 sets is_last = idx == subset_size - 1, then forward_hook_last = True, and HookedLinear raises StopForward (nn_modules/hooked_linear.py:229/291). This assumes the declaration order of a subset matches the order HF calls the modules. When a sibling of the same subset runs after the declared-last one, it never sees an activation:

  • Falcon-H1 (definitions/falcon_h1.py: "feed_forward": ("gate_proj:0", "up_proj:0", "down_proj:1")). FalconH1MLP.forward is y = self.up_proj(x) * self.act_fn(self.gate_proj(x) * self.gate_multiplier), so up_proj runs first, the forward stops, and gate_proj gets 0 samples in every layer.
  • bailing_hybrid, native layout (definitions/bailing_moe.py, self_attn branch: q,k,v,g_proj,kv_a_proj_with_mqa,forget_gate.f_proj,b_proj all :0). BailingHybridDeltaAttention.forward calls q/k/v (line 696), forget_gate (732), b_proj (733), and only then g_proj (762). b_proj is the declared-last member present, so self_attn.g_proj gets 0 samples on every linear-attention layer.

Effect:

  • GPTQ silently falls back to RTN for that projection in every layer:
    WARN  Quantization: Module `feed_forward.gate_proj` -> no calibration samples reached this module; forcing `rtn` fallback quantization instead of quantizing a zero Hessian.
    
  • AWQ crashes on Falcon-H1 at any batch size. The empty gate_proj feature (mode: 'empty') is still passed to the clip search:
    File "gptqmodel/looper/awq_processor.py", line 2681, in _quantize_layer
      clip_list = self._search_best_clip(
    File "gptqmodel/looper/awq_processor.py", line 3179, in _compute_best_clip
      input_feat = input_feat.view(-1, input_feat.shape[-1])
    RuntimeError: cannot reshape tensor of 0 elements into shape [-1, 0] because the unspecified dimension size -1 can be any value and is ambiguous
    
    Feature stats right before the clip search (layer 0, Falcon-H1-3B-Instruct):
    feed_forward.gate_proj (0,)            {'mode': 'empty', 'raw_tokens': 0}
    feed_forward.up_proj   (1, 377, 2560)  {'mode': 'token_rows', 'raw_tokens': 9255, ...}
    

Repro

from gptqmodel import GPTQModel
from gptqmodel.quantization import config as C
# 32 C4 rows of ~1200 chars
m = GPTQModel.load("tiiuae/Falcon-H1-3B-Instruct", C.GPTQConfig(bits=4, group_size=128))
m.quantize(rows)   # -> "feed_forward.gate_proj -> no calibration samples reached this module; forcing rtn" for every layer
m = GPTQModel.load("tiiuae/Falcon-H1-3B-Instruct", C.AWQConfig(bits=4, group_size=128))
m.quantize(rows)   # -> RuntimeError in _compute_best_clip (batch_size 1 and 4)

This was run on Falcon-H1-3B-Instruct truncated to 2 layers (real weights). For bailing_hybrid, a tiny native BailingHybridForCausalLM + GPTQConfig logs self_attn.g_proj -> no calibration samples reached this module; forcing rtn on every layer.

A generic probe: hook every nn.Linear in a decoder layer, run one forward, and check per subset whether any member runs after the declared-last member. It flags exactly these two definitions across the 92 registered families whose tiny model builds: falcon_h1 (last=feed_forward.up_proj starved=[feed_forward.gate_proj]) and bailing_hybrid (last=self_attn.b_proj starved=[self_attn.g_proj]). The same probe on the real Falcon-H1-3B-Instruct config reports the same.

Suggested fix

Do not decide the stopping module from declaration order. Stop only once every hooked module of the subset has fired: keep a per-subset countdown of distinct members seen, and raise StopForward when it reaches zero. Alternatively, record the execution order in a probe forward and mark the module that actually runs last. The definition-level workaround is to declare up_proj before gate_proj (Falcon-H1) and g_proj last (bailing_hybrid), but that silently breaks again whenever an upstream forward is reordered. Separately, AWQ _search_best_clip should skip modules whose feature mode is empty instead of crashing.

Test that should have caught it

A per-family "every declared module receives calibration samples" check: quantize a tiny model and assert there are no no calibration samples reached this module warnings for dense (non-expert) modules. The existing data-flow probe (#4372/#4427) checks producer/consumer order across subsets, but not the call order inside a subset.

Severity

Medium-high. Falcon-H1 GPTQ silently ships RTN gate_proj in every layer (1/3 of the MLP weights), and Falcon-H1 AWQ cannot run at all. bailing_hybrid native GPTQ/AWQ loses calibration for the output-gate projection of every linear-attention layer.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Claimed by an AI agent. Will reproduce on CPU, fix, add a focused regression test, and open a PR.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions