Research #15 · Interactive Deep Dive

DeepSeek V4: Architecture & Performance Deep Dive

A hybrid attention mechanism combining CSA and HCA, 384 experts activated sparsely, and aggressive KV cache compression that enables 1M-token context on commodity hardware. How the "math-first, silicon-second" playbook reshapes the inference economics landscape.

ByYumei Dou
PublishedApril 27, 2026
FormatInteractive Research Report
CoverageDeepSeek · NVIDIA · Alibaba · ByteDance

This report is based on publicly available open-source information from DeepSeek. All architectural analysis represents reasonable inference and research based on the DeepSeek-V4-Pro model card on Hugging Face and the published config.json.

Executive Summary

On April 24, 2026, DeepSeek released V4, its fourth-generation large language model, representing a significant leap in efficient AI architecture design. The model introduces a hybrid attention mechanism combining Compressed Sparse Attention (CSA) and Heavily Compressed Attention (HCA), a novel Mixture-of-Experts configuration with 384 experts, and aggressive KV cache compression that enables 1 million token context windows on commodity hardware.

V4-Pro Parameters
1.6T
49B active
V4-Flash Parameters
284B
13B active
Context Window
1M
Pro + Flash
V4-Pro Price
$1.74
/M input · $6.94/M output
V4-Flash Price
$0.14
/M input · $0.55/M output
Release
Apr 24
Open weights · 2026

Key Innovations

CSA/HCA Hybrid Attention mHC Residual Connection Muon Optimizer 384 MoE Experts (6+1 active) TileLang Kernel DSL GRPO Post-Training FP4 Quantization Multi-Latent Attention (MLA)

Architecture Visualization

DeepSeek V4's architecture represents a carefully designed system that decouples computational expressiveness from memory bandwidth requirements. The following interactive diagrams illustrate the key architectural innovations.

Interactive Architecture Blueprint

This diagram reconstructs the full Prefill → Decoding pipeline from the DeepSeek-V4-Pro open-source config. Click on any layer or stage to see quantitative details. Toggle between Prefill and Decoding views.

Decoding · Memory-Bound
Input Prompt: n tokens (Token 1 … Token n-1 → Prefill | Token n → Decoding) PREFILL: tokens 1…n-1 (Compute-Bound) DECODING: token n (Memory-Bound) Layer 1 / 61 Tokens 1…n-1 Batch embed → X K,V Projection W_k: 7168→512 W_v: 7168→512 Compress CSA: 4x HCA: 128x compress_ratios[i] Compute-bound: batch matmul all tokens GPU Utilization ~70-85% KV Cache (Layer 1) chunks_group(n-1)_(k,v) | compressed At 1M tokens: ~604MB/layer (MLA) vs ~29GB/layer (MHA) Token n embed → 7168-dim Q/K/V via MLA q: 7168→512→16384 k,v: 7168→512 (latent) ~80.7M FLOPs Lightning Indexer Top-k=1024 Attention Q_n · K_chunks → softmax → V | ~134.2M FLOPs Attn(q, topk_chunks_kv) · W_output_proj Residual + RMSNorm (mHC) MoE / FFN Router → 6+1 / 384 experts SwiGLU: gate·up·down | ~924.8M FLOPs Residual + Norm → H(1,n) | Update KV Cache write n_(k,v) H(1,n) → Layer 2 input Layer 2 / 61 Same pipeline: Q/K/V → Index → Attn → mHC → MoE → Residual Input: H(1,n) | Output: H(2,n) | Uses Layer 2's own KV cache compress_ratio[2] = 4 (CSA) | ~1.14G FLOPs per layer ⋮ Layers 3 – 60 ⋮ Alternating: HCA(128x) ↔ CSA(4x) compression per layer Layer 61 / 61 compress_ratio = 0 (Full Attention) Final layer uses uncompressed attention for maximum expressiveness LM Head → Softmax → Token n+1 H(61,n) → Vocab projection (7168 × 129280) → sample Autoregressive Loop: n+1 → new n Per-Layer Quantitative Projection FLOPs: 80.7M Attention FLOPs: 134.2M MoE FFN FLOPs: 924.8M Total per layer: ~1.14G FLOPs × 61 layers = ~69.5G FLOPs/token KV Cache/layer (1M): ~604MB (MLA) Baseline (MHA): ~29GB (57× more) Bottleneck Analysis FLOPs model: 61 × (Proj + Attn + FFN) KV Cache: n × dim × 61 (mem killer) Bandwidth Bottleneck: Latency = (Weights + KV) / Mem_Bandwidth

