Skip to content

Declare AWQ fold sources and consumers per layer variant #5995

Done

Description

@devin-ai-integration

Why this keeps recurring

An AWQ fold divides a source output by a channel scale and compensates its consumers. The full-precision layer must still compute the same output. The generic planner selects candidate sources using the ordered module tree, widths and tags. A same-width projection on another branch can satisfy those checks. Model definitions then have to remove individual candidates or suppress all groups. Generic source selection

Two landed fixes illustrate the cost. LFM3 allows the operator-norm fold on convolution layers and excludes it on gated attention layers. PanGu’s final block feeds query embeddings to Q while K and V still read the norm. Inkling excludes two attention folds from the generic plan and retains per-expert groups. A blanket empty plan avoids the bad folds but also loses qualified scale search. These cases have fixes on main. LFM3 #5978 · PanGu, Inkling and Nemotron-H #5980

Proposed contract and migration

Let a definition declare each qualified fold for a concrete layer variant using its source path, scaled target paths and any additional consumers requiring compensation. Keep the module tree responsible for quantization order and coverage. Resolve the declaration against the constructed layer before search or weight mutation. Reject a malformed declaration with the layer and offending path. A variant with no qualified fold can explicitly use plain quantization. Keep the existing search, replay and packing interfaces.

Pilot the declaration in PanGu and Inkling. Translate the resolved paths into the existing scaling nodes, retaining their capture and replay inputs. Run the current per-definition filters as comparison oracles during migration. Remove a migrated filter once emitted groups, observed targets and full-layer outputs agree. Other definitions can migrate independently.

Acceptance criteria

  • On PanGu, assert the ordinary block includes Q/K/V and the top-query block includes K/V in the norm fold. Supply the real custom query, apply nonuniform scales and compare the entire pre-quantization block output with the untouched block.
  • On Inkling, assert the expected per-expert groups are present and exercise their targets. Keep the existing negative controls that deliberately apply each excluded attention fold and measure output drift. An empty plan must fail the positive case. Inkling conformance tests
  • Reorder independent siblings without changing the forward and require identical resolved fold edges. Supply an unresolved target or conflicting sources and require failure before mutation. On a plain-only variant, verify supported linears still quantize and pack.

@Qubitium

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