Model techniques map
ModelsDeepSeek-V4-Pro-0813

DeepSeek · released 2026-08-13

DeepSeek-V4-Pro-0813

What DeepSeek-V4-Pro-0813’s own documents say it is built from — every method with the sentence that describes it.

Curator’s noteGA release of DeepSeek-V4-Pro (1.6T total / 49B active, 1M context, MIT), built on the preview's model structure with a DSpark speculative-decoding module attached; the release also added Responses API support and low/high/max thinking-effort control. Same arXiv 2606.19348 report as the rest of the V4 line.

Against the consensus recipe

Its documents state 1 of the 15 methods the field agrees on.

The recipe from the overview: the methods the most labs adopt, per stage. A missing one is something the documents do not say, not something the model lacks.

  1. Data curation

  2. Training objective

  3. Model architecture

  4. Optimization

  5. Post-training

  6. Inference & serving

Checked in its code

Its code shows 13 of the 19 architecture features checked — 13 of them are not stated in its documents.

Documents say what a lab chose to describe; the modeling code says what the checkpoint runs. Each feature below was put to a code verifier, and only the config values and source lines it cited that were found in the files are shown, linked to the line.

Read from Hugging Face Transformers (modeling_deepseek_v4.py, configuration_deepseek_v4.py) and config.json at revision 72e1d3230f, by anthropic/claude-sonnet-5 on 2026-09-25.

FeatureCodeIts documentsEvidence
Grouped-query attention not in its codenot stated

The attention uses a single shared KV head broadcast to all query heads via repeat_kv (multi-query attention with num_key_value_heads=1, not grouped KV heads with independent projection), but the model is MLA-style (kv_proj to a shared low-rank head_dim); num_key_value_groups is set to num_attention_heads (MQA), and true GQA (multiple, but fewer, distinct KV heads) is not implemented.

num_key_value_heads = 1
self.num_key_value_groups = config.num_attention_heads  # single KV head, broadcast to all
modeling_deepseek_v4.py · L782
Multi-head latent attention code only in its codenot stated

Queries and KV are down-projected via low-rank q_lora_rank/kv_proj (to a single head_dim latent) and up-projected per head, with a decoupled rope key applied to the trailing rope slice, DeepSeek-V2/V3-MLA style.

q_lora_rank = 1536qk_rope_head_dim = 64
self.q_a_proj = nn.Linear(config.hidden_size, config.q_lora_rank, bias=False)
        self.q_a_norm = DeepseekV4RMSNorm(config.q_lora_rank, eps=config.rms_norm_eps)
        self.q_b_proj = nn.Linear(config.q_lora_rank, self.num_heads * self.head_dim, bias=False)
        self.q_b_norm = DeepseekV4UnweightedRMSNorm(eps=config.rms_norm_eps)
        self.kv_proj = nn.Linear(config.hidden_size, self.head_dim, bias=False)
        self.kv_norm = DeepseekV4RMSNorm(self.head_dim, eps=config.rms_norm_eps)
modeling_deepseek_v4.py · L789–794
Sliding-window attention code only in its codenot stated

Every layer, including compressed layers, uses a sliding-window cache/mask with sliding_window=128 set in config, and the mask is built with create_sliding_window_causal_mask.

sliding_window = 128
causal_mask = create_sliding_window_causal_mask(
                config=self.config,
                inputs_embeds=inputs_embeds,
                attention_mask=attention_mask,
                past_key_values=past_key_values,
                position_ids=position_ids,
            )
modeling_deepseek_v4.py · L1350–1356
Interleaved sliding-window and global attention code only in its codenot stated

layer_types (derived from compress_ratios in this config) interleave sliding_attention, compressed_sparse_attention, and heavily_compressed_attention layers, each with different attention/context scope, per the compress_ratios array mapping to layer types.

