Summary-token architectures such as Kwai Summary Attention (KSA) compress distant context into learnable Summary token per chunk, and hybrid variants interleave these layers with full attention to retain exact access to the original text. In such hybrid KSA-Full architecture, the interleaving inserted summary tokens are served as a streaming flow role across different layers. Although effective, however, it also introduce some bottlenecks: (1) the different layers summary compression chunk must be same, therefore hard to reach a flexible KV Cache compression, e.g., different layer set different summary compression chunk window. (2) in the full-attention layers, the summary token introduced additional computation cost, but such layer ignore them and still pay quadratic prefilling, therefore unfriendly to the computation side. Motivated by them, we developed the KSA V2, which not only achieves a more flexible KV cache memory compression but also reduces the computation cost in Full attention layer. Specifically, we found that the summary tokens can serve two roles: the KV memory and sparse indexer.
Figures & tables
Figure 1: Left: long-context and general capabilities of 1.9B C-KSA+S-KSA and the reference models reported in KSA. Right: per token inference FLOPs and cache size ( 1GiB=230 bytes).
Figure 2: Architecture overview: from Hybrid KSA to KSA V2.
Figure 3: Compressed KSA with ks=4 and km=2 . Complete remote Summary groups are compressed into Meta KV, while boundary Summary KV and local text KV remain directly accessible.
Figure 4: Sparse KSA with ks=4 and b=2 .
Figure 5: C-KSA cache layout and decoding updates with ks=2 , W=4 , and km=4 . Gray ( T ), orange ( S ), and purple ( M ) denote text, Summary, and Meta KV. Blue marks indicate reads or writes.
Mechanism
Effective Context
KV Cache Size ( N→∞ )
Compression Rate
MHA
N (exactly)
2⋅N⋅H⋅dh
—
GQA
N (exactly)
2⋅N⋅HKV⋅dh
HHKV≈6.25%
MLA
N (exactly)
N⋅(dc+dr)
2Hdhdc+dr≈1.76%
GDN
N (ambiguous)
H⋅dh2
2Ndh≈0%
SWA
w (exactly)
2⋅w⋅HKV⋅dh
Nw⋅HHKV≈0%
KSA
N (summarized)
2⋅ksN⋅H⋅dh
ks1≈12.5%
Table 1: KV-cache cost comparison for a sequence of N text tokens. Example settings use ks=8 , km=128 , H=128 , dh=128 , HKV=8 , dc=512 , and dr=64 . Compression rates are relative to MHA.
Figure 6: KV cache size comparison across different mechanisms as sequence length grows. The inset uses a logarithmic vertical axis to separate the low-cache curves and labels C-KSA values at 128K.
Figure 7: Kernel design for C-KSA and S-KSA: (a) direct KV addressing, (b) fused block scoring and selection under a K -token budget, and (c) shared tiled prefill with KV reuse.
Configuration
1.9B
4B
Shared backbone
Number of layers
24
36
Hidden size
2048
2560
Intermediate size
6144
9728
Attention heads (Q/KV)
16/16
32/8
Head dimension
128
128
Table 2: Configurations of the selected 1.9B and 4B models. Module settings apply where the corresponding modules are used.
Figure 8: Sequential adaptation and parameter selection for KSA V2 at 1.9B.
Configuration
C-KSA
S-KSA
Module-only
Full-parameter
Module-only
Trainable parameters
Aggregation modules
All
Aggregation and Indexer
Training tokens (B), 1.9B
6.7
3.4
18.5
Training tokens (B), 4B
6.7
15.9
4.2
Target learning rate
10−4
10−4
10−3
LR warmup (updates)
200
400
200
Table 3: Adaptation hyperparameters and token budgets for the selected models.
Table 4: Long-context retrieval and general capabilities at 1.9B (%; pass@1 for code). Bold and underlined values mark the best and second-best scores, respectively, here and in subsequent tables.