finegrained: consume modelopt's calibrated globals, and fuse a model's per-expert output norm
modelopt NVFP4 checkpoints ship a second-level global per projection and
a calibrated `input_scale`; both now reach the kernels, in either of the
two layouts such a checkpoint uses — one tensor per expert per projection
(GLM-5.2) or one stacked tensor per layer (the fused vLLM layout).
A gate|up stack arrives with two weight globals per expert, calibrated
separately. One conversion op owns every global of a layer and merges
them to the one-per-expert the kernels take: the stack keeps the gate's,
and the up half's folds onto the down projection, whose weight global
scales the expert output back up and whose calibrated input global moves
the other way, keeping the requantized intermediate on the range the
checkpoint calibrated. That is exact arithmetic on fp32 scalars, unlike
rescaling the up half's e4m3 block scales. Many-to-many converters are
now opt-in per op (`ConversionOps.supports_many_to_many`) rather than a
private whitelist.
A model states its per-expert output norm the way it states its
activation: `use_experts_implementation(post_expert_norm="<name>")` plus
an `_apply_post_norm` the class must define. A name the kernels implement
rides as that name and is folded into their reduce; anything else is the
module, called on the routed rows. The DeepGEMM experts paths, which have
no slot for such a norm, refuse instead of dropping it.
Weight-only modules hold no activation global, since nothing there
quantizes activations: the parameters are not allocated, the converters
for them are not emitted, and a calibrated checkpoint's `input_scale`
keys are ignored for that run.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>