Model techniques map
ModelsDeepSeek-V4.1-Flash

DeepSeek · usage rank #2 · released 2026-09-10

DeepSeek-V4.1-Flash

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

Curator’s note552B backbone + 196B Engram conditional-memory parameters, and the first DeepSeek built on a Causal Encoder-Decoder (CED) stack: 20 causal-encoder layers feeding 20 decoder layers, whose global KV cache is projected from the final encoder states — 8B parameters activated per token at prefill, 16B at decode. Compressed Sparse Attention 2 (per-layer Full / Reindex / Reuse modes + a hierarchical sparse indexer), FP4 main KV cache and SWA Bounded Replay bring the global cache to 890 bytes/token, ~1/4 of V4-Flash. Also Single-Pass mHC, DSpark speculative decoding and a trained-from-scratch DeepSeek-ViT; 45T multimodal pre-training tokens, 1M context, MIT. Its own technical report ships in the HF repo, not on arXiv.

Rank by open-weight tokens on OpenRouter, week of 2026-09-21.

Against the consensus recipe

Its documents state 4 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 — 8 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 vLLM (__init__.py, quant_config.py, dspark.py, mm_preprocess.py, model.py, engram.py, engram.py, mhc.py, mega_mhc.py, model_state.py, vl_model.py, vl_cudagraph.py, attention.py, compressor.py, sparse_mla.py) and config.json at revision dba1be0a40, by anthropic/claude-sonnet-5 on 2026-09-25.

FeatureCodeIts documentsEvidence
Grouped-query attention not in its codenot stated

This model uses multi-head latent attention (MLA) with a single-head latent KV cache rather than GQA; num_key_value_heads=1 reflects the MLA latent, not shared KV head groups.

text_config.num_key_value_heads = 1
self.n_heads = config.num_attention_heads
        assert self.n_heads % tp_size == 0
        self.n_local_heads = self.n_heads // tp_size
        self.q_lora_rank = config.q_lora_rank
attention.py · L282–285
Multi-head latent attention code only in its codenot stated

Keys/values are compressed into a shared low-rank latent (kv_norm/compressor) and queries/keys use a decoupled RoPE dimension, DeepSeek-V2/V3 style MLA.

text_config.q_lora_rank = 1280text_config.qk_rope_head_dim = 64
self.q_lora_rank = config.q_lora_rank
        self.o_lora_rank = config.o_lora_rank
        self.head_dim = config.head_dim
        self.rope_head_dim = config.qk_rope_head_dim
        self.nope_head_dim = self.head_dim - self.rope_head_dim
attention.py · L285–289
Sliding-window attention in its code core

Every layer maintains a sliding-window KV cache (DeepseekV4SWACache) sized from config.sliding_window=128, and some layers (compress_ratio=0) are pure sliding-window attention.

text_config.sliding_window = 128
self.window_size = config.sliding_window
attention.py · L292
Interleaved sliding-window and global attention code only in its codenot stated

The compress_ratios array fixes, per layer, whether it is pure sliding-window (0), full compressed (1), or ratio-2 compressed with sparse attention over the full context (2), interleaving sliding-window-only layers with full/compressed-context layers.

