Model techniques map
ModelsDeepSeek-V4-Flash-Vision-Exp

DeepSeek · released 2026-08-21

DeepSeek-V4-Flash-Vision-Exp

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

Curator’s noteDeepSeek's first experimental multimodal V4: the V4-Flash architecture with visual modules bolted on and continued training to unlock visual understanding, holding text-agent performance roughly level with V4-Flash-0731 while moving multimodal agent benchmarks substantially. Explicitly experimental, and superseded architecturally by V4.1-Flash three weeks later — kept because the pair documents the bolt-on-vision route against V4.1's trained-from-scratch DeepSeek-ViT. MIT.

Against the consensus recipe

Its documents state 3 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 11 of the 19 architecture features checked — 10 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 6821d6ad36, by anthropic/claude-sonnet-5 on 2026-09-25.

FeatureCodeIts documentsEvidence
Grouped-query attention not in its codenot stated

num_key_value_heads=1 but the KV path is a single shared MQA head broadcast via repeat_kv, not a grouped low-rank KV projection paired with per-head KV heads distinct from MLA — but this is MQA which counts as GQA per the definition; however the code implements a single-vector kv_proj (no low-rank latent split for per-head KV), so it is MQA (a degenerate GQA) — present.

num_key_value_heads = 1num_attention_heads = 64
self.num_key_value_groups = config.num_attention_heads  # single KV head, broadcast to all
modeling_deepseek_v4.py · L782
self.kv_proj = nn.Linear(config.hidden_size, self.head_dim, bias=False)
modeling_deepseek_v4.py · L391
Multi-head latent attention not in its codenot stated

There is no shared low-rank KV latent that is up-projected per head with a decoupled RoPE key (DeepSeek-V2 style); instead keys/values collapse to a single shared vector of size head_dim (MQA), with q using a low-rank latent only for queries, not keys/values.

q_lora_rank = 1024
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 · L793–794
Sliding-window attention code only in its codenot stated

Every attention layer caches and attends only over the last sliding_window=128 tokens via DynamicSlidingWindowLayer / DeepseekV4HCACache.update.

sliding_window = 128
self.keys = full[:, :, -self.sliding_window + 1 :, :]
        self.values = self.keys
modeling_deepseek_v4.py · L205–206
Interleaved sliding-window and global attention not in its codenot stated

All layer_types (sliding_attention, compressed_sparse_attention, heavily_compressed_attention) use the same sliding-window base attention plus optional long-range compressed KV; none of them attend to the full uncompressed context, so there is no interleaving of sliding vs full-global attention layers.

sliding_window = 128
COMPRESSOR_CLASSES = {
    "sliding_attention": None,
    "compressed_sparse_attention": DeepseekV4CSACompressor,
    "heavily_compressed_attention": DeepseekV4HCACompressor,
}
modeling_deepseek_v4.py · L751–755
Indexer-selected sparse attention (DeepSeek Sparse Attention) code only in its codenot stated

The CSA compressor uses a Lightning Indexer that scores compressed KV blocks and keeps only the top index_topk=512 per query (index_n_heads=64, index_head_dim=128), used in compressed_sparse_attention layers of this config.

index_topk = 512index_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 SSM token-mixing layers exist; all layers use the same softmax DeepseekV4Attention class with sliding-window plus optional compressor branch.

Gated DeltaNet layers not in its codenot stated

No gated delta-rule recurrent mixer is implemented anywhere in this file.

Mamba-2 layers not in its codenot stated

No Mamba-2 SSD/selective state-space blocks are implemented in this file.

Learnable attention sink code only in its codenot stated

Each attention layer has a learnable per-head sink parameter concatenated into the softmax denominator before being dropped.

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 attention output only goes through a rope-undo step and grouped output projection.

QK normalization code only in its codenot stated

Queries are normalized with an unweighted RMSNorm per head after the q_b_proj, before rotary and the dot product; keys (the shared kv) are normalized with DeepseekV4RMSNorm as well.

self.q_b_norm = DeepseekV4UnweightedRMSNorm(eps=config.rms_norm_eps)
modeling_deepseek_v4.py · L792
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)
modeling_deepseek_v4.py · L820–822
Partial RoPE code only in its codenot stated

RoPE is applied only to the trailing qk_rope_head_dim=64 of the 512-dim head, leaving the leading nope channels untouched.

qk_rope_head_dim = 64head_dim = 512
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 · L360–362
YaRN RoPE scaling code only in its codenot stated

rope_scaling type is yarn and is applied to the 'compress' rope-type branch used by CSA/HCA compressor layers via the standard YaRN init function.

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 (either 'main' or 'compress' rope type) to their rope slice; there is no layer type that skips positional encoding entirely, only partial RoPE within a head.

self.rope_layer_type = "main" if self.layer_type == "sliding_attention" else "compress"
modeling_deepseek_v4.py · L780
Mixture of experts in its code core

Feed-forward layers route tokens to a subset of n_routed_experts=256 expert MLPs with num_experts_per_tok=6 chosen by a learned TopKRouter (or hash router for early layers).

n_routed_experts = 256num_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 MoE block runs a shared DeepseekV4MLP that every token passes through in addition to the routed experts, and n_shared_experts=1 in this config.

n_shared_experts = 1
self.shared_experts = DeepseekV4MLP(config)
modeling_deepseek_v4.py · L1129
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 router adds an e_score_correction_bias buffer to scores only for top-k selection (not for the weights used afterward), matching DeepSeek-V3's noaux_tc scheme, and topk_method is set to noaux_tc in this config.

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)
modeling_deepseek_v4.py · L1086–1087
Multi-token prediction layers code only in its codenot stated

The config declares num_nextn_predict_layers=3 and the model explicitly ignores MTP weight keys on load, indicating the checkpoint carries MTP modules even though this file does not instantiate them.

num_nextn_predict_layers = 3
_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 clamping), and hidden_act is silu in this config.

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 6

token mixer 1

softmax attention 1

channel mixer 1

mixture of experts 1

normalization & residual 1

multimodal architecture 3

training objective 1

language modelling objective 1

post-training 2

filed at the root 1

mid-training & continual pretraining 1

inference & serving 9

decoding strategy 3

reasoning control 1

inference quantization 1

agentic scaffolding 4

software implementation 2

filed at the root 1

inference engine 1

vLLM optional

evaluation 1

evaluation harness 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
huggingface.co/deepseek-ai/DeepSeek-V4-Flash-Vision-Expmodel cardDeepSeekread
arxiv.org/abs/2606.19348technical reportDeepSeekread
openrouter.ai/deepseek/deepseek-v4-flash-vision-expvendor docsOpenRouterread