nemo_automodel.components.models.qwen3_8_flash_next.model
nemo_automodel.components.models.qwen3_8_flash_next.model
Trainable Qwen3.8-Flash-Next conditional-generation model.
This implementation uses the checkpoint’s compressed-block QSA router and a FlexAttention sparse-GQA path for CUDA BF16 long-sequence SFT, with a PyTorch oracle for CPU and numerical parity. Pipeline and tensor parallelism remain unsupported. Context parallelism uses a model-owned contiguous sequence shard for QSA, GDN, and PLE, and composes with sequence packing.
Module Contents
Classes
Functions
Data
API
Bases: CausalLMOutputWithPast
Causal-LM output with optional per-layer HC states for parity capture.
Bases: HFCheckpointingMixin, Module, MoEFSDPSyncMixin
Trainable language-only Qwen3.8-Flash-Next causal-LM wrapper.
Convert PLE owner shards to global DTensors before FSDP wrapping.
Parameters:
Flattened data/context shard mesh whose rank order is identical to the PLE owner process group.
Returns: set[nn.Parameter]
The exact registered parameter identities that FSDP must ignore
Run language-only generation and project final HC-mixed states.
Parameters:
Raw tokenizer IDs of shape [batch, sequence].
Optional token-validity mask of shape
[batch, sequence] or backend-specific attention mask.
Optional positions of shape [batch, sequence] or
[axes, batch, sequence].
Optional embeddings of shape
[batch, sequence, hidden_size].
Optional labels of shape [batch, sequence]. They are
accepted for recipe compatibility; loss is computed externally.
Cache state; unsupported.
Cache request; True is unsupported.
0 for all positions, a positive trailing count,
or an integer tensor of shape [kept_sequence] containing
explicit sequence indices.
Explicit True returns the embedding,
every per-layer HC state, and the final state. When omitted,
config.output_hidden_states=True returns only the final
state for fused linear cross entropy without retaining every
decoder activation.
Internal contiguous CP metadata with replicated
raw-ID/padding tensors of shape [batch, global_sequence].
Text-attention backend metadata.
Returns: Qwen3_8_FlashNextCausalLMOutput
Causal-LM output with logits
Construct from a parsed Qwen3.8-Flash-Next configuration.
Construct architecture from a local/HF config before checkpoint load.
Return the text token embedding module.
Return the untied LM projection.
Initialize checkpoint-free model weights.
Parameters:
Target device for backend initializers.
Final model parameter dtype, excluding intrinsic fp32 GDN state.
Return Qwen3.8-Flash-Next’s contiguous model-owned CP batch sharder.
Parameters:
Full-sequence batch. Token-aligned tensors have shape
[batch, global_sequence, ...] and remain unchanged until
the returned sharder is invoked.
Accepted for the framework hook contract; Qwen3.8-Flash-Next shards each non-packed batch directly and does not use it.
Returns: dict[str, Any]
Mapping containing one unresolved cp_sharder. Once invoked it
Replace the text token embedding module.
Replace the untied LM projection.
Bases: Module
Language-only Qwen3.8-Flash-Next decoder wrapper.
Run the language-only Qwen3.8-Flash-Next decoder.
Parameters:
Raw IDs of shape [batch, sequence]; required for
PLE hashing.
Optional token-validity mask of shape
[batch, sequence] or backend-specific attention mask.
Optional positions of shape [batch, sequence] or
[axes, batch, sequence].
Optional embeddings of shape
[batch, sequence, hidden_size].
Cache state; unsupported for training.
Capture decoder HC states.
Internal contiguous CP metadata with replicated
raw-ID/padding tensors of shape [batch, global_sequence].
Text-attention backend arguments.
Returns: BaseModelOutputWithPast
Base-model output whose final text states have shape
Bases: Module
Qwen3.8-Flash-Next text decoder with four HC streams and one PLE layer.
Parameters:
Text architecture configuration.
Native attention, linear, and MoE backend configuration.
Optional native MoE configuration override.
Optional fields merged into the default MoE config.
Group that owns contiguous PLE table row shards. With the supported no-PP/no-TP topology this is the EP/world group.
Optional tiny-table override for unit tests. The
released checkpoint uses [320001536, 160] globally.
Run the HC decoder and final HC mixer.
Parameters:
Raw tokenizer IDs of shape [batch, sequence]. They
remain required when inputs_embeds is supplied because PLE
hashes the raw IDs.
Optional precomputed token/vision embeddings of shape
[batch, sequence, hidden_size].
Optional mask of shape [batch, sequence] or a
backend-specific attention mask.
Optional positions of shape [batch, sequence] or
[axes, batch, sequence].
Optional mask [batch, sequence] where True is padding.
KV/SSM cache; unsupported by this training backend.
Cache request; True is unsupported.
Include embedding, per-layer HC, and final collapsed states for parity diagnostics.
Internal contiguous CP metadata. Its replicated
raw-ID and padding tensors have shape [batch, global_sequence]; model activations remain local
[batch, sequence, hidden] tensors.
Attention backend metadata.
Returns: BaseModelOutputWithPast
A base-model output whose last_hidden_state has shape
Return the raw-token embedding table.
Initialize decoder weights for training from scratch.
Parameters:
Device used by layer initializers.
Replace the raw-token embedding table.
Parameters:
Module mapping [batch, sequence] IDs to
[batch, sequence, hidden_size] embeddings.
Return a backend whose rotary path supports text and multimodal layouts.