From 34c286b8115e2b5812f6271a2c102eba88bba45b Mon Sep 17 00:00:00 2001 From: b8zhong Date: Thu, 30 Oct 2025 20:14:49 -0700 Subject: [PATCH] Fix the shared expert & routed expert overlap in Llama 4 (#12405) Co-authored-by: Brayden Zhong --- python/sglang/srt/models/llama4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sglang/srt/models/llama4.py b/python/sglang/srt/models/llama4.py index 2d2a60730..bbcdebfb9 100644 --- a/python/sglang/srt/models/llama4.py +++ b/python/sglang/srt/models/llama4.py @@ -148,7 +148,7 @@ class Llama4MoE(nn.Module): return out_aD def _forward_core(self, hidden_states, forward_mode: ForwardMode): - if hidden_states.shape[0] < 4 and _is_cuda: + if _is_cuda: return self._forward_core_shared_routed_overlap(hidden_states) else: return self._forward_core_normal(hidden_states)