Skip to content

[QUALITY] Falcon-H1 AWQ (now runs after #4703) falls back to RTN for q/k/v + mamba.in_proj in every layer: input_layernorm group's replay boundary is self_attn, which excludes mamba.in_proj #4741

Closed

Description

@Qubitium

Found on main @ b225a43, RTX 4090 (sm_89, CUDA 13.2, torch 2.15, transformers 5.22.1).

What is wrong

#4703 (fix for #4679) removed the AWQ crash on Falcon-H1, so AWQ now runs to completion. It still does not apply AWQ to the largest group in each layer. The Falcon-H1 tree (gptqmodel/models/definitions/falcon_h1.py:22-29) declares attention and the Mamba mixer as parallel branches of input_layernorm:

"self_attn": ("q_proj:0:in=x", "k_proj:0:in=x", "v_proj:0:in=x", "o_proj:1"),
"mamba": ("in_proj:0:in=x:nosrc", "out_proj:1", "conv1d:!"),

The scaling group is therefore input_layernorm -> [q_proj, k_proj, v_proj, mamba.in_proj]. However, the group's replay boundary (module2inspect) is self_attn. _validate_scale_group (gptqmodel/looper/awq_processor.py:2985-2988) rejects it because mamba.in_proj is outside that boundary. _AWQScaleGroupError then sends the whole group to the plain-quantization fallback in every layer:

AWQProcessor: layer 0 using configured plain-quantization fallback for ['self_attn.q_proj', 'self_attn.k_proj', 'self_attn.v_proj', 'mamba.in_proj']: AWQ: replay boundary `self_attn` does not contain targets ['mamba.in_proj'] for source `input_layernorm`; a matching replay input and boundary are required.
AWQProcessor: layer 0 fallback quant 4 modules: ['self_attn.q_proj', 'mamba.in_proj', 'self_attn.v_proj', 'self_attn.k_proj']
AWQProcessor: layer 1 ... (same)

As a result, an "AWQ" Falcon-H1 checkpoint has RTN q/k/v and RTN mamba.in_proj in every layer. mamba.in_proj is the largest projection of the mixer. The only signal is one warning per layer.

A second, harmless symptom: the search also runs a mamba.conv1d -> [mamba.out_proj] group, and apply_scale then discards it (AWQ: skipping scale group mamba.conv1d -> ('mamba.out_proj',): Conv1d is not a foldable scale source). The scale search for it is wasted work. The tree comment already says the SSM between in_proj and out_proj is not homogeneous, so this group should never be built.

Repro

Falcon-H1-3B-Instruct truncated to 2 layers (num_hidden_layers=2, real weights), 16 C4 rows, batch_size=1:

from gptqmodel import GPTQModel
from gptqmodel.quantization.config import AWQConfig, CalibrationConfig
m = GPTQModel.load("Falcon-H1-3B-Instruct (2 layers)", AWQConfig(bits=4, group_size=128), dtype=torch.bfloat16)
m.quantize(CalibrationConfig(dataset=c4_rows[:16], batch_size=1))

Scale groups that reached _search_best_scale, as (prev_op, members, first member), plus the log above:

('input_layernorm', 4, 'self_attn.q_proj')     -> rejected by the boundary check -> RTN
('mamba.conv1d', 1, 'mamba.out_proj')         -> searched, then skipped at apply
('pre_ff_layernorm', 2, 'feed_forward.gate_proj')
('feed_forward.up_proj', 1, 'feed_forward.down_proj')

Suggested fix

For a source whose consumers live in several sibling branches (parallel attention + mixer, here and in any other :in=x group that spans sub-modules), use the decoder layer, or the nearest common ancestor of all targets, as module2inspect. Alternatively, split the group: scale q/k/v against the self_attn boundary and fold the same scale into mamba.in_proj as a fold-only member (the #4720 fold_layers mechanism). The norm output feeds both branches, so in_proj must receive the folded scale. Also drop the conv1d -> out_proj group when the scaling groups are built.

Test that should have caught it

tests/test_subset_declared_order_4679.py only checks that the feed_forward siblings capture inputs. Add an AWQ Falcon-H1 check, a tiny random config with 1-2 layers, that asserts no member of the input_layernorm group appears in fallback quant, and that mamba.in_proj / q_proj get a non-trivial scale.

Severity

Medium (silent quality loss). Falcon-H1 AWQ quantizes q/k/v and mamba.in_proj with RTN in every layer, but labels the checkpoint AWQ.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-53ba17eb4d83 finished this issue.

    Pull request: #4772

    Falcon-H1 AWQ fold: input_layernorm -> mamba.in_proj replay boundary

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