archdb

LLM architectures and pretraining recipes, with sources.

DeepSeek-V4.1-Flash

DeepSeek · reasoning checkpoint

No base checkpoint is public; facts describe the released post-trained checkpoint. Recipe facts are from the technical report.

Open in the comparison table Hugging Face ↗ Paper ↗

KV calculations use one sequence at 131,072 tokens and 16-bit cache elements. They include bounded sliding-window caches. This is retained cache payload, not peak prefill memory. The comparison table also offers sourced mixed-precision layouts, including quantization scales.

Release

Released

2026-09-10

Source: blog · DeepSeek API Docs news, DeepSeek-V4.1-Flash Release
DeepSeek-V4.1-Flash Release 2026/09/10

Post links the Hugging Face weights and report; arXiv v1 is dated 17 Sep 2026.

Date the weights (or, if earlier, the technical report) were first made public, YYYY-MM-DD, as dated by the publisher. A Hugging Face repository creation date is used only when no dated publisher page exists, with a note.

License

mit

Source: model-card · README.md; YAML front matter
license: mit

License of the released weights as declared by the publisher (model card metadata or license file), e.g. apache-2.0, mit, or the name of a custom license.

Input modalities

text + image

Source: model-card · README.md; Introduction
The model natively processes images and text, and generates text autoregressively.

Input modalities of the released checkpoint as the publisher states them, from: text, image, video, audio, joined with ' + ' in that order ("text", "text + image + video").

Parameters

Total params

552B parameters

Source: paper · p.22 §4.2.1
DeepSeek-V4.1-Flash comprises 552B backbone parameters, with 8B activated per token during prefill and 16B during decode.

Total parameter count as reported by the publisher. See params.note for whether embeddings, MTP heads or vision towers are included.

Active params

16B parameters

Source: paper · p.22 §4.2.1
DeepSeek-V4.1-Flash comprises 552B backbone parameters, with 8B activated per token during prefill and 16B during decode.

Per decoded token; prefill figure under params.active_prefill.

Parameters used per token in the forward pass, as reported by the publisher.

Active params (prefill)

8B parameters

Source: paper · p.22 §4.2.1
DeepSeek-V4.1-Flash comprises 552B backbone parameters, with 8B activated per token during prefill and 16B during decode.

Serving-system figure: prompt tokens run the 20-layer encoder plus decoder SWA replay of the last 128 tokens; the reference inference/model.py runs all 40 layers.

Parameters used per prompt token during prefill when the publisher states it differs from decode (e.g. YOCO-style designs that skip the upper half of the stack).

Active non-embedding (stated)

Not disclosed

Active parameters excluding the input embedding and the output head (unembedding). Stated by the publisher, or computed from params.active by subtracting vocab × d_model for each of the embedding and output head that params.active is stated to include (basis inferred, note with the arithmetic). Not disclosed when the scope of params.active is not stated.

Counted total params

551.6B parameters

Calculated: embedding + output head + all experts + other weights, deepseek-ai/DeepSeek-V4.1-Flash@314113f safetensors headers; reproduces stated total (other modalities) and active (non-embedding)

Parameters of the text backbone counted from the released checkpoint's safetensors headers (embedding, output head, all experts and other weights; excluding MTP modules, vision/audio towers and n-gram lookup tables). Shown only when the counts reproduce the publisher's stated total and active parameters within 5% under some scope.

Counted embedding + head

661.9M parameters

Calculated: input embedding + output head, deepseek-ai/DeepSeek-V4.1-Flash@314113f safetensors headers

Input embedding plus output head (once if tied), counted from the checkpoint.

Counted lookup tables

196.9B parameters

Calculated: n-gram / per-layer embedding tables, deepseek-ai/DeepSeek-V4.1-Flash@314113f safetensors headers

Parameters in n-gram / Engram / per-layer embedding tables counted from the checkpoint. Like the token embedding, they are lookups and are excluded from params.counted_total and params.counted_active_non_embedding.

Non-emb. params (counted)

551B parameters

Calculated: dense + routed backbone weights; excludes input embedding, output head, lookup tables, MTP and other modalities, deepseek-ai/DeepSeek-V4.1-Flash@314113f safetensors headers; reproduces stated total (other modalities) and active (non-embedding)

Language backbone weights excluding input embeddings, output head, lookup/Engram tables, MTP modules and vision/audio towers. Equals params.counted_total minus params.counted_embedding. Same validation as params.counted_total.

Largest layer (counted)

13.77B parameters

Calculated: max(sum of dense and routed weights sharing a full layers.<index> tensor path), all experts included, deepseek-ai/DeepSeek-V4.1-Flash@314113f safetensors headers

Largest group of language-backbone weights sharing a full layers.<index> tensor path, including every routed expert. Excludes lookup/Engram tables, embeddings, output head, MTP and other modalities. Hybrid checkpoints may store mixers and FFNs as separate layers. All-gather volume also depends on wrapping, sharding and dtype.