CSA/HCA Compression Ratios by Layer

DeepSeek V4 uses a heterogeneous compression strategy across its 61 layers. HCA (Heavily Compressed Attention) layers compress every 128 tokens into one entry and attend densely to all compressed entries, with no indexer. CSA (Compressed Sparse Attention) layers compress at 4× (each entry is a weighted sum of 8 tokens with stride 4), then a DSA-style lightning indexer selects the top-1,024 compressed entries for exact attention. Every layer also attends to the most recent 128 uncompressed tokens through a sliding window. The single ratio-0 entry is a sliding-window-only layer with no compressed branch.

HCA (128x compression)
CSA (4x compression)
Full Attention (0)

Per-Layer Pipeline Steps

Step Operation FLOPs Memory Access Note
1 Projection (X_n → Q,K,V) ~80.7M Read weights (~147MB) Current token only
2 Indexer Top-k Selection (CSA) O(n/4) Read KV Cache Memory-intensive
3 Attention (Q_n · K_chunks) ~134.2M Read KV Cache (top-1024) Dot product + softmax
4 MoE FFN (active experts) ~924.8M Read expert weights Compute-intensive
5 Residual + Norm (mHC) O(d) Negligible Constant time
6 Cache Write (compress KV) O(d) Write KV Cache Append compressed

MLA vs MHA: The Dimension Transform

The core insight of Multi-Latent Attention (MLA) is a decoupling of compute dimensionality from memory dimensionality. Traditional Multi-Head Attention (MHA) stores KV cache at full dimensionality, creating an unsustainable memory burden at long context lengths. MLA introduces a latent bottleneck that compresses this representation while preserving computational expressiveness.

Traditional MHA

KV stored at128h × 128d = 16,384-dim
KV cache/token (BF16)~32 KB
1M tokens KV (1 layer)~32 GB
61 layers total~1,952 GB

Full dimensionality stored. Memory scales as O(n × d_full).

DeepSeek V4 MLA

KV stored at512-dim latent
KV cache/token (FP4)~576 bytes
1M tokens KV (1 layer)~0.576 GB
61 layers total~35.1 GB

Latent bottleneck. Exploded back to 16,384 only at compute time via W_uk/W_uq.

28–57x Compression

128 × 128 / 512 = 32x (dimensionality) × BF16/FP4 precision = ~57x effective reduction

MLA Dimension Transform Animation

Output Projection Insight

Even the attention output going back to the residual stream uses low-rank projection with o_lora_rank=1024. This means DeepSeek's architects believe that inter-layer information is highly refined and does not require full 7168-dim bandwidth. The output attention vector (16,384-dim from 128 heads) is compressed through a 1024-dim bottleneck before being added to the residual stream.

"Store 512-dim. Compute 16,384-dim. Transfer 1024-dim between layers. Every dimension budget is intentional and minimal."

Interactive Performance Calculator

Adjust the parameters below to model DeepSeek V4's inference performance across different hardware configurations and workloads. All calculations update in real time.

1K1M
1256

Tokens/sec

--

Per-Layer Latency

--

KV Cache (V4)

--

KV Uncompressed

--

Compression Ratio

--

Total Latency/Token

--

Bottleneck

--

TPS vs Sequence Length

Per-Layer Latency Breakdown

KV Cache Growth: Compressed vs Uncompressed

