archdb

LLM architectures and pretraining recipes, with sources.

DeepSeek-V4-Flash-Base

DeepSeek · base checkpoint

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-04-24

Source: blog · DeepSeek API Docs news, DeepSeek-V4 Preview Release
DeepSeek-V4 Preview Release 2026/04/24

Same post announces open weights; arXiv v1 is dated 26 Apr 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 · LICENSE (repository has no model card)
MIT License

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

Inferred from the source; see the explanation below.

Source: paper · p.45 §6 Conclusion, Limitations, and Future Directions
We are also working on incorporating multimodal capabilities to our models.

The report names multimodality as future work and the config (DeepseekV4ForCausalLM) has no vision tower; vision came later as the separate V4-Flash-Vision-Exp.

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

284B parameters

Source: paper · p.24 §4.2.1
DeepSeek-V4-Flash comprises 284B total parameters, of which 13B are activated for each token.

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

Active params

13B parameters

Source: paper · p.24 §4.2.1
DeepSeek-V4-Flash comprises 284B total parameters, of which 13B are activated for each token.

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

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

284.3B parameters

Calculated: embedding + output head + all experts + other weights, deepseek-ai/DeepSeek-V4-Flash-Base@8855555 safetensors headers; reproduces stated total (backbone) 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

529.5M parameters

Calculated: input embedding + output head, deepseek-ai/DeepSeek-V4-Flash-Base@8855555 safetensors headers

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

Non-emb. params (counted)

283.8B parameters

Calculated: dense + routed backbone weights; excludes input embedding, output head, lookup tables, MTP and other modalities, deepseek-ai/DeepSeek-V4-Flash-Base@8855555 safetensors headers; reproduces stated total (backbone) 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)

6.596B parameters

Calculated: max(sum of dense and routed weights sharing a full layers.<index> tensor path), all experts included, deepseek-ai/DeepSeek-V4-Flash-Base@8855555 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)

13.27B parameters

Calculated: non-expert weights + routed experts × 6/256, excluding embedding and output head, deepseek-ai/DeepSeek-V4-Flash-Base@8855555 safetensors headers; reproduces stated total (backbone) 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.

Shape

Layers

43

Source: config · /num_hidden_layers

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

d_model

4,096

Source: config · /hidden_size

Residual stream width.

Vocab

129,280

Source: config · /vocab_size

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

Tied embeddings

No

Source: config · /tie_word_embeddings

Input embedding and output head share weights.

Tokenizer

DeepSeek-V3 byte-level BPE plus special tokens for context construction; 128K vocab

Source: paper · p.24 §4.1
on top of the DeepSeek-V3 tokenizer, we introduce a few special tokens for context construction

Tokenizer type and lineage as described by the publisher (e.g. byte-level BPE shared with an earlier model).

d_model / layers

95.2558

Calculated: d_model / layers

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

Attention

Token mixers

SWA, CSA, HCA (CSA and HCA each with a 128-token SWA branch)

Source: paper · p.24 §4.2.1
For the first two layers, we use pure sliding window attention. For the subsequent layers, CSA and HCA are used in an interleaved manner.

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

Layer layout

2 SWA, then 1 CSA : 1 HCA (21 CSA + 20 HCA)

Inferred from the source; see the explanation below.

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

Counts from /compress_ratios (0 = SWA, 4 = CSA, 128 = HCA; trailing 0 is the MTP block). First 43 /compress_ratios entries only; trailing MTP/DSpark entries excluded. Nonzero ratios retain an SWA branch in the same layer.

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

41

Inferred from the source; see the explanation below.

Source: paper · p.24 §4.2.1
For the first two layers, we use pure sliding window attention. For the subsequent layers, CSA and HCA are used in an interleaved manner.

43 layers minus 2 pure-SWA layers; /compress_ratios has 21 × 4 and 20 × 128.

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

SWA : global

0.0487805

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.24 §4.2.1
For the first two layers, we use pure sliding window attention.

Layers with a fixed attention window.

Query heads

64

Source: config · /num_attention_heads

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

Query heads in the global-attention layers.

KV heads

1

Source: config · /num_key_value_heads

Shared-KV MQA: one KV head serves as both key and value (p.11 §2.3.1).

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 · /head_dim

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

Window

128 tokens

Source: config · /sliding_window

Sliding-window size of the local layers.

SWA KV heads

1

Source: 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 · /num_attention_heads

