Vocabulary projection
×Project each normalized feature vector into vocabulary logits.
- in
- [B batch, T positions, 7168 d]
- out
- [B batch, T positions, 131072 vocabulary]
Logits stay in the model’s type unless head_dtype is set (logits_processor.py 92–96, 143–146).
Parameters939,524,096
939,524,096 parameters per instance.
| Component | Calculation | Parameters |
|---|---|---|
| Weight matrix | 7,168 × 131,072 | 939,524,096 |
The reference module holds the weight output by input, [out, in].
Explanation
Each entry scores one vocabulary token as the next token for its position. The softmax and the choice of token happen outside the model.
Logits stay in the model’s type unless head_dtype is set (logits_processor.py 92–96, 143–146).
Sources
In codeself.logits_processor(self.lm_head, hidden_states)
Direct evidence
The model embeds the token IDs, computes the llama-4 position factors once, applies the layers with a residual stream that each next norm adds in, and applies the final norm, which adds the last update.
deepseek_v2.py 1459–1592 ↗ · vllm-project/vllm @ 5df63a7203cd
Excerpt
if get_pp_group().is_first_rank:
self.embed_tokens = VocabParallelEmbedding(
config.vocab_size,
self.hidden_size,
quant_config=quant_config,
prefix=f"{prefix}.embed_tokens",
)… lines 1466–1484 omitted …
if get_pp_group().is_last_rank:
self.norm = RMSNorm(self.hidden_size, eps=config.rms_norm_eps)… lines 1487–1507 omitted …
def forward(
self,
input_ids: torch.Tensor | None,
positions: torch.Tensor,
intermediate_tensors: IntermediateTensors | None,
inputs_embeds: torch.Tensor | None = None,
) -> torch.Tensor | IntermediateTensors:
if get_pp_group().is_first_rank:
if inputs_embeds is not None:
hidden_states = inputs_embeds
else:
if input_ids is None:
raise ValueError(
"Either input_ids or inputs_embeds must be provided "
"to DeepseekV2Model.forward"
)
hidden_states = self.embed_input_ids(input_ids)
residual = None
else:
assert intermediate_tensors is not None
hidden_states = intermediate_tensors["hidden_states"]
residual = intermediate_tensors["residual"]
# Compute llama 4 scaling once per forward pass if enabled
llama_4_scaling_config = getattr(self.config, "llama_4_scaling", None)
llama_4_scaling: torch.Tensor | None
if llama_4_scaling_config is not None:
llama_4_scaling = _get_llama_4_scaling(
original_max_position_embeddings=llama_4_scaling_config[
"original_max_position_embeddings"
],
scaling_beta=llama_4_scaling_config["beta"],
positions=positions,
)
else:
llama_4_scaling = None
aux_hidden_states = []
for idx, layer in enumerate(
islice(self.layers, self.start_layer, self.end_layer),
start=self.start_layer,
):
# all gather if we need to use the whole states
if (
hidden_states.shape[0] != positions.shape[0]
and not layer.use_sequence_parallel_moe
):
combined_states = torch.cat([hidden_states, residual], dim=-1)
combined_states = tensor_model_parallel_all_gather(combined_states, 0)
combined_states = combined_states[: positions.shape[0]]
hidden_states, residual = combined_states.split(
[self.hidden_size, self.hidden_size], dim=-1
)
if idx in self.aux_hidden_state_layers:
aux_hidden_state = hidden_states + residual
if aux_hidden_state.shape[0] != positions.shape[0]:
aux_hidden_state = tensor_model_parallel_all_gather(
aux_hidden_state, 0
)
aux_hidden_state = aux_hidden_state[: positions.shape[0]]
aux_hidden_states.append(aux_hidden_state)
hidden_states, residual = layer(
positions, hidden_states, residual, llama_4_scaling
)
if not get_pp_group().is_last_rank:
return IntermediateTensors(
{"hidden_states": hidden_states, "residual": residual}
)
if hidden_states.shape[0] != positions.shape[0]:
combined_states = torch.cat([hidden_states, residual], dim=-1)
combined_states = tensor_model_parallel_all_gather(combined_states, 0)
combined_states = combined_states[: positions.shape[0]]
hidden_states, residual = combined_states.split(
[self.hidden_size, self.hidden_size], dim=-1
)
if self.end_layer in self.aux_hidden_state_layers:
aux_hidden_states.append(hidden_states + residual)
hidden_states, _ = self.norm(hidden_states, residual)
if len(aux_hidden_states) > 0:
return hidden_states, aux_hidden_states
return hidden_statesThe released configuration in Mistral’s own format: width 7,168, 61 layers, 128 heads (and 128 key–value heads), a dense MLP of 16,384, MLA ranks 1,536 (query) and 512 (key–value) with head widths 128 + 64 (query–key) and 128 (value); 128 routed experts of 4,096, 4 used, one shared expert, one expert group, route scale 1.0, the first 3 layers dense; 294,912 positions; YaRN with factor 36 over 8,192 original positions, β 32 and α 1, apply_scale false; llama_4_scaling with β 0.1 over 8,192 positions; RMSNorm ε 10⁻⁶; θ 10,000; untied embeddings; vocabulary 131,072; FP8 quantization; and a vision encoder.
params.json 1–116 ↗ · mistralai/Mistral-Large-3-675B-Instruct-2512 @ 383ffea2c7d6
Excerpt
{
"dim": 7168,
"head_dim": 192,
"hidden_dim": 16384,
"kv_lora_rank": 512,
"llama_4_scaling": {
"beta": 0.1,
"original_max_position_embeddings": 8192
},
"max_position_embeddings": 294912,
"moe": {
"expert_hidden_dim": 4096,
"expert_model_parallel": 1,
"expert_parallel": 1,
"first_k_dense_replace": 3,
"num_expert_groups": 1,
"num_expert_groups_per_tok": 1,
"num_experts": 128,
"num_experts_per_tok": 4,
"num_shared_experts": 1,
"route_every_n": 1,
"routed_scale": 1.0
},
"n_heads": 128,
"n_kv_heads": 128,
"n_layers": 61,
"norm_eps": 1e-06,
"q_lora_rank": 1536,
"qk_nope_head_dim": 128,
"qk_rope_head_dim": 64,
"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"
},
"rope_theta": 10000.0,
"tied_embeddings": false,
"v_head_dim": 128,
"vision_encoder": {
"adapter_bias": false,
"add_pre_mm_projector_layer_norm": true,
"hidden_size": 1664,
"image_break_token_id": 12,
"image_end_token_id": 13,
"image_size": 1540,
"image_token_id": 10,
"intermediate_size": 8192,
"max_image_size": 1540,
"mm_projector_id": "patch_merge",
"num_attention_heads": 16,
"num_channels": 3,
"num_hidden_layers": 48,
"patch_size": 14,
"rope_theta": 10000.0,
"spatial_merge_size": 2
},
"vocab_size": 131072,
"yarn": {
"alpha": 1,
"apply_scale": false,
"beta": 32,
"factor": 36,
"original_max_position_embeddings": 8192
}
}