compress_ratios = [128, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4, 128, 4,…
_COMPRESS_RATIO_TO_LAYER_TYPE = {
    0: "sliding_attention",
    4: "compressed_sparse_attention",
    128: "heavily_compressed_attention",
}
configuration_deepseek_v4.py · L28–32
Indexer-selected sparse attention (DeepSeek Sparse Attention) code only in its codenot stated

The DeepseekV4Indexer scores compressed KV entries with a lightweight scorer and each query attends only to the top index_topk entries selected, used in compressed_sparse_attention layers.

index_topk = 1024index_n_heads = 64index_head_dim = 128
top_k_indices = index_scores.topk(top_k, dim=-1).indices  # [B, S, k]
            invalid = top_k_indices >= causal_threshold.unsqueeze(-1)
            return torch.where(invalid, torch.full_like(top_k_indices, -1), top_k_indices)
modeling_deepseek_v4.py · L585–587
Linear-attention or state-space layers alongside full attention not in its codenot stated

No linear-attention or state-space recurrent mixer layers are implemented; all layer types (sliding, CSA, HCA) are variants of softmax attention with different KV compression, not linear-complexity recurrence.

Gated DeltaNet layers not in its codenot stated

No gated delta-rule recurrent module exists in the code; layer_types only cover sliding/CSA/HCA softmax-attention variants.

Mamba-2 layers not in its codenot stated

No Mamba-2 SSD/selective state-space block is implemented anywhere in this file.

Learnable attention sink code only in its codenot stated

Each attention layer has a per-head learnable sink parameter concatenated into the softmax denominator before dropping it, gpt-oss style.

sinks = module.sinks.reshape(1, -1, 1, 1).expand(query.shape[0], -1, query.shape[-2], -1)
    combined_logits = torch.cat([attn_weights, sinks], dim=-1)
modeling_deepseek_v4.py · L736–737
self.sinks = nn.Parameter(torch.empty(self.num_heads))
modeling_deepseek_v4.py · L799
Gated attention output not in its codenot stated

There is no input-dependent sigmoid gate multiplying the attention output before the output projection; the attn_output only goes through a rope-undo and grouped output projection.

QK normalization code only in its codenot stated

Queries are normalized per head with an unweighted RMSNorm after the q_b_proj up-projection, and keys/values (the shared kv latent) are RMSNorm'd via kv_norm before attention.

q = self.q_b_proj(q_residual).view(*hidden_shape).transpose(1, 2)
        q = self.q_b_norm(q)
        q = apply_rotary_pos_emb(q, cos, sin)

        kv = self.kv_norm(self.kv_proj(hidden_states)).view(*hidden_shape).transpose(1, 2)
modeling_deepseek_v4.py · L820–824
Partial RoPE code only in its codenot stated

RoPE is applied only to the trailing rope_head_dim slice of each head (qk_rope_head_dim=64 out of head_dim=512), leaving the leading nope channels untouched.

qk_rope_head_dim = 64head_dim = 512
rope_dim = cos.shape[-1]
    nope, rope = x[..., :-rope_dim], x[..., -rope_dim:]
    rotated = ((rope.float() * cos) + (rotate_half(rope).float() * sin)).to(x.dtype)
    return torch.cat([nope, rotated], dim=-1)
modeling_deepseek_v4.py · L359–362
YaRN RoPE scaling code only in its codenot stated

rope_scaling type is yarn in the config and is applied to the compress rope-type branch used by CSA/HCA layers via the ROPE_INIT_FUNCTIONS yarn initializer.

rope_scaling = {"beta_fast": 32, "beta_slow": 1, "factor": 16, "original_max_position_embedd…
rope_init_fn = self.compute_default_rope_parameters
            if self.rope_type[layer_type] != "default":
                rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type[layer_type]]
modeling_deepseek_v4.py · L105–107
Layers without positional encoding (NoPE) not in its codenot stated

All attention layers apply RoPE (partial, on the trailing rope slice) via either the main or compress rope type; no attention layer entirely skips positional encoding.

Mixture of experts code only in its codenot stated

The SparseMoeBlock routes tokens to a top-k of n_routed_experts=384 expert MLPs via a learned router (TopKRouter or HashRouter for early layers).

n_routed_experts = 384num_experts_per_tok = 6
indices = torch.topk(scores + self.e_score_correction_bias, self.top_k, dim=-1, sorted=False).indices
        weights = scores.gather(1, indices)
modeling_deepseek_v4.py · L1086–1087
Shared expert code only in its codenot stated

Every SparseMoeBlock adds a DeepseekV4MLP shared_experts pass that every token goes through, and n_shared_experts=1 in config.

n_shared_experts = 1
routed = self.experts(flat, indices, weights).view(batch, seq_len, hidden_dim)
        return routed + self.shared_experts(residual)
modeling_deepseek_v4.py · L1139–1140
Auxiliary-loss-free load balancing (selection bias) code only in its codenot stated

The TopKRouter adds e_score_correction_bias only to the scores used for top-k selection (not to the output weights), matching DeepSeek-V3's noaux_tc bias mechanism, with topk_method set to noaux_tc.

topk_method = "noaux_tc"
indices = torch.topk(scores + self.e_score_correction_bias, self.top_k, dim=-1, sorted=False).indices
        weights = scores.gather(1, indices)
        weights = weights / (weights.sum(dim=-1, keepdim=True) + 1e-20)
modeling_deepseek_v4.py · L1086–1088
Multi-token prediction layers code only in its codenot stated

num_nextn_predict_layers=1 in config declares an MTP module count, and the modeling file explicitly ignores mtp.* weights on load, indicating the checkpoint carries MTP layers even though they are not instantiated here.

num_nextn_predict_layers = 1
_keys_to_ignore_on_load_unexpected = [r"(^|\.)mtp\..*"]
modeling_deepseek_v4.py · L1259
SwiGLU feed-forward code only in its codenot stated

Both the dense MLP and expert MLPs compute SiLU(gate(x)) * up(x) with hidden_act=silu, clamped by swiglu_limit.

hidden_act = "silu"
gate = self.gate_proj(x).clamp(max=self.limit)
        up = self.up_proj(x).clamp(min=-self.limit, max=self.limit)
        return self.down_proj(self.act_fn(gate) * up)
modeling_deepseek_v4.py · L1025–1027

model architecture 1

multimodal architecture 1

training objective 1

language modelling objective 1

post-training 1

filed at the root 1

inference & serving 5

decoding strategy 2

reasoning control 1

agentic scaffolding 2

JSON mode optional

software implementation 1

infrastructure service 1

unfiled 4

Sources

The curated document list for this model. "not fetched" means the URL is recorded but its text was not read in the current run.

DocumentKindPublisherStatus
api-docs.deepseek.com/updatesofficial blogDeepSeekread
arxiv.org/abs/2606.19348technical reportDeepSeekread
huggingface.co/deepseek-ai/DeepSeek-V4-Pro-0813model cardDeepSeekread
openrouter.ai/deepseek/deepseek-v4-pro-0813vendor docsOpenRouterread