text_config.compress_ratios = [0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1…
compress_ratios = getattr(config, "compress_ratios", None)
        if compress_ratios is not None and layer_id < len(compress_ratios):
            self.compress_ratio = int(compress_ratios[layer_id])
        else:
            # MTP layers past the configured list are pure sliding-window.
            self.compress_ratio = 0
attention.py · L300–305
Indexer-selected sparse attention (DeepSeek Sparse Attention) code only in its codenot stated

A DeepseekV4Indexer with dedicated heads/head_dim scores past (compressed) tokens and each query attends only to the indexer's selected top-k tokens (index_topk), matching the DeepSeek Sparse Attention / lightning indexer pattern.

text_config.index_topk = 512text_config.index_n_heads = 32text_config.index_head_dim = 128
self.topk_tokens = config.index_topk
        self.n_head = config.index_n_heads  # 32
        self.head_dim = config.index_head_dim  # 128
attention.py · L1245–1247
Linear-attention or state-space layers alongside full attention not in its codenot stated

No linear-attention or SSM token-mixing layers are implemented; every decoder layer uses the same DeepseekV4Attention (sparse/sliding-window MLA) mechanism.

Gated DeltaNet layers not in its codenot stated

No gated delta-rule recurrent mixer code exists in the given files; attention layers are exclusively sparse/sliding-window MLA.

Mamba-2 layers not in its codenot stated

No Mamba-2/SSD selective state-space implementation is present in the given files.

Learnable attention sink code only in its codenot stated

Each attention layer has a learned per-head attn_sink parameter added as an extra logit in the sparse-MLA attention softmax denominator (supports_sink is True for the backend).

self.attn_sink = nn.Parameter(
            torch.full((self.padded_heads,), -float("inf"), dtype=torch.float32),
            requires_grad=False,
        )
attention.py · L349–352
    @classmethod
    def supports_sink(cls) -> bool:
        return True
sparse_mla.py · L119–121
Gated attention output not in its codenot stated

No sigmoid gate is applied to the attention output before the o_proj; the Engram module has a sigmoid gate but that is a separate n-gram injection mechanism, not attention-output gating.

QK normalization code only in its codenot stated

Queries and keys (the fused q-lora / kv projection) are RMSNorm'd (q_norm, kv_norm) before the attention dot product.

self.q_norm = RMSNorm(self.q_lora_rank, self.eps)
attention.py · L362
self.kv_norm = RMSNorm(self.head_dim, self.eps)
attention.py · L372
Partial RoPE code only in its codenot stated

Only qk_rope_head_dim (64) of the 512-dim head carries RoPE (nope_head_dim = head_dim - rope_head_dim), a decoupled/partial RoPE key as in MLA.

text_config.qk_rope_head_dim = 64text_config.head_dim = 512
self.rope_head_dim = config.qk_rope_head_dim
        self.nope_head_dim = self.head_dim - self.rope_head_dim
attention.py · L288–289
YaRN RoPE scaling code only in its codenot stated

rope_scaling in the config sets rope_type=yarn with factor/beta_fast/beta_slow, and build_deepseek_v4_rope constructs the rotary embedding from this config for use in attention.

text_config.rope_scaling = {"rope_type": "yarn", "factor": 16, "beta_fast": 32, "beta_slow": 1, "origina…
self.rotary_emb = build_deepseek_v4_rope(
            config,
            head_dim=self.head_dim,
            rope_head_dim=self.rope_head_dim,
            max_position_embeddings=config.max_position_embeddings,
            compress_ratio=self.compress_ratio,
        )
attention.py · L399–405
Layers without positional encoding (NoPE) not in its codenot stated

There is no per-layer flag disabling RoPE entirely for some softmax attention layers; all layers apply RoPE to the rotary portion of Q/K (partial RoPE), and no no_rope_layers/nope_layer_interval mechanism is present.

Mixture of experts in its code core

Feed-forward layers (DeepseekV4MoE) route each token to a learned top-k subset of n_routed_experts routed experts.

text_config.n_routed_experts = 384text_config.num_experts_per_tok = 6
n_routed_experts = config.n_routed_experts
        n_activated_experts = config.num_experts_per_tok
model.py · L118–119
Shared expert in its code used

Each MoE layer also has n_shared_experts=1 shared expert(s) that all tokens pass through in addition to the routed experts.

text_config.n_shared_experts = 1
def _pad_shared_expert_weight(
        quant_config: QuantizationConfig | None,
        name: str,
        loaded_weight: torch.Tensor,
    ) -> torch.Tensor:
model.py · L1051–1055
Auxiliary-loss-free load balancing (selection bias) in its code core

topk_method is 'noaux_tc' (DeepSeek-V3 aux-loss-free scheme) and the router's e_score_correction_bias is loaded and mapped from the gate's bias in the weight loader.

text_config.topk_method = "noaux_tc"
".ffn.gate.bias": ".ffn.gate.e_score_correction_bias",
model.py · L1179
Multi-token prediction layers code only in its codenot stated

The config declares num_nextn_predict_layers=3 and the checkpoint's mtp.{0,1,2}.* weights are loaded as extra next-token-prediction decoder layers (DSpark draft model reuses this count too).

text_config.num_nextn_predict_layers = 3
self.num_dspark_layers = (
            getattr(config, "n_mtp_layers", None)
            or getattr(config, "num_nextn_predict_layers", None)
            or 3
        )
dspark.py · L87–91
SwiGLU feed-forward in its code used

hidden_act is 'silu' and MoE/shared expert MLPs use a gate_up_proj (SiLU-gated) * up projection pattern typical of SwiGLU feed-forward blocks.

text_config.hidden_act = "silu"
("gate_up_proj", "w1", 0),
            ("gate_up_proj", "w3", 1),
model.py · L926–927

model architecture 43

filed at the root 2

token mixer 15

channel mixer 11

positional encoding 1

normalization & residual 2

multimodal architecture 10

context capacity 2

training objective 4

filed at the root 1

language modelling objective 1

auxiliary loss 2

optimization 13

filed at the root 1

optimizer 4

learning-rate schedule 2

training stability 1

training parallelism 3

training runtime 2

data curation 30

data sourcing 2

data filtering 5

deduplication 2

synthetic data 14

data mixture & curriculum 5

sequence packing 2

post-training 41

filed at the root 1

supervised fine-tuning 1

reinforcement learning algorithm 10

reward modelling 1

policy distillation 3

rollout & RL infrastructure 23

agentic post-training 2

inference & serving 40

decoding strategy 3

reasoning control 6

KV cache management 8

inference quantization 2

serving parallelism 1

inference scheduling 3

inference kernel 4

agentic scaffolding 13

software implementation 5

kernel & quantization library 1

agent product 1

infrastructure service 3

evaluation 15

filed at the root 7

benchmark 3

evaluation harness 2

judge 1

human & real-world evaluation 2

other 1

filed at the root 1

unfiled 9

Further reading

Picked by hand, not extracted: where to read more, not evidence for anything on this page.

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.