Mix and project

Output projection

×

Map 16,384 head features to the 7,168-feature update.

Δattn=oWO{\htmlData{light=output projection}{\Delta_{\mathrm{attn}}}}={\htmlData{light=merged merge}{o}}W_{O}
in
oo [B batch, T positions, 16384 heads × value]
out
Δattn\Delta_{\mathrm{attn}} [B batch, T positions, 7168 d]
Parameters117,440,512 × 3 layers

117,440,512 parameters per instance.

ComponentCalculationParameters
Weight matrix16,384 × 7,168117,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.wo(x.flatten(2))

Open pinned code ↗

Direct evidence

MLA owns a query down-projection, query RMSNorm and up-projection, a joint key–value down-projection that also emits the shared rotary key, a latent RMSNorm, a key–value up-projection and an output projection.

model.py 523–539 ↗ · deepseek-ai/DeepSeek-V3.2-Exp @ 87e509a2e5a1

Excerpt
        self.qk_head_dim = args.qk_nope_head_dim + args.qk_rope_head_dim
        self.v_head_dim = args.v_head_dim

        self.wq_a = Linear(self.dim, self.q_lora_rank)
        self.q_norm = RMSNorm(self.q_lora_rank)
        self.wq_b = ColumnParallelLinear(self.q_lora_rank, self.n_heads * self.qk_head_dim)
        self.wkv_a = Linear(self.dim, self.kv_lora_rank + self.qk_rope_head_dim)
        self.kv_norm = RMSNorm(self.kv_lora_rank)
        self.wkv_b = ColumnParallelLinear(self.kv_lora_rank, self.n_heads * (self.qk_nope_head_dim + self.v_head_dim))
        self.wo = RowParallelLinear(self.n_heads * self.v_head_dim, self.dim)
        self.softmax_scale = self.qk_head_dim ** -0.5
        self.scale_fmt = args.scale_fmt
        if args.max_seq_len > args.original_seq_len:
            mscale = 0.1 * args.mscale * math.log(args.rope_factor) + 1.0
            self.softmax_scale = self.softmax_scale * mscale * mscale

        self.indexer = Indexer(args)

Head outputs are flattened and projected back to the model width.

model.py 607–608 ↗ · deepseek-ai/DeepSeek-V3.2-Exp @ 87e509a2e5a1

Excerpt
        x = self.wo(x.flatten(2))
        return x