Implement the DeepSeek-V4 dense-to-sparse attention curriculum as two functions.
attention_curriculum(tokens_seen, stage_boundaries, model="flash", dense_tokens=1_000_000_000_000, indexer_warmup_tokens=10_000_000_000)
stage_boundaries = [b1, b2, b3] are increasing token counts. stage is the number of boundaries tokens_seen has reached (tokens_seen >= b); seq_len is 4096, 16384, 65536, 1048576 for stages 0 to 3.sparse_start = max(dense_tokens, b2) and full_sparse = sparse_start + indexer_warmup_tokens.tokens_seen < sparse_start: dense attention. sparse_start <= tokens_seen < full_sparse: indexer warmup, attention still dense. Otherwise: sparse attention.top_k is 512 for "flash" and 1024 for "pro", returned only when attention is sparse, else None.{"stage", "seq_len", "attention" ("dense" or "sparse"), "indexer_warmup" (bool, True only during the warmup), "top_k"}.curriculum_timeline(token_counts, stage_boundaries, model="flash", dense_tokens=1_000_000_000_000, indexer_warmup_tokens=10_000_000_000)
(seq_len, label) with label one of "dense", "indexer_warmup", "sparse".