Compressed Sparse Attention

A DeepSeek-V4 attention variant that mixes compression and sparse access so very long prompts stay tractable.

Dense long-context attention becomes too expensive when every query wants every detailed key and value. Compressed sparse attention lowers that cost by keeping a compact memory view and only paying for selected detailed access.

At a glance

Released

June 2026

Authors

DeepSeek-AI

Optimizes

  • Kv Cache
  • Long Context Inference
  • Memory Bandwidth

What It Is

This is an attention design for extremely long contexts. The key idea is not only sparsity and not only compression. It is the combination: a compact representation for broad coverage plus selective detailed retrieval where it matters.

Why It Exists

The module targets KV-cache size, memory bandwidth, and long-context attention cost.

How It Works

Tokens are first summarized into a compressed memory path. The query can then use sparse detailed access rather than reopening the full dense history every time.

Math Or Compute Schema

The sketch below emphasizes the two-stage idea: compact memory first, selective detailed attention second.
Compressed sparse attention sketch
K~,V~=C(K,V),yt=As(qt,K~,V~,KS,VS)\tilde{K},\tilde{V} = C(K,V), \quad y_t = A_s(q_t, \tilde{K}, \tilde{V}, K_{\mathcal{S}}, V_{\mathcal{S}})
K~,V~\tilde{K}, \tilde{V}
compressed keys and values that summarize broad context
CC
the compression step
qtq_t
the current query at time step t
S\mathcal{S}
the selected sparse detailed positions
AsA_s
the sparse attention computation over compressed and selected detailed memory

Compared To Nearby Modules

Sliding-window attention cuts reach. Sparse attention cuts connectivity. CSA instead keeps broad reach but changes how much detail the model stores and revisits.

Example Architectures

DeepSeek-V4 uses CSA as part of its million-token context story.

Limitations And Tradeoffs

Compression can hide detail if the summary path is too aggressive, and sparse access adds policy complexity about what deserves high-resolution lookup.

Why It Still Matters

It is a useful reference point for long-context design because it shows a third path beyond pure locality and pure dense recurrence.

Tags

References

  1. DeepSeek-AI. "DeepSeek-V4 Technical Report." 2026.