Active non-emb. (counted)

15.89B parameters

Calculated: non-expert weights + routed experts × 6/384, excluding embedding and output head, deepseek-ai/DeepSeek-V4.1-Flash@314113f safetensors headers; reproduces stated total (other modalities) and active (non-embedding)

Active parameters per token excluding the input embedding and output head, counted from the checkpoint as all non-expert weights plus routed-expert weights × top_k / experts. Same validation as params.counted_total.

Counting scope

Backbone only; the 196B Engram (conditional-memory) parameters are reported separately.

Source: paper · p.7 §2.1
has 552B backbone parameters and 196B Engram parameters

What the publisher's counts include or exclude (MTP modules, embeddings, vision encoder, n-gram tables).

Shape

Layers

40

Source: config · /text_config/num_hidden_layers

Number of transformer blocks in the main backbone (attention or token mixer plus FFN), excluding MTP modules.

d_model

5,120

Source: config · /text_config/hidden_size

Residual stream width.

Vocab

129,280

Source: config · /text_config/vocab_size

Embedding table rows (vocab_size in config, may include padding).

Tied embeddings

No

Source: config · /text_config/tie_word_embeddings

Input embedding and output head share weights.

Lookup memory

Engram, 196B params in 2 modules at layers 1 and 14 (0-indexed); N-gram orders {2, 3, 4}, 8 hash heads, 2048 dims per order, ~16M-entry prime-sized tables, FP8, no short conv

Source: paper · p.13 §2.4.2
We allocate 196B Engram parameters evenly across two modules.

Orders, heads, table sizes, FP8 and layer placement in the same paragraph. config /text_config/engram_layer_ids [1, 14], engram_num_embeddings, engram_max_ngram_size 4, engram_vocab_size 16000000, engram_n_heads 8, engram_head_dim 256, engram_compressed_vocab_size 99092.

Hashed n-gram or conditional-memory tables outside the dense backbone (Engram, n-gram embeddings), with size and placement.

d_model / layers

128

Calculated: d_model / layers

Width-to-depth ratio, d_model divided by the number of blocks.

Attention

Token mixers

SWA, CSA2

Source: paper · p.7 Figure 3
The first two encoder layers use sliding window attention (SWA); the rest use Compressed Sparse Attention 2 (CSA2)

Token-mixing layer types in the backbone, e.g. GQA, MLA, SWA, Gated DeltaNet, Mamba-2, DSA (DeepSeek sparse attention).

Layer layout

2 SWA + 18 CSA2 m=2 (encoder: 3 × [1 Full, 5 Reuse]) + 20 CSA2 m=1 (decoder: [1 Full, 3 Reuse], then 4 × [1 Reindex, 3 Reuse])

Inferred from the source; see the explanation below.

Source: config · config.json; /text_config/compress_ratios, /text_config/kv_source_layer_ids, /text_config/index_source_layer_ids
"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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ]

First 40 compress_ratios entries describe the backbone; the last 3 are DSpark layers. Indices 0–19 are encoder, 20–39 decoder (report §4.2.1). Nonzero ratios retain a 128-token SWA branch in the same layer. Full modes own KV at kv_source_layer_ids [2, 8, 14, 20]; Reindex layers appear in index_source_layer_ids but do not own KV ([24, 28, 32, 36]); the remaining CSA2 layers reuse both. See inference/model.py Attention.__init__.

Token-mixer order, summarized as a pattern or layer positions. The fact's optional sequence lists each mixer in order; a ratio alone does not establish the order. Auxiliary prediction modules and standalone FFNs are excluded.

Global-attention layers

38

Inferred from the source; see the explanation below.

Source: paper · p.7 §2.1
Each layer incorporates both global attention and sliding window attention (SWA), except for the first two layers, which use SWA only.

40 layers minus 2 SWA-only layers. Global KV is shared across layers: only layers 2, 8, 14 and 20 compute it (/text_config/kv_source_layer_ids).

Layers whose KV cache grows with full context (dense or sparse global attention, MLA). Excludes sliding-window and linear/recurrent layers.

SWA : global

0.0526316

Calculated: attn.local_layers / attn.global_layers

attn.local_layers divided by attn.global_layers, the sliding-window to global interleave ratio (5 for '5 SWA : 1 global').

Sliding-window layers

2

Source: paper · p.22 §4.2.1
For the first two layers, we use pure sliding window attention.

Counts SWA-only layers; the 38 CSA2 layers also have a 128-token SWA branch.

Layers with a fixed attention window.

Query heads

64

Source: config · /text_config/num_attention_heads

Grouped low-rank output projection: /text_config/o_groups 8 groups, /text_config/o_lora_rank 1024 each.

Query heads in the global-attention layers.

KV heads

