[NVFP4 MoE/Deepseek V4] Marlin: wire SwiGLU clamp + allow it for clamped models on non-Blackwell (#45836)
Signed-off-by: Mike G <180722391+mikekg@users.noreply.github.com>
Mike G committed
Jun 23, 2026 at 12:21 UTC
0775b882ba22572f851a439a705ef42b156051d8
2 files changed
+4
vllm/model_executor/layers/fused_moe/config.py
+2
@@ -861,6 +861,7 @@ def nvfp4_w4a16_moe_quant_config(
861
g2_alphas: torch.Tensor,
862
w1_scale: torch.Tensor,
863
w2_scale: torch.Tensor,
864
+ gemm1_clamp_limit: float | None = None,
865
) -> FusedMoEQuantConfig:
866
"""
867
Construct a quant config for 16-but activations and nvp4 weights.
@@ -872,6 +873,7 @@ def nvfp4_w4a16_moe_quant_config(
873
g1_alphas=g1_alphas,
874
g2_alphas=g2_alphas,
875
weight_dtype="nvfp4",
876
+ gemm1_clamp_limit=gemm1_clamp_limit,
877
)
878
879
vllm/model_executor/layers/fused_moe/oracle/nvfp4.py
+2
@@ -174,6 +174,7 @@ def select_nvfp4_moe_backend(
174
175
NVFP4_BACKENDS_WITH_CLAMP = {
176
NvFp4MoeBackend.FLASHINFER_TRTLLM,
177
+ NvFp4MoeBackend.MARLIN,
178
}
179
180
if config.swiglu_limit is not None:
@@ -423,6 +424,7 @@ def make_nvfp4_moe_quant_config(
424
g2_alphas=w2_scale_2,
425
w1_scale=w13_scale,
426
w2_scale=w2_scale,
427
+ gemm1_clamp_limit=swiglu_limit,
428
)
429
elif backend == NvFp4MoeBackend.EMULATION:
430
return nvfp4_moe_quant_config(