Issue 37 Β· Project 01 HF model AI / ML trending #26 β read
deepseek-ai/DeepSeek-V4.1-Flash
Hugging Face β Β·β₯ 4,424 Β·β 1,294,550Β·mit Β·created 2026-09-10 Β·3 min read
TL;DR: DeepSeek-V4.1-Flash is a 552B-param multimodal MoE (8B active at prefill, 16B at decode) with a 1M-token context, but the release is really a systems paper in model form: a causal encoder-decoder split, cross-layer sparse-attention index reuse, and FP4 KV quantization compress the persistent KV cache to 890 bytes per token β ~4Γ smaller than the previous generation and, per the card, ~437Γ smaller than DeepSeek-V1. If the numbers hold, it materially changes the economics of input-heavy agentic workloads, and it ships MIT-licensed with strong agentic benchmarks (74.2 on DeepSWE v1.1, 90.6 on Terminal-Bench 2.1).
The interesting idea: decouple KV cache from depth
Standard decoders pay KV cache proportional to layer count. V4.1-Flash's Causal Encoder-Decoder (CED) breaks that: a 40-layer Transformer is split into a 20-layer causal encoder and a 20-layer decoder, and the decoder's global KV cache is projected from the encoder's final hidden states rather than computed per-decoder-layer. Prefill only needs the encoder path (8B active params/token); decode activates 16B. Sliding-window KV isn't persisted at all β SWA Bounded Replay reconstructs it on demand by replaying just the last n_win tokens, cutting persistent KV to ~1/8 of DeepSeek-V4-Flash before quantization even enters.
On top of that, CSA2 statically assigns each attention layer one of three modes β Full (compute its own KV and sparse index), Reindex (share KV, recompute index), or Reuse (share both KV and Top-K sparse indices). A Hierarchical Sparse Indexer in the decoder restricts later indexing layers to a candidate pool built by the first Full layer, so deep-layer indexing cost is bounded regardless of context length. Main KV is stored in FP4 (E2M1 with one E4M3 scale per 16 channels). Net: 890 B/token of persistent global KV. For a full 1M-token context, that's under 1 GB of KV β this is what makes million-token agent sessions plausible on real hardware.
Other components are mentioned but thinly documented: Engram conditional memory (196B params accessed via token lookup), Single-Pass mHC residual mixing, and DSpark speculative decoding. Trained from scratch on 45T multimodal tokens; sparse attention at 64K, extended to 1M at 34T tokens. Reasoning effort is a continuous 1β100 knob.
Evidence
Base-model numbers are the honest part: it beats the 284B V4-Flash broadly and edges the 1.6T V4-Pro on code/math (HumanEval 79.4, MMLU-Pro 74.1), while trailing V4-Pro on knowledge (SimpleQA-Verified 42.3 vs 55.2) and β notably β long context (LongBench-V2 45.2 vs 51.5, barely above V4-Flash). That's the number to watch: the KV compression may be costing long-context quality, which is awkward for a model whose pitch is 1M-token contexts.
The instruct model's agentic results are the headline. Comparisons are against (unverifiable, future-dated) frontier models, so treat labels loosely, but internally consistent gains over V4-Flash are large:
It falls well behind Opus on the harder Terminal-Bench 3.0/4.0 (30.0/31.2 vs 43.3/51.8) and NL2Repo-Bench β so "frontier-matching" holds on some benchmarks, not across the board. A useful table shows scaffold sensitivity: DeepSWE ranges 65.5β74.2 depending on harness, an 8.7-point spread that should temper any single-number claim (theirs or anyone's).
What's actually there, and the catches
MIT-licensed safetensors (FP8/8-bit variants), a reference encoding.py, a Rust deepseek-recipe toolkit for prompt encoding/parsing, minimal-inference instructions, and DeepSWE reproduction scripts. What's not there: a Jinja chat template (you must use their encoder), any mention of vLLM/SGLang support at release, and β critically β the KV-compression wins depend on a serving stack that implements CED prefill/decode split, CSA2 index sharing, FP4 KV, and bounded replay. Running vanilla transformers inference gets you none of the systems benefits. Hardware: 552B backbone + 196B Engram means multi-node even at FP8; the "Flash" economics are about serving throughput, not local accessibility. The technical report link in the card is empty.
Shortest path
No hosted demo is linked. Start from the model card and repo folders:
# https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash
huggingface-cli download deepseek-ai/DeepSeek-V4.1-Flash
# then follow ./inference for weight conversion + local inference,
# ./encoding for the prompt format (no chat template β use encoding.py or deepseek-recipe),
# ./evaluation to reproduce DeepSWE v1.1 numbers
Recommended sampling: temperature=1.0, top_p=0.95, max_tokens β₯ 256K, and set reasoning_effort (1β100) per task. Worth tracking whether third-party serving frameworks pick up CED/CSA2 β that adoption, plus independent long-context evals, will tell you if 890 B/token is a real reset or a lab-conditions number.