1

Source: config · /text_config/num_key_value_heads

Key/value heads in the global-attention layers. Not applicable to MLA, whose cache is a shared latent.

Heads × head dim

32,768

Calculated: heads × head_dim

attn.heads × attn.head_dim, the query projection width of global layers.

Q heads / KV head

64

Calculated: heads / kv_heads

attn.heads divided by attn.kv_heads in global layers.

QK head dim

512

Source: config · /text_config/head_dim

Query/key dimension per head in global-attention layers (for MLA, nope + rope dims).

Window

128 tokens

Source: config · /text_config/sliding_window

Sliding-window size of the local layers.

SWA KV heads

1

Source: config · /text_config/num_key_value_heads

KV heads in sliding-window layers (stated even when equal to attn.kv_heads).

SWA query heads

64

Source: config · /text_config/num_attention_heads

SWA-only layers (compress ratio 0) use the same Attention class with n_heads, head_dim and one shared KV head.

Query heads in sliding-window layers (stated even when equal to attn.heads).

SWA QK head dim

512

Source: config · /text_config/head_dim

Query/key head dimension in sliding-window layers. Value head dimensions may differ; see attn.local_v_head_dim.

MLA Q latent

1,280

Source: config · /text_config/q_lora_rank

Width of the low-rank query projection in MLA; 0 when queries use a full-rank projection.

Positional encoding

partial RoPE (last 64 dims of Q and KV; inverse rotation on attention output)

Source: code · inference/model.py lines 632–633 (Attention.__init__) and 766–782 (Attention.forward)
apply_rotary_emb(o[..., -rd:], freqs_cis, True)

forward rotates q[..., -rd:] and the KV tail (rope_head_dim 64), and applies the inverse rotation to o[..., -rd:].

Positional scheme in global layers: RoPE, partial RoPE, NoPE, or mixed per layer type.

RoPE base

160,000

Source: config · /text_config/compress_rope_theta

CSA2 layers use compress_rope_theta with YaRN (factor 16, original 65536); the 2 SWA-only layers use rope_theta=10000 without YaRN (inference/model.py lines 681–688).

RoPE base frequency of the global layers at release.

SWA RoPE base

10,000

Source: config · /text_config/rope_theta

Compress-ratio-0 layers use rope_theta without YaRN (Attention.__init__).

RoPE base frequency of the sliding-window layers (stated even when equal to attn.rope_theta).

Rotary fraction

0.125

Inferred from the source; see the explanation below.

Source: code · inference/model.py lines 632–633; Attention.__init__
self.nope_head_dim = args.head_dim - args.rope_head_dim

/text_config/qk_rope_head_dim 64 of /text_config/head_dim 512.

Fraction of each head's QK dimensions that are rotated.

QK norm

No

Source: code · inference/model.py; Attention.forward
q = self.wq_b(qr).unflatten(-1, (self.n_local_heads, self.head_dim))

Only the single shared KV head is RMSNormed (kv_norm, compressor norm); queries get no per-head norm, unlike V4.

Queries and keys are normalized per head before the dot product.

Sparse attention

CSA2 indexer (32 heads × 128), top-512 KV entries; decoder hierarchical indexer limited to a 2048-block × 8-position candidate pool

Source: paper · p.22 §4.2.1
For all CSA2 layers, we set the number of indexer query heads to 32, the indexer head dimension to 128, and the number of KV entries selected for sparse attention (i.e., attention top-k) to 512.

The hierarchical candidate pool is introduced in post-training (p.12 §2.3.2); config /text_config/candidate_source_layer_id 20, candidate_topk_blocks 2048, candidate_block_size 8; index_n_heads 32, index_head_dim 128, index_topk 512.

Token-selection mechanism inside global layers, e.g. DSA lightning indexer with top-k.

Attention sinks

learnable per-head sink logit in the softmax denominator, every layer

Source: code · inference/model.py line 640; Attention.__init__
self.attn_sink = nn.Parameter(torch.empty(self.n_local_heads, dtype=torch.float32))

Learned sink logits or sink bias in the softmax, with the layer types that use them.

QKV bias

No

Source: config · /text_config/attention_bias

Query/key/value projections have bias terms.

Cross-layer KV sharing

