DeepSeek V4-Pro

Raw textto LL [B, T, 129280]

Parameters1,572,997,201,763

1,572,997,201,763 parameters in DeepSeek V4-Pro

ComponentCalculationParameters
Token embedding129,280 × 7,168926,679,040
Layers1,571,143,721,822
Read-out weights114,693
Final RMSNorm7,168
Vocabulary projection7,168 × 129,280926,679,040
Model total1,572,997,201,763

Counted from the pinned configuration and code, with each byte of a 4-bit expert weight as the two values it packs. The total matches the checkpoint’s tensors, apart from the quantisation scales, the hash layers’ token-to-expert tables (not trained) and the multi-token-prediction layer (the reference code never runs it).

Sources

Direct evidence

The reference configuration: 61 layers of width 7,168, 128 heads of 512 features with a 64-feature rotary part, a 1,536-feature query latent, a grouped output of 16 groups at rank 1,024, a window of 128, the per-layer compression ratios (128, 128, then 4 and 128 alternating, and 0 for the MTP block), an indexer of 64 heads of 128 keeping 1,024, hyper-connections of 4 streams with 20 Sinkhorn iterations, 384 routed experts of 3,072 of which 6 are used with 1 shared, square-root-softplus scores scaled by 2.5, three hash-routed layers, and YaRN over 65,536 positions.

config.json 1–34 ↗ · deepseek-ai/DeepSeek-V4-Pro @ b5968e9190ef

Excerpt
{
    "vocab_size": 129280,
    "dim": 7168,
    "moe_inter_dim": 3072,
    "n_layers": 61,
    "n_hash_layers": 3,
    "n_heads": 128,
    "n_routed_experts": 384,
    "n_shared_experts": 1,
    "n_activated_experts": 6,
    "score_func": "sqrtsoftplus",
    "route_scale": 2.5,
    "swiglu_limit": 10.0,
    "q_lora_rank": 1536,
    "head_dim": 512,
    "rope_head_dim": 64,
    "o_groups": 16,
    "o_lora_rank": 1024,
    "window_size": 128,
    "original_seq_len": 65536,
    "rope_theta": 10000,
    "rope_factor": 16,
    "beta_fast": 32,
    "beta_slow": 1,
    "index_n_heads": 64,
    "index_head_dim": 128,
    "index_topk": 1024,
    "hc_mult": 4,
    "hc_sinkhorn_iters": 20,
    "dtype": "fp8",
    "scale_fmt": "ue8m0",
    "expert_dtype": "fp4",
    "compress_rope_theta": 160000,
    "compress_ratios": [128, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 0]

The model: the embedding, 61 blocks, the final norm, the head, one MTP block sharing the embedding and head, and the read-out’s projection, offsets and scale.

model.py 769–799 ↗ · deepseek-ai/DeepSeek-V4-Pro @ b5968e9190ef

Excerpt
class Transformer(nn.Module):
    """Full DeepSeek-V4 model: embed -> HC-expand -> N blocks -> HC-head -> logits.
    Sets global state (world_size, rank, default_dtype, scale_fmt, scale_dtype) in __init__."""
    def __init__(self, args: ModelArgs):
        global world_size, rank, default_dtype, scale_fmt, scale_dtype
        world_size = dist.get_world_size() if dist.is_initialized() else 1
        rank = dist.get_rank() if dist.is_initialized() else 0
        default_dtype = torch.float8_e4m3fn if args.dtype == "fp8" else torch.bfloat16
        scale_fmt = "ue8m0" if args.scale_dtype == "fp8" else args.scale_fmt
        scale_dtype = torch.float8_e8m0fnu if args.scale_dtype == "fp8" else torch.float32
        super().__init__()
        self.max_seq_len = args.max_seq_len
        self.norm_eps = args.norm_eps
        self.hc_eps = args.hc_eps
        self.embed = ParallelEmbedding(args.vocab_size, args.dim)
        self.layers = torch.nn.ModuleList()
        for layer_id in range(args.n_layers):
            self.layers.append(Block(layer_id, args))
        self.norm = RMSNorm(args.dim, self.norm_eps)
        self.head = ParallelHead(args.vocab_size, args.dim, self.norm_eps, self.hc_eps)
        self.mtp = torch.nn.ModuleList()
        for layer_id in range(args.n_mtp_layers):
            self.mtp.append(MTPBlock(args.n_layers + layer_id, args))
            self.mtp[-1].embed = self.embed
            self.mtp[-1].head = self.head
        self.hc_mult = hc_mult = args.hc_mult
        hc_dim = hc_mult * args.dim
        with set_dtype(torch.float32):
            self.hc_head_fn = nn.Parameter(torch.empty(hc_mult, hc_dim))
            self.hc_head_base = nn.Parameter(torch.empty(hc_mult))
            self.hc_head_scale = nn.Parameter(torch.empty(1))

The forward: embed, repeat into four streams, apply the 61 layers with the token IDs, read out through the head; the MTP block is not run.

model.py 801–809 ↗ · deepseek-ai/DeepSeek-V4-Pro @ b5968e9190ef

Excerpt
    @torch.inference_mode()
    def forward(self, input_ids: torch.Tensor, start_pos: int = 0):
        h = self.embed(input_ids)
        # Expand to hc_mult copies for Hyper-Connections
        h = h.unsqueeze(2).repeat(1, 1, self.hc_mult, 1)
        for layer in self.layers:
            h = layer(h, start_pos, input_ids)
        logits = self.head(h, self.hc_head_fn, self.hc_head_scale, self.hc_head_base, self.norm)
        return logits