Pure-SWA 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 · /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,024

Source: 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 entries; inverse rotation on attention output)

Source: paper · p.13 §2.3.3
we partially employ the Rotary Positional Embedding (RoPE)

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

RoPE base

160,000

Source: config · /compress_rope_theta

Compressed (CSA/HCA) layers use compress_rope_theta with YaRN (factor 16, original 65536); the 2 pure-SWA layers use rope_theta=10000 without YaRN (V4-Flash inference/model.py lines 475–479).

RoPE base frequency of the global layers at release.

SWA RoPE base

10,000

Source: 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: paper · p.13 §2.3.3
we apply RoPE to its last 64 dimensions

64 (/qk_rope_head_dim) of 512 head dims (/head_dim).

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

QK norm

Yes

Source: paper · p.12 §2.3.3
we perform an additional RMSNorm operation on each head of the queries and the only head of the compressed KV entries, just before the core attention operation.

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

Sparse attention

CSA: lightning indexer (64 heads × 128) selects top-512 of 4×-compressed KV entries; HCA (128×) attends densely

Source: paper · p.24 §4.2.1
the number of KV entries selected for sparse attention (i.e., attention top-k) to 512

HCA does not employ sparse attention (p.11 §2.3.2); config /index_n_heads 64, /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 (CSA, HCA and the 2 pure-SWA layers)

Source: config · model.safetensors.index.json; /weight_map
"layers.0.attn.attn_sink"

Layers 0–1 are the pure-SWA layers and carry attn_sink weights; sink formula p.13 §2.3.3 (described for CSA/HCA).

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

QKV bias

No

Source: config · /attention_bias

Query/key/value projections have bias terms.

