Routed expert

Gate projection

×

Map 6,144 input features to 2,048 gate features.

g=xffnWgate,i{\htmlData{light=g gate}{g}}={\htmlData{light=x}{x_{\mathrm{ffn}}}}W_{\mathrm{gate},i}
in
xffnx_{\mathrm{ffn}} [B batch, T positions, 6144 d]
out
gg [B batch, T positions, 2048 expert d_ff]
Parameters12,582,912 × 3,456 experts

12,582,912 parameters per instance.

ComponentCalculationParameters
Weight matrix6,144 × 2,04812,582,912

This projection has no bias parameter.

The reference module holds the weight output by input, [out, in].

One in each of 3,456 experts: 384 in each of 9 global layers.

Sources

In codeself.gate_proj(x) · 132

Open pinned code ↗

Direct evidence

The MLP and every expert is a SwiGLU: down(act(gate x) · up x), without biases.

modeling_mimo_v2.py 120–132 ↗ · XiaomiMiMo/MiMo-V2.6-Pro-RL @ b61f21852680

Excerpt
class MiMoV2MLP(nn.Module):
    def __init__(self, config, intermediate_size=None):
        super().__init__()
        self.config = config
        self.hidden_size = config.hidden_size
        self.intermediate_size = config.intermediate_size if intermediate_size is None else intermediate_size
        self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
        self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
        self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
        self.act_fn = ACT2FN[config.hidden_act]

    def forward(self, hidden_states):
        return self.down_proj(self.act_fn(self.gate_proj(hidden_states)) * self.up_proj(hidden_states))