The Million-Token Memory Problem
Full attention across a million tokens typically demands massive KV cache storage—hundreds of gigabytes per conversation. DeepSeek V4-Pro addresses this challenge through tiered cache compression and sparse retrieval.
Dual Compression and Indexing
To keep context manageable, V4 splits token history into multiple representations:
- Heavily Compressed Attention (HCA): Merges 128 tokens into single entries using learned weighted averages.
- Compressed Sparse Attention (CSA): Retains finer granularity by bundling four tokens at a time.
- Lightning Indexer: Performs a low-precision, cheap similarity pass over ~262,000 compressed entries to pick the top 1,024 most relevant candidates for CSA layers.
- Sliding Window: Preserves uncompressed key-value pairs for the most recent 128 tokens, ensuring zero detail loss for immediate dialogue.
Hyper-Connections and MoE Scaling
Rather than passing a single residual stream, V4 routes representations through four parallel numerical lists. DeepSeek balances this via manifold-constrained hyper-connections (mHC), using constrained 4x4 matrix weights whose rows and columns sum to approximately one, preventing runaway amplification across layers.
For inference compute efficiency, V4 utilizes 384 routed experts per layer alongside one shared expert. Each token activates only six routed experts, keeping the active parameter count at ~49 billion out of 1.6 trillion. Unused experts are stored in 4-bit precision.
Retrieval Limitations
The primary compromise involves detail retention. According to DeepSeek's MRCR retrieval tests, retrieval remains reliable up to approximately 128,000 tokens before performance starts degrading, reflecting the lossy nature of both HCA compression and indexer filtering.