Shared expert

Up projection

×

Map 6,144 input features to 2,048 features in parallel with the gate.

u=xffnW3{\htmlData{light=u up}{u}}={\htmlData{light=x}{x_{\mathrm{ffn}}}}W_{3}
in
xffnx_{\mathrm{ffn}} [B batch, T positions, 6144 d]
out
uu [B batch, T positions, 2048 shared d_ff]
Parameters12,582,912 × 3 layers

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 the 3 sharing MoE layers, each with its own weights.

Sources

In codeself.up_proj(x)

Open pinned code ↗

Direct evidence

The dense feed-forward network is a SwiGLU MLP, down(silu(gate x) ⊙ up x), computed in the input’s precision.

modeling_glm_moe_dsa.py 454–467 ↗ · huggingface/transformers @ c4c4605f9618

Excerpt
class GlmMoeDsaMLP(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, x):
        down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
        return down_proj

Attention projections have no bias (attention_bias is false). The checkpoint stores its matrices in FP8 (e4m3) with one scale per 128 × 128 block, scaled dynamically per token at run time; the modules listed under modules_to_not_convert (the norms, the routers and their correction biases, the indexer’s key norm and head-weight projection, the embedding and the output head) are not converted.

config.json 5–233 ↗ · zai-org/GLM-5.3 @ ba32f8c19c87

Excerpt
  "attention_bias": false,
  "attention_dropout": 0.0,
  "dtype": "bfloat16",

… lines 8–223 omitted …

  "quantization_config": {
    "activation_scheme": "dynamic",
    "fmt": "e4m3",
    "quant_method": "fp8",
    "weight_block_size": [
      128,
      128
    ],
    "modules_to_not_convert": [
      "model.layers.59.post_attention_layernorm",