V4 MLA vs Standard GQA

Shocking Conclusions

How Fundamental is DeepSeek's Innovation?

DeepSeek V4's core architectural innovation is not incremental optimization. It represents a fundamental decoupling of computational expressiveness from memory bandwidth requirements. This is best understood through the lens of dimensionality:

Traditional MHA: Coupled

Intelligence (expressiveness) and memory are strongly coupled. More attention heads = more KV cache = more memory. Cannot increase one without the other.

Expressiveness ∝ Memory ∝ Bandwidth

MLA: Decoupled

Proves "high-dimensional compute, low-dimensional transfer" is viable. The 512-dim latent channel transmits equivalent information to 16,384-dim at a fraction of the memory cost.

Expressiveness ∝ Compute ≠ Memory

Even the output projection is low-rank (o_lora_rank=1024). DeepSeek's architects believe that inter-layer information is highly "refined" — it does not need full 7168-dim bandwidth. Every dimension budget in the architecture is intentional and minimal.

Memory Savings & Hardware Leapfrog: H100 Challenges B200

The memory compression from MLA+FP4 creates a paradoxical situation in the hardware market: last-generation GPUs running DeepSeek V4 can rival or exceed next-generation hardware running traditional architectures.

Metric Traditional (Llama 400B class) DeepSeek V4 (MLA + FP4) Ratio
KV cache per token ~32 KB ~576 bytes 57x reduction
KV cache @ 1M tokens (61 layers) ~1,952 GB ~35.1 GB 55.6x reduction
Max context on 8×H100 ~18K tokens 1M tokens 55x more
Concurrent users @ 128K 1-2 40+ 20-40x more

The Hardware Leapfrog Effect: H100 bandwidth is 3.35 TB/s; B200 is 8.0 TB/s (2.4x improvement). But when DeepSeek V4 cuts memory transfer by 50-57x, the H100's bandwidth constraint effectively dissolves. 8×H100 running DS V4 can theoretically exceed 8×B200 running traditional architecture in TPS for long-context inference.

Scaling: Linear with 50x Lower Slope

KV cache memory scales linearly with both batch size and sequence length, but DeepSeek V4's slope is dramatically lower than traditional architectures.

Storage Formula:

Storage ≈ B × L × 61 layers × 576 bytes

Scenario Batch Context V4 KV Cache Traditional KV

On 8×H100 (640GB total · ~350GB weights FP8 · ~290GB KV)

Traditional MHA

Cannot fit 1 user at 1M context (needs ~1,952 GB)

DeepSeek V4

290GB / 36.8GB ≈ 7-8 concurrent users at full 1M context

"DeepSeek V4 is not 'optimizing' performance — it is 'arbitraging' the hardware gap. It exploits the fact that compute (FLOPs) grows far faster than memory bandwidth. By adding complex matrix projections (explode then compress) to trade compute for minimal memory footprint, it makes last-generation hardware (H100/H800) deliver performance rivaling or exceeding next-generation hardware in long-context, high-concurrency scenarios."
"The 512-dimensional latent vector you see in the config.json — that is the fulcrum with which DeepSeek moves the earth."

Thematic Analysis

Five strategic themes emerge from DeepSeek V4's architecture and competitive positioning.

Theme 1: The Convergence Paradox — When Efficiency Becomes the Moat

DeepSeek V4 presents a paradox: as frontier models converge in benchmark performance, the differentiator shifts from what the model can do to how cheaply it can do it. V4-Pro achieves competitive scores against GPT-5.4 and Claude Opus 4.6 at a fraction of the inference cost.

This creates a "convergence trap" for competitors: matching V4's efficiency requires adopting similar architectural innovations (MLA, sparse MoE), but adopting these innovations means converging toward V4's design. The moat is not the model's intelligence — it is the engineering stack that makes intelligence cheap.

