nemo_automodel.components.models.deepseek_v4.flops
nemo_automodel.components.models.deepseek_v4.flops
Useful model FLOPs for DeepSeek V4 text training.
Module Contents
Functions
API
Sum min(floor(position / ratio), cap) over one-based query positions.
Count useful GEMM FLOPs for text-only full-parameter training without MTP.
Projections, active routed/shared experts, hyper-connection coefficient and residual mixing, and causal attention count forward and backward (6 per MAC). The hard-top-k indexer has no gradient and counts forward only (2 per MAC), including its separate overlapping compressor. Ratio-4 attention caps compressed keys at index_topk; other compressed layers use all causal pooled keys. Every layer also uses causal sliding-window attention.
Counts assume one unpadded document per sequence. Activation recomputation, masked-out dense work, communication, optimizer updates, pooling, softmax, norms, RoPE, and elementwise operations are excluded, as for other MFU formulas. Compressor projections run at every token, but have no backward pass when the sequence is too short to produce a complete pooled window.
Parameters:
DeepSeek V4 text configuration with MTP disabled.
Number of sequences in the global optimizer step.
Tokens per sequence; defaults to max_position_embeddings.
Returns: float
Model FLOPs across all devices for one optimizer step.
Raises:
ValueError: Vision, MTP, or invalid sequence/compression settings prevent this text-only accounting.