[Bugfix] Fall back to auto for unquantized MoE layers when --moe-backend is marlin (#60219)

Signed-off-by: Vadim Gimpelson <vadim.gimpelson@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Vadim Gimpelson
2026-10-13 08:48:13 +00:00
committed by GitHub
co-authored by Claude
parent 6f11c220b5
commit 183625d4f9
2 changed files with 18 additions and 3 deletions
@@ -626,3 +626,17 @@ def test_select_explicit_triton_backend(is_lora_enabled):
assert selected_backend == UnquantizedMoeBackend.TRITON
assert experts_cls is not None
@skipif_not_cuda_rocm
@pytest.mark.parametrize("moe_backend", ["humming", "marlin"])
def test_quantization_only_backend_falls_back_to_auto(moe_backend):
"""A quantization-only --moe-backend also reaches the unquantized MoE
layers of a quantized model (e.g. a BF16 MTP draft), which must use the
auto-selected backend instead of failing."""
moe_config = make_dummy_moe_config()
moe_config.moe_backend = moe_backend
assert select_unquantized_moe_backend(
moe_config=moe_config
) == select_unquantized_moe_backend(moe_config=make_dummy_moe_config())
@@ -303,9 +303,10 @@ def select_unquantized_moe_backend(
)
runner_backend = moe_config.moe_backend
# 'humming' is quantization-only; an unquantized layer (e.g. excluded via
# modules_to_not_convert) falls through to auto instead of erroring.
if runner_backend not in ["auto", "humming"]:
# 'humming' and 'marlin' are quantization-only; an unquantized layer (e.g.
# excluded via modules_to_not_convert, or an unquantized MTP draft of a
# quantized model) falls through to auto instead of erroring.
if runner_backend not in ["auto", "humming", "marlin"]:
requested_backend = map_unquantized_backend(runner_backend)
if (
activation_format == mk.FusedMoEActivationFormat.BatchedExperts