Skip to navigation

nemo_automodel.components.models.hy_v4_flash.flops

View as MarkdownOpen in Claude

Model FLOPs of Hy4-flash, in the repository’s convention (6 x MACs, causal-aware, recompute excluded).

Registered through HYV4FlashConfig.flops_formula so no shared utility names this model. Counted per token:

  • the expanded MLA linears of every layer (the absorbed kernel’s extra work is hardware FLOPs, not model FLOPs);
  • the QK^T and PV products over min(i + 1, window) keys in sliding layers and, in sparse layers, over the query’s own partial pool plus at most index_topk / index_kpool - 1 closed pools;
  • the frozen compressed indexer on sparse layers, forward only (2 x MACs: a hard top-k has no gradient); documents no longer than index_topk only project their token keys;
  • the MoE router, latent projections, top_k routed experts and the shared expert (a dense MLP in layer 0);
  • two hyper-connection sites per layer and the head, the Engram projections, and the fp32 lm_head.

The vision tower, table gathers, hashing, norms, RoPE and gating are not counted.

Module Contents

Functions

NameDescription
hy_v4_flash_flopsModel FLOPs of one training step of gbs sequences of seq_len tokens.

API

nemo_automodel.components.models.hy_v4_flash.flops.hy_v4_flash_flops(
gbs: int = 1,
seq_len: int | None = None
) -> float

Model FLOPs of one training step of gbs sequences of seq_len tokens.

config is the composite or the text configuration; seq_len defaults to max_position_embeddings. Trainable GEMMs and attention products count 6 x MACs, the frozen indexer 2 x MACs.