SwiGLU MLP

Gate projection

×

Map 7,168 input features to 16,384 gate features.

g=xffnW1{\htmlData{light=g gate}{g}}={\htmlData{light=x}{x_{\mathrm{ffn}}}}W_{1}
in
xffnx_{\mathrm{ffn}} [B batch, T positions, 7168 d]
out
gg [B batch, T positions, 16384 d_ff]

Gate and up are the two halves of one merged projection, gate_up_proj, which SiluAndMul splits (deepseek_v2.py 261–268, 285–286; activation.py 141–144).

Parameters117,440,512 × 3 layers

117,440,512 parameters per instance.

ComponentCalculationParameters
Weight matrix7,168 × 16,384117,440,512

This projection has no bias parameter.

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

One in each of the 3 dense layers, each with its own weights.

Sources

In codeself.gate_up_proj(x)

Open pinned code ↗

Direct evidence

The dense MLP and the shared expert are DeepseekV2MLP: gate and up projections merged into one gate_up_proj without bias, SiluAndMul, and down_proj.

deepseek_v2.py 244–288 ↗ · vllm-project/vllm @ 5df63a7203cd

Excerpt
class DeepseekV2MLP(nn.Module):
    def __init__(
        self,
        hidden_size: int,
        intermediate_size: int,
        hidden_act: str,
        quant_config: QuantizationConfig | None = None,
        reduce_results: bool = True,
        is_sequence_parallel=False,
        prefix: str = "",
    ) -> None:
        super().__init__()

        # If is_sequence_parallel, the input and output tensors are sharded
        # across the ranks within the tp_group. In this case the weights are
        # replicated and no collective ops are needed.
        # Otherwise we use standard TP with an allreduce at the end.
        self.gate_up_proj = MergedColumnParallelLinear(
            hidden_size,
            [intermediate_size] * 2,
            bias=False,
            quant_config=quant_config,
            disable_tp=is_sequence_parallel,
            prefix=f"{prefix}.gate_up_proj",
        )
        self.down_proj = RowParallelLinear(
            intermediate_size,
            hidden_size,
            bias=False,
            quant_config=quant_config,
            reduce_results=reduce_results,
            disable_tp=is_sequence_parallel,
            prefix=f"{prefix}.down_proj",
        )
        if hidden_act != "silu":
            raise ValueError(
                f"Unsupported activation: {hidden_act}. Only silu is supported for now."
            )
        self.act_fn = SiluAndMul()

    def forward(self, x):
        gate_up, _ = self.gate_up_proj(x)
        x = self.act_fn(gate_up)
        x, _ = self.down_proj(x)
        return x

The checkpoint’s quantization: compressed-tensors FP8 for every Linear, weights in 128 × 128 blocks with one scale each, activations quantized dynamically in groups of 128; the token embedding, the MLA down-projections (q_a_proj and kv_a_proj_with_mqa), the routers (gate), the output head and the vision parts are left out.

params.json 31–86 ↗ · mistralai/Mistral-Large-3-675B-Instruct-2512 @ 383ffea2c7d6

Excerpt
  "quantization_config": {
    "config_groups": {
      "FP8_BLOCK": {
        "format": "float-quantized",
        "input_activations": {
          "actorder": null,
          "block_structure": null,
          "dynamic": true,
          "group_size": 128,
          "num_bits": 8,
          "observer": null,
          "observer_kwargs": {},
          "strategy": "group",
          "symmetric": true,
          "type": "float"
        },
        "output_activations": null,
        "targets": [
          "Linear"
        ],
        "weights": {
          "actorder": null,
          "block_structure": [
            128,
            128
          ],
          "dynamic": false,
          "group_size": null,
          "num_bits": 8,
          "observer": "static_minmax",
          "observer_kwargs": {},
          "strategy": "block",
          "symmetric": true,
          "type": "float"
        }
      }
    },
    "format": "float-quantized",
    "global_compression_ratio": null,
    "ignore": [
      "model.embed_tokens",
      "re:patch_merger.*",
      "re:vision_encoder.*",
      "re:vision_language_adapter.*",
      "re:.*kv_a_proj_with_mqa$",
      "re:.*q_a_proj$",
      "re:.*gate$",
      "lm_head"
    ],
    "kv_cache_scheme": null,
    "quant_method": "compressed-tensors",
    "quantization_status": "compressed",
    "sparsity_config": {},
    "transform_config": {},
    "version": "0.12.3.dev29+g73c2cf9.d20251119"
  },