For enterprises, this means the marginal cost of intelligence is approaching a commodity price point. The strategic question shifts from "which model is smartest?" to "which model gives the best intelligence-per-dollar at my required scale?"

  • V4-Pro input cost ($1.74/M) is approximately 5-8x cheaper than comparable frontier models
  • V4-Flash at $0.14/M makes high-volume production deployments economically viable
  • Open weights ensure no single vendor lock-in

Theme 2: Algorithmic Leverage vs Hardware Escalation — The 10x vs 3x Dilemma

The GPU industry delivers roughly 2-3x improvements per generation (H100 → B200 is ~2.4x bandwidth, ~2.7x FLOPs). But DeepSeek V4's architectural innovations deliver 50-57x memory efficiency gains through MLA compression alone.

This creates a fundamental tension: hardware vendors cannot keep pace with algorithmic improvements. When a software architecture change delivers 10-50x improvement, it obsoletes the need for the next 2-3 hardware generations — at least for the specific bottleneck being addressed.

The investment implication is significant: pure hardware scaling is no longer the only path to frontier performance. Companies that invest in algorithmic efficiency (the "software-defined AI" approach) may achieve better ROI than those relying solely on hardware upgrades.

  • MLA: 50-57x memory compression vs. 2.4x hardware bandwidth improvement
  • MoE sparsity: 49B active from 1.6T = 32x parameter efficiency
  • Compressed sparse attention: each decode step reads n/4 low-precision index keys plus top-k entries (CSA) or n/128 entries (HCA), instead of all n KV entries
  • Combined effect: old hardware + new algorithms > new hardware + old algorithms

Theme 3: The Tech Stack as Strategic Weapon — L0 to L4

DeepSeek V4 reveals a full-stack optimization strategy spanning from hardware abstraction to post-training alignment. Each layer solves a specific bottleneck:

Level Layer Technology Core Problem I/O Impact
L4 Post-training Muon, GRPO Convergence speed, RL memory Faster alignment, less GPU-hours
L3 Architecture MLA (CSA/HCA), mHC Inference cost, training stability 50x KV reduction, stable deep nets
L2 Algorithm Ops Custom Flash Attention Single-card compute efficiency Near-peak FLOP utilization
L1 Kernel DSL TileLang Operator development efficiency 10x faster kernel iteration
L0 Infrastructure EP/CANN Distributed comm latency Multi-GPU scaling efficiency

The strategic insight is that competitors must match every layer to achieve comparable efficiency. Building a frontier model is no longer just about scale — it requires deep expertise across the entire stack.

Theme 4: Open-Source Geopolitics — Trust, Transparency, Dual-Track Fear

DeepSeek's open-weight release strategy serves multiple strategic purposes simultaneously. By releasing model weights publicly, DeepSeek achieves broad adoption and community trust while creating competitive pressure on proprietary model providers.

However, this "open-source" approach is not without complexity. The model weights are open, but the training data, training pipeline, and full infrastructure stack remain proprietary. This creates a dual-track dynamic: the visible layer (weights, architecture) builds trust, while the invisible layer (data, training recipes, infrastructure) maintains strategic advantage.

For geopolitical observers, this represents a sophisticated strategy: open weights allow global adoption and dependency creation, while retaining the true "moat" (training know-how) domestically. The fear among Western AI labs is not that DeepSeek's model is better — it is that DeepSeek's model is good enough and dramatically cheaper, which threatens the unit economics of proprietary model providers.

Theme 5: The 2026 Default LLM — Architecture Convergence (Stanford CS336)

Stanford's CS336 course has already incorporated MLA and sparse MoE as default architectural choices for new LLM projects, signaling that DeepSeek's innovations are becoming the academic consensus for efficient language model design.

The convergence is striking: across research labs and companies, the emerging "default" 2026 LLM architecture increasingly looks like a DeepSeek derivative — multi-latent attention for KV compression, mixture of experts for parameter efficiency, and some form of structured sparsity in attention (whether indexer-based or otherwise).