Main KV and indexer K owned by layers 2, 8, 14 (encoder, m=2, each serving its 6-layer group) and 20 (decoder, m=1, serving layers 20–39, computed from the last encoder layer's output); other CSA2 layers read them. Each layer keeps its own 128-token SWA KV.

Source: paper · p.22 §4.2.1; p.10–11 §2.3.1
In each group, the first layer operates in Full Mode, and the remaining five layers operate in Reuse Mode.

Owners in /text_config/kv_source_layer_ids; /text_config/index_source_layer_ids adds Reindex layers 24, 28, 32, 36 that rescore the shared cache with their own indexer Q.

Layers that reuse another layer's KV cache instead of computing their own (YOCO-style, cross-layer attention), and which layers own caches.

KV cache groups
  • encoder main KV (m=2)

    Layers
    3
    Elements
    512
    Tokens per entry
    2
    Source: code · inference/model.py; Attention.__init__, Compressor.forward, Indexer.__init__
    compress_ratio > 0 does not mean the layer compresses its own KV: only kv_source_layers do, the rest read that same cache.

    Layers 2, 8, 14; one shared K=V entry per 2 tokens.

  • encoder indexer K (m=2)

    Layers
    3
    Elements
    128
    Tokens per entry
    2
    Source: code · inference/model.py; Attention.__init__, Compressor.forward, Indexer.__init__
    torch.zeros(args.max_batch_size, args.max_seq_len // self.compress_ratio, args.index_head_dim)

    Indexer.k_cache of the same owner layers.

  • decoder main KV (m=1)

    Layers
    1
    Elements
    512
    Tokens per entry
    1
    Source: code · inference/model.py; Attention.__init__, Compressor.forward, Indexer.__init__
    if ratio == 1: # one token per group: nothing to pool, so no gate and no fp32

    Layer 20; ratio-1 compressor is a plain projection.

  • decoder indexer K (m=1)

    Layers
    1
    Elements
    128
    Tokens per entry
    1
    Source: code · inference/model.py; Attention.__init__, Compressor.forward, Indexer.__init__
    self.owns_k = layer_id in args.kv_source_layers

    Layer 20.

  • SWA window

    Layers
    40
    Elements
    512
    Window
    128
    Source: code · inference/model.py; Attention.__init__, Compressor.forward, Indexer.__init__
    torch.zeros(args.max_batch_size, args.window_size, self.head_dim)

    window_kv_cache in every backbone layer; DSpark layers excluded.

Source: code · inference/model.py; Attention.__init__, Compressor.forward, Indexer.__init__

Cache owners and entry shapes for compressed or shared attention. Each item specifies layers owning the cache, scalar elements per entry (K and V together), tokens_per_entry (compression ratio, default 1), and optionally window (maximum entries retained). Completed compressed entries are floor(context / tokens_per_entry); incomplete compressor state is excluded. KV sizes use these groups when present.

KV storage formats
  • encoder main KV (m=2)

    Group
    encoder main KV (m=2)
    Elements
    512
    Bits
    4
    Format
    FP4 E2M1; E4M3 scales per 16 channels
    Scale count
    32
    Scale bits
    8
    At
    README.md; V4.1 fp4 layout: 256 data bytes + 32 scale bytes
    Source: code · README.md; V4.1 fp4 layout: 256 data bytes + 32 scale bytes
    The scale row is 32 Bytes of `float8_e4m3`

    Post-training/serving recipe, not pretraining precision. Main KV: 288 bytes/entry; indexer K: 68; SWA: 528. Global growth = (3/2 + 1) × (288 + 68) = 890 bytes/token, matching report p.1 Figure 1(b). The finite SWA rings are additional runtime cache, not part of that global figure. FP4 main-cache QAT is introduced in post-training (§2.4.4).

  • decoder main KV (m=1)

    Group
    decoder main KV (m=1)
    Elements
    512
    Bits
    4
    Format
    FP4 E2M1; E4M3 scales per 16 channels
    Scale count
    32
    Scale bits
    8
    At
    README.md; V4.1 fp4 layout: 256 data bytes + 32 scale bytes
    Source: code · README.md; V4.1 fp4 layout: 256 data bytes + 32 scale bytes
    The scale row is 32 Bytes of `float8_e4m3`

    Post-training/serving recipe, not pretraining precision. Main KV: 288 bytes/entry; indexer K: 68; SWA: 528. Global growth = (3/2 + 1) × (288 + 68) = 890 bytes/token, matching report p.1 Figure 1(b). The finite SWA rings are additional runtime cache, not part of that global figure. FP4 main-cache QAT is introduced in post-training (§2.4.4).

  • encoder indexer K (m=2)

    Group
    encoder indexer K (m=2)
    Elements
    128
    Bits
    4
    Format
    MXFP4 E2M1; E8M0 scales per 32 channels
    Scale count
    4
    Scale bits
    8
    At
    inference/model.py lines 28–30, 546; fp4_act_quant(k, fp4_block_size, True)
    Source: code · inference/model.py lines 28–30, 546; fp4_act_quant(k, fp4_block_size, True)
    fp4_block_size = 32

    Post-training/serving recipe, not pretraining precision. Main KV: 288 bytes/entry; indexer K: 68; SWA: 528. Global growth = (3/2 + 1) × (288 + 68) = 890 bytes/token, matching report p.1 Figure 1(b). The finite SWA rings are additional runtime cache, not part of that global figure. FP4 main-cache QAT is introduced in post-training (§2.4.4).

  • decoder indexer K (m=1)

    Group
    decoder indexer K (m=1)
    Elements
    128
    Bits
    4
    Format
    MXFP4 E2M1; E8M0 scales per 32 channels
    Scale count
    4
    Scale bits
    8
    At
    inference/model.py lines 28–30, 546; fp4_act_quant(k, fp4_block_size, True)
    Source: code · inference/model.py lines 28–30, 546; fp4_act_quant(k, fp4_block_size, True)
    fp4_block_size = 32

    Post-training/serving recipe, not pretraining precision. Main KV: 288 bytes/entry; indexer K: 68; SWA: 528. Global growth = (3/2 + 1) × (288 + 68) = 890 bytes/token, matching report p.1 Figure 1(b). The finite SWA rings are additional runtime cache, not part of that global figure. FP4 main-cache QAT is introduced in post-training (§2.4.4).

  • SWA window

    Group
    SWA window
    Elements
    512
    Bits
    8
    Format
    FP8 E4M3; E8M0 scales per 32 channels
    Scale count
    16
    Scale bits
    8
    At
    README.md; V4.1 FP8 layout: 512 data bytes + 16 scale bytes
    Source: code · README.md; V4.1 FP8 layout: 512 data bytes + 16 scale bytes
    The scale row is 16 Bytes of `float8_e8m0`

    Post-training/serving recipe, not pretraining precision. Main KV: 288 bytes/entry; indexer K: 68; SWA: 528. Global growth = (3/2 + 1) × (288 + 68) = 890 bytes/token, matching report p.1 Figure 1(b). The finite SWA rings are additional runtime cache, not part of that global figure. FP4 main-cache QAT is introduced in post-training (§2.4.4).

Source: code · README.md; MLA Decoding / FP8 KV Cache; per-entry storage layouts

Post-training/serving recipe, not pretraining precision. Main KV: 288 bytes/entry; indexer K: 68; SWA: 528. Global growth = (3/2 + 1) × (288 + 68) = 890 bytes/token, matching report p.1 Figure 1(b). The finite SWA rings are additional runtime cache, not part of that global figure. FP4 main-cache QAT is introduced in post-training (§2.4.4).

Sourced storage components of attn.kv_groups. Each component names its group and gives elements, bits per element, format, scale_count, scale_bits and padding_bytes per entry. Different parts of one entry can have different formats. Sourced-storage sizes are available only when every group's elements are covered. These are inference-cache formats; they do not establish pretraining precision.

Feed-forward

Activation

SwiGLU

Source: paper · p.22 §4.2.1
using SwiGLU activation function with clamping (OpenAI, 2025) at a threshold of 10

config /text_config/hidden_act silu.

FFN activation (SwiGLU, GeGLU, ...).

Activation clamp

up (linear) clamped to [−10, 10], gate capped at 10; routed and shared experts in every layer

Source: code · inference/model.py lines 846–849; Expert.forward
up = torch.clamp(up, min=-self.swiglu_limit, max=self.swiglu_limit)

Gate is clamped with max only; limit 10 from /text_config/swiglu_limit and p.22 §4.2.1.

Clamping of GLU gate / up activations (e.g. SwiGLU limit 7), with the layers it applies to.

FFN bias

No

Source: code · inference/model.py lines 836–841; Expert.__init__
self.w1 = Linear(dim, inter_dim, dtype=dtype)

Linear defaults to bias=False; shared and routed experts both use Expert.

FFN projections have bias terms.

Mixture of experts

Routed experts

384

Source: config · /text_config/n_routed_experts

Routed experts per MoE layer.

Experts per token

6

Source: config · /text_config/num_experts_per_tok

Routed experts selected per token.

Shared experts

1

Source: config · /text_config/n_shared_experts

Always-on experts per MoE layer.

Expert dim

2,304

Source: config · /text_config/moe_intermediate_size

Intermediate width of one routed expert.

Shared expert dim

2,304

Source: config · /text_config/moe_intermediate_size

1 shared expert (/text_config/n_shared_experts) of the routed-expert width.

Total intermediate width of the shared expert(s).

Leading dense layers

0

Source: paper · p.22 §4.2.1
We employ MoE layers in all Transformer blocks

Number of initial blocks that use a dense FFN instead of MoE.

Router score

sqrt(softplus)

Source: code · inference/model.py line 819; Gate.forward
scores = F.softplus(scores).sqrt()

/text_config/scoring_func is sqrtsoftplus.

Gating function over expert logits (softmax, sigmoid).

Load balancing

aux-loss-free bias with separate text and image biases (update speed 0.001) + sequence-level loss 1e-4

Source: paper · p.22 §4.2.2
we set the bias update speed to 0.001 for both image and text tokens, while retaining a small sequence-level balance loss with a loss weight of 0.0001

Modality-specific biases: p.8 §2.1.1. Bias enters top-k selection only (/text_config/topk_method noaux_tc).

Load-balancing method, with coefficients where disclosed.

Routed scaling factor

1.5

Source: config · /text_config/routed_scaling_factor

Multiplier applied to the combined routed-expert output (routed_scaling_factor).

Renormalize top-k

Yes

Source: config · /text_config/norm_topk_prob

Selected expert weights are renormalized to sum to 1.

Expert dim / d_model

0.45

Calculated: moe.expert_dim / d_model

moe.expert_dim divided by shape.d_model.

Sparsity (experts / top-k)

64

Calculated: experts / top_k

Routed experts divided by experts selected per token.

Active / total

0.0289855

Calculated: params.active / params.total

params.active divided by params.total.

Multi-token prediction

MTP depth

0

Source: paper · p.8 §2.1
We omit the MTP module during backbone pre-training and use DSpark (Cheng et al., 2026a) for speculative decoding.

The DSpark drafter is trained after pre-training with the backbone frozen.

Additional future tokens predicted during pretraining (0 when the model was trained without MTP).

Normalization and stability

Norm

RMSNorm

Source: code · inference/model.py lines 935–936; Block.__init__
self.attn_norm = RMSNorm(args.dim, self.norm_eps)

Normalization layer type in the blocks.

Norm placement

pre

Source: code · inference/model.py lines 983–995; Block.forward
x = self.attn_norm(x)

Sublayers sit inside Single-Pass mHC (hc_pre/hc_post), expansion 4.

Pre-norm, post-norm, or sandwich (pre and post).

Norm epsilon

1e-20

Source: config · /text_config/rms_norm_eps

Used by attn_norm, ffn_norm, q/kv norms and the final norm in inference/model.py (norm_eps); the mHC Sinkhorn eps is separate (hc_eps 1e-6).

Epsilon of the block normalization layers.

Residual stream

Single-Pass mHC: 4 residual streams, Sinkhorn-Knopp (20 iterations); each sublayer's input mixing uses the coefficients predicted at the previous sublayer

Source: paper · p.22 §4.2.1
As for mHC, the expansion factor is set to 4, and the number of Sinkhorn-Knopp iterations is set to 20.

Single-Pass shift: p.13 §2.4.1 (pre-training keeps the multi-kernel implementation); Block.forward in inference/model.py. config /text_config/hc_mult 4, hc_sinkhorn_iters 20.

Residual design when it is not a plain sum, e.g. hyper-connections with n streams, gated residuals, depth-scaled residuals, FP32 residual accumulation.

Context length

Pretraining context

65.54K tokens

Source: paper · p.22 §4.2.2
We train the model from scratch with sparse attention at a sequence length of 64K

Sequence length of the main pretraining stage.

Trained context

1.049M tokens

Source: paper · p.22 §4.2.2
extend the sequence length to 1M at 34T tokens.

Longest sequence length trained on after context extension.

Advertised context

1.049M tokens

Source: config · /text_config/max_position_embeddings

Longest context the publisher says the model supports, possibly beyond trained length via RoPE scaling.

Extension method

64K → 1M at 34T tokens; CSA2 layers use YaRN (factor 16, original 65536)

Source: paper · p.22 §4.2.2
We train the model from scratch with sparse attention at a sequence length of 64K and extend the sequence length to 1M at 34T tokens.

config /text_config/rope_scaling: rope_type yarn, factor 16, beta_fast 32, beta_slow 1, original_max_position_embeddings 65536.

How context was extended (stages, RoPE base change, YaRN factor).

Pretraining recipe

Pretraining tokens

45T tokens

Source: paper · p.22 §4.2.2
We train DeepSeek-V4.1-Flash on 45T tokens of multimodal data with no instability.

Tokens seen in pretraining including annealing and context extension, as reported.

Optimizer

Muon + AdamW (Muon for linear weights, head-wise for Q/K; AdamW for RMSNorm and other non-matrix params; Sinkhorn-balanced momentum update for embeddings, Engram tables and prediction head)

Source: paper · p.22 §4.2.2
We employ the Muon optimizer (Jordan et al., 2024; Liu et al., 2025) for the parameters of linear transformations, use AdamW optimizer (Loshchilov and Hutter, 2019) for the weights of all RMSNorm modules and other non-matrix parameters, and use Sinkhorn-balanced update for all embeddings and prediction head.

Muon: Nesterov momentum 0.95, weight decay 0.1, update RMS 0.18. Sinkhorn: K = 11, τ = 1e-3, ε = 1e-20, no weight decay. Engram LR scaled 5×. Head-wise Q/K Muon: p.15 §2.5.

Optimizer used for the bulk of parameters.

Peak LR

0.00026

Source: paper · p.22 §4.2.2
The learning rate is linearly warmed up over the first 2000 steps and then maintained at 2.6 × 10−4 until 28T tokens.

Peak learning rate of the main pretraining stage.

Final LR

2.6e-05

Source: paper · p.22 §4.2.2
Between 28T and 40T tokens, we decay the learning rate to 2.6 × 10−5 following a cosine schedule.

Learning rate at the end of the decay.

LR schedule

2000-step linear warmup, constant 2.6e-4 to 28T, cosine to 2.6e-5 at 40T, constant to 45T

Source: paper · p.22 §4.2.2
Between 28T and 40T tokens, we decay the learning rate to 2.6 × 10−5 following a cosine schedule. We keep the learning rate at this value from 40T to 45T tokens.

Learning-rate schedule shape with phase boundaries.

Warmup

2000 steps

Source: paper · p.22 §4.2.2
The learning rate is linearly warmed up over the first 2000 steps

Warmup length in steps or tokens.

Batch size

100.6M tokens, fixed

Source: paper · p.22 §4.2.2
We keep the batch size fixed at 100.6 million tokens throughout training.

Global batch size, including any batch-size ramp: sequences × sequence length (token total), or the token total alone when only that is stated.

Batch (tokens)

100.6M tokens

Source: paper · p.22 §4.2.2
We keep the batch size fixed at 100.6 million tokens throughout training.

Global batch size in tokens during the main pretraining stage, after any ramp (sequences × sequence length when stated in sequences, marked inferred).

Weight decay

0.1

Source: paper · p.22 §4.2.2
For AdamW, we set its hyper-parameters to 𝛽1 = 0.9, 𝛽2 = 0.95, 𝜀 = 10 −20 , and weight_decay = 0.1.

Decoupled weight decay coefficient.

Adam betas

(0.9, 0.95)

Source: paper · p.22 §4.2.2
For AdamW, we set its hyper-parameters to 𝛽1 = 0.9, 𝛽2 = 0.95, 𝜀 = 10 −20 , and weight_decay = 0.1.

(beta1, beta2) of the Adam-family optimizer or its AdamW fallback.

Grad clip

Not disclosed

Global gradient-norm clipping threshold.

Training precision

Not disclosed

Matmul precision of pretraining (BF16, FP8 recipe, NVFP4 recipe) with the scaling granularity where disclosed. Never inferred from the released checkpoint dtype.

Document masking

sample-level attention masking within packed sequences

Source: paper · p.22 §4.2.2
Similar to DeepSeek-V4, we employ sample-level attention masking during pre-training.

Whether attention crosses document boundaries within a packed sequence.

Extra objectives

multimodal (image + text) input from the start of pretraining

Source: paper · p.7 §2.1
with multimodal data incorporated from the start of language-model pre-training

Vision encoder frozen until LR decay, then trained jointly at a smaller LR (p.15 §2.5).

Objectives beyond next-token prediction and MTP (fill-in-the-middle rate, distillation, multimodal tokens from the start).

Data mix

text-only : multimodal = 7:1 tokens; multimodal = image-text pairs, interleaved image-text, domain-specific (grounding, OCR, image-code, computer-use)

Source: paper · p.21 §4.1
the resulting corpus uses a 7:1 token ratio of text-only to multimodal data.

Pretraining data composition as disclosed (domain shares, synthetic fraction, repetition).

Stages
  • main

    Tokens
    34000000000000
    Seq len
    65536
    Source: paper · p.22 §4.2.2
    We train the model from scratch with sparse attention at a sequence length of 64K

    Sparse attention from scratch.

  • long

    Tokens
    11000000000000
    Seq len
    1048576
    Source: paper · p.22 §4.2.2
    extend the sequence length to 1M at 34T tokens.

    34T to 45T.

Source: paper · p.22 §4.2.2

Ordered pretraining stages. Each item: name, tokens, seq_len, lr, batch_tokens, batch_sequences, steps, note, quote, and source when it differs from the fact's source.

Scaling & HP transfer

HP selection rule

AdamW LR reused for Muon by rescaling update RMS to 0.18

Source: paper · p.22 §4.2.2
rescale the RMS of each update matrix to 0.18 for reutilization of the AdamW learning rate

How peak LR, batch size or other hyperparameters were chosen for the released run (fitted scaling law with its formula, μP transfer from a proxy width, sweep), as stated.

Scaling ladder

ladder over model parameters and training data (sizes not disclosed)

Source: paper · p.20 §4.1
a scaling ladder over model parameters and training data is carefully designed to guide large-scale training runs

Smaller models trained to choose the architecture or recipe (sizes, token budgets), as disclosed.

Tokens / param

81.5217

Calculated: train.tokens / params.total

train.tokens divided by params.total.

Tokens / active param (non-embedding)

2,832.08

Calculated: train.tokens / params.counted_active_non_embedding

train.tokens divided by params.counted_active_non_embedding, or by the stated params.active_non_embedding when there is no validated checkpoint count.

KV cache

KV bytes / token

3,240 bytes

Calculated: kv.bytes_at_context / 131072 tokens; uniform BF16, payload only; quantization overhead excluded. encoder main KV (m=2): 3 × (512 × 16/8) B/entry; encoder indexer K (m=2): 3 × (128 × 16/8) B/entry; decoder main KV (m=1): 1 × (512 × 16/8) B/entry; decoder indexer K (m=1): 1 × (128 × 16/8) B/entry; SWA window: 40 × (512 × 16/8) B/entry

Retained KV cache divided by context length, including bounded SWA caches and indexer keys. Exports use uniform BF16 at 131,072 tokens. The website can select uniform payload precision (no quantization overhead) or sourced component formats (including scales and documented padding). This is cache payload, not peak prefill memory or persistent prefix storage.

Global KV bytes / token

3,200 bytes

Calculated: 3072 B / 2 tokens (encoder main KV (m=2)) + 768 B / 2 tokens (encoder indexer K (m=2)) + 1024 B / 1 tokens (decoder main KV (m=1)) + 256 B / 1 tokens (decoder indexer K (m=1)); uniform BF16, payload only; quantization overhead excluded. encoder main KV (m=2): 3 × (512 × 16/8) B/entry; encoder indexer K (m=2): 3 × (128 × 16/8) B/entry; decoder main KV (m=1): 1 × (512 × 16/8) B/entry; decoder indexer K (m=1): 1 × (128 × 16/8) B/entry; SWA window: 40 × (512 × 16/8) B/entry

Long-context global KV bytes per token, including indexer keys; excludes bounded SWA caches. Compression rates and cross-layer cache reuse are included. Exports use uniform BF16; the website's storage selector also applies here. This is the field to compare with global-KV figures in reports, using the matching storage recipe.

KV bytes / token / B active

202 bytes

Calculated: kv.bytes_per_token (131072 tokens) / (params.active / 1e9); uniform BF16, payload only; quantization overhead excluded. encoder main KV (m=2): 3 × (512 × 16/8) B/entry; encoder indexer K (m=2): 3 × (128 × 16/8) B/entry; decoder main KV (m=1): 1 × (512 × 16/8) B/entry; decoder indexer K (m=1): 1 × (128 × 16/8) B/entry; SWA window: 40 × (512 × 16/8) B/entry

kv.bytes_per_token divided by active parameters in billions (131,072 tokens in exports).

KV at context / B active

26,542,080 bytes

Calculated: kv.bytes_at_context (131072 tokens) / (params.active / 1e9); uniform BF16, payload only; quantization overhead excluded. encoder main KV (m=2): 3 × (512 × 16/8) B/entry; encoder indexer K (m=2): 3 × (128 × 16/8) B/entry; decoder main KV (m=1): 1 × (512 × 16/8) B/entry; decoder indexer K (m=1): 1 × (128 × 16/8) B/entry; SWA window: 40 × (512 × 16/8) B/entry

kv.bytes_at_context divided by active parameters in billions (131,072 tokens in exports).

KV at context

424,673,280 bytes

Calculated: 3072 B × floor(131072 / 2) (encoder main KV (m=2)) + 768 B × floor(131072 / 2) (encoder indexer K (m=2)) + 1024 B × 131072 (decoder main KV (m=1)) + 256 B × 131072 (decoder indexer K (m=1)) + 40960 B × min(131072, 128) (SWA window); uniform BF16, payload only; quantization overhead excluded. encoder main KV (m=2): 3 × (512 × 16/8) B/entry; encoder indexer K (m=2): 3 × (128 × 16/8) B/entry; decoder main KV (m=1): 1 × (512 × 16/8) B/entry; decoder indexer K (m=1): 1 × (128 × 16/8) B/entry; SWA window: 40 × (512 × 16/8) B/entry

Retained KV cache for one sequence at the selected context, including SWA windows and indexer keys. Exports use uniform BF16 at 131,072 tokens. Excludes recurrent state, compressor tail state, draft/MTP caches, temporary prefill tensors, allocator metadata and persistent prefix snapshots. Does not estimate peak prefill or total serving memory.

Evaluations

AA Intelligence Index

39

Source: leaderboard · Artificial Analysis model page /models/deepseek-v4-1-flash, Wayback snapshot 2026-10-19
DeepSeek V4.1 Flash (Max) scores 39 on the Artificial Analysis Intelligence Index

Variant: DeepSeek V4.1 Flash (Max). AA entry for the 0910 release, which matches this record's weights (the 1017 update has its own entry). Index v4.3.2.

Artificial Analysis Intelligence Index v4.3.2 of the post-trained model, from a dated Wayback snapshot of its Artificial Analysis page. The note names the variant (reasoning setting).

All models · Link to this model