Complete blocks
×For each query, every compressed position whose block of 128 is complete.
- in
- [B batch, T/128 compressed positions, 512 d_h]
- out
- [B batch, T positions, T/128 compressed positions]
No indexer: a query reads all of them. A position’s own block is read only through the window until it is complete (model.py 268–276). Only the number of entries is read, not their values: the list depends on positions alone, and the code makes it before the compressor runs (model.py 513, 525).
Sources
In codeget_compress_topk_idxs(ratio, bsz, seqlen, start_pos, offset) · 513
Direct evidence
Without an indexer, a query lists every compressed position whose block is complete: j < ⌊(t + 1)/m⌋, shifted by the window rows.
model.py 268–276 ↗ · deepseek-ai/DeepSeek-V4-Pro @ b5968e9190ef
Excerpt
@lru_cache(2)
def get_compress_topk_idxs(ratio: int, bsz: int, seqlen: int, start_pos: int, offset: int):
if start_pos > 0:
matrix = torch.arange(0, (start_pos + 1) // ratio) + offset
else:
matrix = torch.arange(seqlen // ratio).repeat(seqlen, 1)
mask = matrix >= torch.arange(1, seqlen + 1).unsqueeze(1) // ratio
matrix = torch.where(mask, -1, matrix + offset)
return matrix.unsqueeze(0).expand(bsz, -1, -1)