flashinfer.cake_kda_nondet_train.cake_kda_nondet_train_arena

flashinfer.cake_kda_nondet_train.cake_kda_nondet_train_arena(*, lean: bool = False, tail_passes: int = 1, batch_tokens: int | None = None, max_docs_per_batch: int | None = None) → Any

The lower-memory arena option (a CakeKDANondetArena; the default, lean=False, tail_passes=1, no batching, is the full layout). lean=True selects the lean backward layouts (4108 B per internal token-head with one tail pass instead of the default’s 4488, tape 3720; no checkpoint replay on such a workspace); tail_passes >= 2 (implies lean) runs the backward’s tail, the fused gradient / GLM intra / gate epilogue, once per range of ceil(NC_pad / tail_passes) chunks over per-range buffers: 2820 B per internal token-head plus three state blocks on the floor, the same gradients bitwise, some speed cost (see the package README). batch_tokens runs the forward and the backward over groups of whole, contiguous documents of at most that many tokens (and at most max_docs_per_batch documents, which needs batch_tokens) in an arena sized for the largest group (at tail_passes; each group runs its tail in the fewest passes up to that which fit the arena); the calls then take doc_lengths. Bitwise the same results, except that an exactly-zero u / w entry of a chunk whose pair partner changed may change sign; refused on the rows with at most four (document, head) chains on the segmented route.