bridge.models.qwen.modeling_qwen4_exp.flops#

Logical matrix-work estimates shared by Qwen4-Exp LM and VLM models.

Module Contents#

Functions#

estimate_language_flops

Estimate logical language FLOPs, independent of parallel sharding.

API#

bridge.models.qwen.modeling_qwen4_exp.flops.estimate_language_flops(
config: bridge.models.qwen.modeling_qwen4_exp.model_config.Qwen4ExpModelConfig,
*,
batch_size: int,
seqlen_sum: float | None = None,
seqlen_squared_sum: float | None = None,
include_backward: bool = True,
) → float#

Estimate logical language FLOPs, independent of parallel sharding.

As in Core’s model-owned estimators, trainable matrix work costs three forward passes when backward is included. Detached indexer projections run only forward. Standard blocks follow the pinned Core conventions: GDN recurrence is approximate, QSA uses a dense attention surrogate, and indexer scoring, norms, lookups, PLE convolution, router scoring, communication and optimizer work are excluded. Freezing the PLE lookup table does not remove its trainable projections.