KV cache groups
  • CSA main KV

    Layers
    21
    Elements
    512
    Tokens per entry
    4
    Source: code · V4-Flash inference/model.py; Attention.__init__, Attention.forward, Indexer.__init__
    kv_cache_size = args.window_size + (args.max_seq_len // self.compress_ratio if self.compress_ratio else 0)

    Layers with /compress_ratios 4; one shared K=V entry of head_dim per 4 tokens.

  • CSA indexer K

    Layers
    21
    Elements
    128
    Tokens per entry
    4
    Source: code · V4-Flash inference/model.py; Attention.__init__, Attention.forward, Indexer.__init__
    self.register_buffer("kv_cache", torch.zeros(args.max_batch_size, args.max_seq_len // compress_ratio, self.head_dim), persistent=False)

    One index_head_dim key per compressed entry (Indexer.kv_cache).

  • HCA main KV

    Layers
    20
    Elements
    512
    Tokens per entry
    128
    Source: code · V4-Flash inference/model.py; Attention.__init__, Attention.forward, Indexer.__init__
    self.register_buffer("kv_cache", torch.zeros(args.max_batch_size, kv_cache_size, self.head_dim), persistent=False)

    Layers with /compress_ratios 128; no indexer.

  • SWA window

    Layers
    43
    Elements
    512
    Window
    128
    Source: code · V4-Flash inference/model.py; Attention.__init__, Attention.forward, Indexer.__init__
    self.kv_cache[:bsz, start_pos % win] = kv.squeeze(1)

    Ring buffer in every backbone layer (the 2 pure-SWA layers and the SWA branch of CSA/HCA); MTP block excluded.

Source: code · V4-Flash inference/model.py; Attention.__init__, Attention.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
  • CSA main KV NoPE

    Group
    CSA main KV
    Elements
    448
    Bits
    8
    Format
    FP8 E4M3; E8M0 scales per 64 channels
    Scale count
    7
    Scale bits
    8
    Padding bytes
    1
    At
    README.md; V4 layout: 448 NoPE bytes, 7 scale bytes and 1 padding byte
    Source: code · README.md; V4 layout: 448 NoPE bytes, 7 scale bytes and 1 padding byte
    The scale row is 8 Bytes

    Serving layout from the official FlashMLA kernels and post-training FP4 indexer QAT; main KV keeps the RoPE tail in BF16. Each main/SWA entry is 584 bytes, each indexer entry 68 bytes. This serving recipe is documented for the post-trained V4-Flash sibling; it does not establish FP4 QAT of the base checkpoint.

  • CSA main KV RoPE

    Group
    CSA main KV
    Elements
    64
    Bits
    16
    Format
    BF16
    At
    README.md; V4 layout: 128 RoPE bytes
    Source: code · README.md; V4 layout: 128 RoPE bytes
    the 64 `bfloat16` RoPE values (not quantized)

    Serving layout from the official FlashMLA kernels and post-training FP4 indexer QAT; main KV keeps the RoPE tail in BF16. Each main/SWA entry is 584 bytes, each indexer entry 68 bytes. This serving recipe is documented for the post-trained V4-Flash sibling; it does not establish FP4 QAT of the base checkpoint.

  • HCA main KV NoPE

    Group
    HCA main KV
    Elements
    448
    Bits
    8
    Format
    FP8 E4M3; E8M0 scales per 64 channels
    Scale count
    7
    Scale bits
    8
    Padding bytes
    1
    At
    README.md; V4 layout: 448 NoPE bytes, 7 scale bytes and 1 padding byte
    Source: code · README.md; V4 layout: 448 NoPE bytes, 7 scale bytes and 1 padding byte
    The scale row is 8 Bytes

    Serving layout from the official FlashMLA kernels and post-training FP4 indexer QAT; main KV keeps the RoPE tail in BF16. Each main/SWA entry is 584 bytes, each indexer entry 68 bytes. This serving recipe is documented for the post-trained V4-Flash sibling; it does not establish FP4 QAT of the base checkpoint.

  • HCA main KV RoPE

    Group
    HCA main KV
    Elements
    64
    Bits
    16
    Format
    BF16
    At
    README.md; V4 layout: 128 RoPE bytes
    Source: code · README.md; V4 layout: 128 RoPE bytes
    the 64 `bfloat16` RoPE values (not quantized)

    Serving layout from the official FlashMLA kernels and post-training FP4 indexer QAT; main KV keeps the RoPE tail in BF16. Each main/SWA entry is 584 bytes, each indexer entry 68 bytes. This serving recipe is documented for the post-trained V4-Flash sibling; it does not establish FP4 QAT of the base checkpoint.

  • SWA window NoPE

    Group
    SWA window
    Elements
    448
    Bits
    8
    Format
    FP8 E4M3; E8M0 scales per 64 channels
    Scale count
    7
    Scale bits
    8
    Padding bytes
    1
    At
    README.md; V4 layout: 448 NoPE bytes, 7 scale bytes and 1 padding byte
    Source: code · README.md; V4 layout: 448 NoPE bytes, 7 scale bytes and 1 padding byte
    The scale row is 8 Bytes

    Serving layout from the official FlashMLA kernels and post-training FP4 indexer QAT; main KV keeps the RoPE tail in BF16. Each main/SWA entry is 584 bytes, each indexer entry 68 bytes. This serving recipe is documented for the post-trained V4-Flash sibling; it does not establish FP4 QAT of the base checkpoint.

  • SWA window RoPE

    Group
    SWA window
    Elements
    64
    Bits
    16
    Format
    BF16
    At
    README.md; V4 layout: 128 RoPE bytes
    Source: code · README.md; V4 layout: 128 RoPE bytes
    the 64 `bfloat16` RoPE values (not quantized)

    Serving layout from the official FlashMLA kernels and post-training FP4 indexer QAT; main KV keeps the RoPE tail in BF16. Each main/SWA entry is 584 bytes, each indexer entry 68 bytes. This serving recipe is documented for the post-trained V4-Flash sibling; it does not establish FP4 QAT of the base checkpoint.

  • CSA indexer key

    Group
    CSA indexer K
    Elements
    128
    Bits
    4
    Format
    MXFP4 E2M1; E8M0 scales per 32 channels
    Scale count
    4
    Scale bits
    8
    At
    inference/kernel.py; fp4_act_quant, default block_size 32
    Source: code · inference/kernel.py; fp4_act_quant, default block_size 32
    s = z.new_empty(*z.size()[:-1], N // block_size, dtype=torch.float8_e8m0fnu)

    Serving layout from the official FlashMLA kernels and post-training FP4 indexer QAT; main KV keeps the RoPE tail in BF16. Each main/SWA entry is 584 bytes, each indexer entry 68 bytes. This serving recipe is documented for the post-trained V4-Flash sibling; it does not establish FP4 QAT of the base checkpoint.

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

Serving layout from the official FlashMLA kernels and post-training FP4 indexer QAT; main KV keeps the RoPE tail in BF16. Each main/SWA entry is 584 bytes, each indexer entry 68 bytes. This serving recipe is documented for the post-trained V4-Flash sibling; it does not establish FP4 QAT of the base checkpoint.

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: code · V4-Flash inference/model.py line 603; Expert.forward
x = F.silu(gate) * up

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: paper · p.26 §4.2.3
we clamped the linear component of SwiGLU to the range of [−10, 10], while capping the upper bound of the gate component at 10.

Applied throughout the training of both V4 models; inference code applies the same clamp (Expert.forward, /swiglu_limit 10).

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

FFN bias

No

Source: code · V4-Flash inference/model.py lines 589–594; 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

256

Source: config · /n_routed_experts

Routed experts per MoE layer.

Experts per token

6

Source: config · /num_experts_per_tok

Routed experts selected per token.

Shared experts

1

Source: config · /n_shared_experts

Always-on experts per MoE layer.

Expert dim

2,048

Source: config · /moe_intermediate_size

Intermediate width of one routed expert.

Shared expert dim

2,048

Source: config · /moe_intermediate_size

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

Total intermediate width of the shared expert(s).

Leading dense layers

0

Source: paper · p.24 §4.2.1
We employ MoE layers in all Transformer blocks, but use the Hash routing strategy for the first 3 MoE layers.

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

Router score

sqrt(softplus); hash on token ID (first 3 MoE layers)

Source: paper · p.7 §2.1
we change the activation function that computes the affinity scores from Sigmoid(·) into Sqrt(Softplus(·)).

Hash routing for the first 3 MoE layers: p.24 §4.2.1 (/num_hash_layers 3); /scoring_func sqrtsoftplus.

Gating function over expert logits (softmax, sigmoid).

Load balancing

aux-loss-free bias (update speed 0.001) + sequence-wise loss 1e-4; no node-limited routing

Source: paper · p.25 §4.2.2
For auxiliary-loss-free load balancing, we set the bias update speed to 0.001. For the balance loss, we set its loss weight to 0.0001 to avoid extreme imbalance within single sequences.

Node limit removed: p.7 §2.1. Bias enters top-k selection only (/topk_method noaux_tc).

Load-balancing method, with coefficients where disclosed.

Routed scaling factor

1.5

Source: config · /routed_scaling_factor

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

Renormalize top-k

Yes

Source: config · /norm_topk_prob

Selected expert weights are renormalized to sum to 1.

Expert dim / d_model

0.5

Calculated: moe.expert_dim / d_model

moe.expert_dim divided by shape.d_model.

Sparsity (experts / top-k)

42.6667

Calculated: experts / top_k

Routed experts divided by experts selected per token.

Active / total

0.0457746

Calculated: params.active / params.total

params.active divided by params.total.

Multi-token prediction

MTP depth

1

Source: paper · p.24 §4.2.1
The multi-token prediction depth is set to 1.

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

MTP modules

1

Source: config · /num_nextn_predict_layers

MTP modules with distinct weights. 1 with mtp.depth > 1 means one module is applied recursively.

MTP module

e_proj(RMSNorm(Emb(t_{i+1}))) + h_proj(RMSNorm(h)), then one block with 128-token pure-SWA attention and MoE FFN inside mHC, own mHC head and final norm

Source: code · V4-Flash inference/model.py; MTPBlock.forward
x = self.e_proj(e).unsqueeze(2) + self.h_proj(x)

Attention is SWA-only because the MTP entry of /compress_ratios is 0; the report states the MTP configuration is identical to DeepSeek-V3 (p.7 §2).

Contents of one MTP module (mixer and FFN type, norms, how the previous hidden state and next-token embedding are combined).

MTP FFN

MoE

Source: code · V4-Flash inference/model.py; MTPBlock, Block.__init__
class MTPBlock(Block):

Block builds self.ffn = MoE(layer_id, args); weight index has mtp.0.ffn.experts.*.

FFN in the MTP module: 'dense' or 'MoE', with its width when it differs from the backbone.

MTP shares embedding/head

Yes

Source: code · V4-Flash inference/model.py; Transformer.__init__
self.mtp[-1].embed = self.embed

Output head shared as well; the Base checkpoint also stores copies (mtp.0.emb.tok_emb, mtp.0.head).

MTP modules use the main model's input embedding and output head.

MTP loss weight

0.3, reduced to 0.1 at the start of LR decay

Source: paper · p.25 §4.2.2
The MTP loss weight is set to 0.3 for most of the training, and to 0.1 upon the start of learning rate decay.

Weight of the MTP loss, including its schedule.

MTP weights released

Yes

Source: config · model.safetensors.index.json; weight_map mtp.0.*
"mtp.0.hc_head_base"

The released checkpoint contains the MTP module weights.

Normalization and stability

Norm

RMSNorm

Source: code · V4-Flash inference/model.py lines 658–659; Block.__init__
self.attn_norm = RMSNorm(args.dim, self.norm_eps)

Normalization layer type in the blocks.

Norm placement

pre

Source: code · V4-Flash inference/model.py lines 688–700; Block.forward
x = self.attn_norm(x)

Sublayers sit inside manifold-constrained hyper-connections (hc_pre/hc_post), expansion 4.

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

Norm epsilon

1e-06

Source: config · /rms_norm_eps

Epsilon of the block normalization layers.

Residual stream

mHC: 4 residual streams, residual mixing projected to doubly stochastic by Sinkhorn-Knopp (20 iterations), sigmoid-bounded input/output maps

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

mHC design: p.7–8 §2.2. config /hc_mult 4, /hc_sinkhorn_iters 20, /hc_eps 1e-6.

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

4.096K tokens

Source: paper · p.25 §4.2.2
The training starts with a sequence length of 4K

First stage; token split across the 4K/16K/64K/1M stages is not disclosed.

Sequence length of the main pretraining stage.

Trained context

1.049M tokens

Source: paper · p.25 §4.2.2
The training starts with a sequence length of 4K, and we gradually extend the training sequence length to 16K, 64K, and 1M.

Longest sequence length trained on after context extension.

Advertised context

1.049M tokens

Source: config · /max_position_embeddings

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

Extension method

4K → 16K → 64K → 1M during pretraining; compressed layers use YaRN (factor 16, original 65536)

Source: paper · p.25 §4.2.2
The training starts with a sequence length of 4K, and we gradually extend the training sequence length to 16K, 64K, and 1M.

config /rope_scaling: 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

32T tokens

Source: paper · p.25 §4.2.2
We train DeepSeek-V4-Flash on 32T tokens

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

Optimizer

Muon + AdamW (AdamW for embedding, prediction head and RMSNorm weights)

Source: paper · p.25 §4.2.2
for the majority of parameters, but use the AdamW optimizer (Loshchilov and Hutter, 2017) for the embedding module, the prediction head module, and the weights of all RMSNorm modules.

Muon: momentum 0.95, weight decay 0.1, update RMS rescaled to 0.18 (same paragraph).

Optimizer used for the bulk of parameters.

Peak LR

0.00027

Source: paper · p.25 §4.2.2
The learning rate is linearly warmed up in the first 2000 steps, maintained at 2.7 × 10−4 for most of the training.

Peak learning rate of the main pretraining stage.

Final LR

2.7e-05

Source: paper · p.25 §4.2.2
we finally decay the learning rate to 2.7 × 10−5 following a cosine schedule

Learning rate at the end of the decay.

LR schedule

linear warmup (2000 steps), constant 2.7e-4 for most of training, cosine decay to 2.7e-5 near the end

Source: paper · p.25 §4.2.2
The learning rate is linearly warmed up in the first 2000 steps, maintained at 2.7 × 10−4 for most of the training.

Learning-rate schedule shape with phase boundaries.

Warmup

2000 steps

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

Warmup length in steps or tokens.

Batch size

ramped from a small size to 75.5M tokens, then constant for most of training

Source: paper · p.25 §4.2.2
increases the batch size (in tokens) from a small size to 75.5M and then keeps it at 75.5M during most of the 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)

75.5M tokens

Source: paper · p.25 §4.2.2
increases the batch size (in tokens) from a small size to 75.5M and then keeps it at 75.5M during most of the training

After the batch-size ramp; ramp length not disclosed.

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.25 §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.25 §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.

Stability measures

Anticipatory Routing (routing indices computed with parameters from Δt steps earlier), auto-triggered with a short rollback on loss spikes; SwiGLU clamping

Source: paper · p.26 §4.2.3
we introduced an automatic detection mechanism that triggers a short rollback and activates Anticipatory Routing exclusively when a loss spike occurs

SwiGLU clamp values under ffn.clamp.

Interventions used during pretraining to keep it stable (QK-clip, z-loss, logit caps, spike handling), with coefficients.

Document masking

sample-level attention masking within packed sequences

Source: paper · p.24 §4.1
Different from DeepSeek-V3, we employ sample-level attention masking during pre-training.

Whether attention crosses document boundaries within a packed sequence.

Extra objectives

FIM, strategy inherited from DeepSeek-V3

Source: paper · p.24 §4.1
We also inherit the token-splitting (DeepSeek-AI, 2024) and Fill-in-Middle (FIM) (DeepSeek-AI, 2024) strategies from DeepSeek-V3.

The FIM rate is not restated for V4.

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

Data mix

>32T tokens: math, code, web, long documents (scientific papers, technical reports), larger multilingual corpus; agentic data added in mid-training

Source: paper · p.24 §4.1
our pre-training corpus comprises more than 32T tokens, containing mathematical contents, codes, web pages, long documents, and other high-quality categories.

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

Stages
  • context-4096

    Seq len
    4096
    Source: paper · p.25 §4.2.2
    The training starts with a sequence length of 4K

    Dense attention.

  • context-16384

    Seq len
    16384
    Source: paper · p.25 §4.2.2
    we gradually extend the training sequence length to 16K, 64K, and 1M.
  • context-65536

    Seq len
    65536
    Source: paper · p.25 §4.2.2
    introduce sparse attention at the sequence length of 64K and keep sparse attention during the rest of the training.

    Sparse attention introduced here after a short indexer warm-up and dense attention for the first 1T tokens; kept for the rest of training.

  • context-1048576

    Seq len
    1048576
    Source: paper · p.25 §4.2.2
    we gradually extend the training sequence length to 16K, 64K, and 1M.
Source: paper · p.25 §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 hyper-parameters reused for Muon by rescaling the update RMS

Source: paper · p.14 §2.4
rescale the Root Mean Square (RMS) of the update matrix for reutilization of our AdamW hyper-parameters

Update RMS 0.18 (p.25 §4.2.2).

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.

Tokens / param

112.676

Calculated: train.tokens / params.total

train.tokens divided by params.total.

Tokens / active param (non-embedding)

2,411.01

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

6,923 bytes

Calculated: kv.bytes_at_context / 131072 tokens; uniform BF16, payload only; quantization overhead excluded. CSA main KV: 21 × (512 × 16/8) B/entry; CSA indexer K: 21 × (128 × 16/8) B/entry; HCA main KV: 20 × (512 × 16/8) B/entry; SWA window: 43 × (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

6,880 bytes

Calculated: 21504 B / 4 tokens (CSA main KV) + 5376 B / 4 tokens (CSA indexer K) + 20480 B / 128 tokens (HCA main KV); uniform BF16, payload only; quantization overhead excluded. CSA main KV: 21 × (512 × 16/8) B/entry; CSA indexer K: 21 × (128 × 16/8) B/entry; HCA main KV: 20 × (512 × 16/8) B/entry; SWA window: 43 × (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

533 bytes

Calculated: kv.bytes_per_token (131072 tokens) / (params.active / 1e9); uniform BF16, payload only; quantization overhead excluded. CSA main KV: 21 × (512 × 16/8) B/entry; CSA indexer K: 21 × (128 × 16/8) B/entry; HCA main KV: 20 × (512 × 16/8) B/entry; SWA window: 43 × (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

69,800,881 bytes

Calculated: kv.bytes_at_context (131072 tokens) / (params.active / 1e9); uniform BF16, payload only; quantization overhead excluded. CSA main KV: 21 × (512 × 16/8) B/entry; CSA indexer K: 21 × (128 × 16/8) B/entry; HCA main KV: 20 × (512 × 16/8) B/entry; SWA window: 43 × (512 × 16/8) B/entry

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

KV at context

907,411,456 bytes

Calculated: 21504 B × floor(131072 / 4) (CSA main KV) + 5376 B × floor(131072 / 4) (CSA indexer K) + 20480 B × floor(131072 / 128) (HCA main KV) + 44032 B × min(131072, 128) (SWA window); uniform BF16, payload only; quantization overhead excluded. CSA main KV: 21 × (512 × 16/8) B/entry; CSA indexer K: 21 × (128 × 16/8) B/entry; HCA main KV: 20 × (512 × 16/8) B/entry; SWA window: 43 × (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

24

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

Score of DeepSeek-V4-Flash (0420 release), post-trained from this base. Variant: DeepSeek V4 Flash 0420 (Max). AA entry for the 0420 release (the 0731 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