This architectural convergence has profound implications for the competitive landscape. If all frontier models adopt similar architectures, differentiation must come from:

  • Training data quality and curation — the last truly proprietary moat
  • Post-training alignment (RLHF/GRPO) — user experience differentiation
  • Infrastructure and serving efficiency — cost-to-serve as competitive advantage
  • Ecosystem and developer experience — tooling, APIs, integration

Competitive Landscape

Comparing DeepSeek V4-Pro against the current frontier model landscape across key dimensions.

Dimension DeepSeek V4-Pro GPT-5.4 Pro Claude Opus 4.6 Gemini 3.1 Pro Meta Muse Spark
Parameters 1.6T / 49B active ~2T (est.) dense Undisclosed ~1.5T MoE (est.) 405B dense
Context Window 1M tokens 256K tokens 200K tokens 2M tokens 128K tokens
Architecture MLA + MoE (384 exp) Dense Transformer Undisclosed MoE variant Dense Transformer
KV Compression ~57x (MLA+FP4) GQA (~4x) Undisclosed ~8-16x (est.) GQA (~8x)
Input $/M tokens $1.74 $12.00 $15.00 $3.50 Open-weight
Output $/M tokens $6.94 $48.00 $75.00 $10.50 Open-weight
Open Weights Yes No No No Yes
Coding (est.) 92-95th % 95-98th % 95-98th % 90-94th % 88-92nd %
Reasoning (est.) 90-94th % 95-98th % 94-97th % 91-95th % 85-90th %
Key Insight: DeepSeek V4-Pro is not the absolute best model on every benchmark. But it achieves 90-95th percentile performance at approximately 7-10x lower cost than the leading proprietary alternatives. For most everyday conversation, non-frontier-knowledge reasoning, and research scenarios, this cost-performance ratio makes V4-Pro the rational default choice.
< section id="roofline" class="mb-16">

Roofline Analysis: How MLA Rewrites the Physics of Inference

The Roofline Model is the standard framework for understanding GPU-bound workloads. It plots achievable performance (TFLOPS) against operational intensity (FLOPs/Byte) — the ratio of computation to memory traffic. Every workload falls into one of two regimes: memory-bound (left slope, limited by bandwidth) or compute-bound (right plateau, limited by peak FLOPS). DeepSeek V4's MLA architecture engineers a dramatic regime shift from the former to the latter.

Hardware:

—

MHA Achievable (TF · BS=1)

—

MLA Achievable (TF · BS=1)

—

Ridge Point (F/B)

Architecture constants (unchanged by GPU): MHA OI = 1.2 FLOPs/Byte · MLA OI = 55 FLOPs/Byte · ~46× OI shift. Numbers above respond to the selected hardware.

Insight 1: The Great Regime Shift — Memory-Bound to Compute-Bound

In the Roofline framework, traditional MHA/GQA architectures are trapped on the bandwidth slope. Their KV caches are so massive that operational intensity (OI) stays extremely low — typically 0.5–2 FLOPs/Byte. Even on an H100 with 2 PFLOPS of FP8 compute, actual utilization rarely exceeds 5% because the GPU spends most of its time shuttling KV data between HBM and SRAM.

MLA changes the equation at both ends of the OI fraction:

  • Denominator collapse: KV memory traffic drops ~57× (from 16,384-dim to 512-dim latent + compression metadata). The bytes moved per token shrink from ~32KB to ~576B per layer.
  • Numerator boost: The decompression projections (WUK, WUQ) that "explode" latents back to full dimension add compute — but compute is cheap when you've freed the bandwidth bottleneck.

The result: OI jumps from ~1.2 FLOPs/Byte (MHA) to ~55 FLOPs/Byte (MLA). On the Roofline chart, the workload point vaults across the ridge point — the inflection where the bandwidth slope meets the compute ceiling — and lands firmly on the compute plateau. The GPU finally gets to do what it was built for: compute.

Insight 2: Hardware Generation Gap Erasure

The most commercially disruptive consequence: bandwidth premiums between GPU generations disappear. B200's biggest upgrade over H100 is memory bandwidth (8.0 TB/s vs 3.35 TB/s, ~2.4×). But if your workload is compute-bound, that 2.4× bandwidth advantage is worthless — the slope no longer constrains you. What matters is peak FLOPS, where B200 leads 4.5× in raw compute but costs proportionally more per unit.

Under DeepSeek's architecture, an 8×H100 cluster running V4-Pro can match or exceed the per-dollar throughput of an 8×B200 cluster running a traditional dense model. The algorithm compresses hardware generations, turning $40,000 H100s into machines that perform like $100,000 hardware on the specific workloads MLA is designed for.

Dimension Traditional MHA DeepSeek MLA Implication
Bottleneck Memory Bandwidth Compute (FLOPS) Pressure shifts from bandwidth to compute
Operational Intensity ~1.2 FLOPs/Byte ~55 FLOPs/Byte ~46× increase in compute density
GPU Utilization <5% (bandwidth-starved) 60–85% (compute-saturated) Order-of-magnitude efficiency gain
1M Context Cost Prohibitive (multi-node, low batch) Single-node, high batch viable Long-context commercially viable
Hardware Requirement Must chase latest bandwidth (B200) H100/H800 sufficient Mitigates export-control pressure
Batch Size Ceiling 8–32 (KV cache OOM) 128–256+ (KV cache tiny) Throughput scales with batch, not hardware

Insight 3: Scaling Law Redefined — From Storage Growth to Concurrency Growth

As context length L scales toward 1M tokens, the Roofline model reveals a fundamental divergence in scaling behavior:

  • Traditional path: L increases → KV cache explodes → bandwidth pressure rises exponentially → batch size collapses to 1 → GPU sits idle at <5% utilization. The "long context" becomes an engineering trophy with no commercial viability.
  • DeepSeek path: L increases to 1M → KV cache grows to only ~36.8 GB total (vs ~1.77 TB for MHA) → memory headroom remains abundant → batch size stays at 64–256 → GPU compute is fully saturated.

DeepSeek doesn't just offer "longer conversations" — it offers cheap, high-throughput, ultra-long conversations. The scaling constraint shifts from "can we fit the KV cache?" to "how aggressively are we willing to batch?" — and the answer is limited only by the operator's willingness to fill the compute pipeline.

Insight 4: The Ridge Point as Strategic Moat

The ridge point — where the bandwidth slope meets the compute ceiling — defines the minimum OI needed to become compute-bound. For H100:

Ridge Point = Peak FLOPS / Bandwidth = 2,000 TFLOPS / 3,350 GB/s ≈ 597 FLOPs/Byte (FP8)

MLA's OI of ~55 FLOPs/Byte doesn't quite reach this theoretical ridge for single-token decode. But with batch sizes of 64+, the effective OI multiplies: a batch of 64 pushes effective OI to ~3,520 FLOPs/Byte — well beyond the ridge. This is why DeepSeek's architecture requires high-batch serving to unlock its full potential, and why its API pricing can be so aggressive: the economics only work because concurrency is high.

The Deepest Insight: Algorithm as Hardware Leverage

DeepSeek V4-Pro is not just a model — it is a hardware leverage system. Through mathematically rigorous low-rank compression, it forces a $40,000 H100 to deliver throughput that would otherwise require $100,000+ of next-generation silicon. This "algorithmic dimensionality reduction against hardware" is DeepSeek's most formidable competitive moat, and the deepest reason why its architecture deserves matrix-level decomposition. When you model the Roofline for DeepSeek, you discover that the bandwidth slope — the line that has constrained every LLM deployment since GPT-3 — is no longer the binding constraint. The only remaining question is: how much batch size are you willing to feed the machine?

This research was produced by InAI Capital Advisor as part of our ongoing coverage of the global AI investment landscape. The analysis is proprietary, built on in-house domain expertise, in-depth technical research, and first-hand evaluation.