nnterp · encyclopedia llama4_text · nnterp.families.llama4_text

family llama4_text

Llama 4

The block

01 · the residual stream

One block of the stack. Hover any part for its nnterp name; click to pin the card. The slider picks a block; this family's blocks differ by layer_types.

embed_tokenstoken_embeddings
→
layers× 48
→
normfinal_norm_output
→
lm_headlm_head_output
→
logitsthe output
i = 0

identity layers[i].input + self_attn.attention_output + mlp.mlp_output == layer_output

The vision encoder

· Llama 4 ViT · Llama4VisionModel

The image's path into the text model, then one block of the vision encoder. Hover any part for its nnterp name; click to pin the card.

imagepixel_values
→
patch_embedpatch_embeddings
→
layers× 34
→
normtower_output
→
projectorinput: the pixel-shuffle adapter's output over vision.tower_output, flattened over the tiles
→
image_featuresat the scatter
→
layers[0].inputat image_token_mask
rows
One row per image tile: the processor fits an image onto a grid of up to max_patches (16) tiles of 336 pixels and adds a global tile, the whole image resized, when there is more than one. A row is the tile's 576 patches, then the CLS token last: patches + 1 rows.
positions
patch_embeddings is the unfold-and-linear output, before the CLS token is appended. A learned embedding per row (positional_embedding_vlm, the CLS's last) is added and layernorm_pre norms the rows; every attention rotates queries and keys by the patch's 2D position, and leaves the CLS row unrotated.
masking
No mask: each row attends to every patch of its own tile and to its CLS token; tiles do not see one another.
final norm
layernorm_post is vision.norm, a LayerNorm over every row, CLS included; vision.tower_output is its output. The tower then drops the CLS row and runs vision.vision_adapter.

identity vision.layers[i].input + self_attn.attention_output + mlp.mlp_output == layer_output

The API

02 · support()

Values, by host

⚠︎ marks a value this checkpoint has only under some load: hover it for the condition.

model Llama4ForConditionalGenerationlayoutwhat it isread at
logits Logits [batch seq vocab_size] The logits the model returns, after anything it does past lm_head (a softcap, a scale)

the module's own output

token_embeddings Residual [batch seq hidden_size] The embedding module's output; layers[0].input is what enters the first block

the child module embed_tokens's output

final_norm_output Residual [batch seq hidden_size] The residual stream after the final norm, what lm_head reads

the child module norm's output

lm_head_output Logits [batch seq vocab_size] The head's logits before anything the model does past lm_head (a softcap, a scale)

the child module lm_head's output

next_token_probs NextTokenProbs [batch vocab_size] The next-token distribution at the last position; derived, read-only

the module's own output

input_ids Tokens [batch seq] The token ids the model was called with

the module's own input

attention_mask Tokens [batch seq] The attention mask the model was called with; zeros are padding

the module's own input

input_size scalar [batch, seq] of the current call; read-only

the module's own input

model.layers[i] Llama4TextDecoderLayerlayoutwhat it isread at
layer_input Residual [batch seq hidden_size] The residual stream entering the block

the module's own input

attention_norm_output Residual [batch seq hidden_size] The normed stream entering the attention

the child module input_layernorm's output

layer_mid Residual [batch seq hidden_size] The residual stream after the attention add

the child module post_attention_layernorm's input

mlp_norm_output Residual [batch seq hidden_size] The normed stream entering the MLP

the child module post_attention_layernorm's output

mlp_input Residual [batch seq hidden_size] What the MLP is called with

the child module mlp's input

layer_output Residual [batch seq hidden_size] The residual stream leaving the block, a tensor even when the block returns a tuple

the module's own output

model.layers[i].self_attn Llama4TextAttentionlayoutwhat it isread at
⚠︎attention_queries_prerope Queries [batch num_heads seq qk_head_dim] The queries entering the rotary embedding

inside the forward: the arguments of apply_rotary_emb_0, element 0

⚠︎attention_keys_prerope Keys [batch num_kv_heads seq qk_head_dim] The keys entering the rotary embedding

inside the forward: the arguments of apply_rotary_emb_0, element 1

⚠︎attention_queries Queries [batch num_heads seq qk_head_dim] The queries entering attention

inside the forward: the arguments of attention_interface_1, element 1

⚠︎attention_keys Keys [batch num_kv_heads seq qk_head_dim] The keys entering attention

inside the forward: the arguments of attention_interface_1, element 2

⚠︎attention_values Values [batch num_kv_heads seq head_dim] The values entering attention

inside the forward: the arguments of attention_interface_1, element 3

⚠︎attention_scores Pattern [batch num_heads query key] The attention scores entering the softmax, masked

inside the forward: the input of nn_functional_softmax_0 inside attention_interface_1

attention_premix HeadOutputs [batch seq num_heads head_dim] Every head's output side by side, as the output projection takes it

the child module o_proj's input

attention_output Residual [batch seq hidden_size] What the attention adds to the residual stream

the module's own output

⚠︎attention_probabilities Pattern [batch num_heads query key] The attention pattern the values are mixed with

inside the forward: the output of nn_functional_dropout_0 inside attention_interface_1

⚠︎attention_head_outputs HeadOutputs [batch seq num_heads head_dim] The per-head outputs before the output projection

inside the forward: the output of attention_interface_1, element 0

⚠︎interface method (Queries, Keys, Values) -> (HeadOutputs, Pattern) The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments

read at the arguments of attention_interface_1, with the queries, keys and values; called, the function that call ran, on the tensors given and the call's other arguments

model.layers[i].mlp Llama4TextMoelayoutwhat it isread at
mlp_activation Neurons [batch seq intermediate_size] The activation function's output

nowhere: routed experts; read per-expert via the Moe component

mlp_neurons Neurons [batch seq intermediate_size] What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise

nowhere: routed experts; read per-expert via the Moe component

mlp_output Residual [batch seq hidden_size] What the MLP adds to the residual stream: its output viewed in the residual's shape

the sibling module source.hidden_states_view_0's output

router_logits RouterLogits [batch seq num_experts] The router's logits, one per expert, before the scoring

inside router's forward: the output of forward_0

expert_weights scalar Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet

nowhere: the family does not serve it

expert_indices ExpertIndices [batch seq top_k] The expert each routing slot sends the token to

inside router's forward: the output of torch_topk_0, element 1

expert_outputs scalar Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet

nowhere: the family does not serve it

routed_output Residual [batch seq hidden_size] The routed experts' combined output

inside the forward: the output of sum_0

shared_expert_output Residual [batch seq hidden_size] The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)

the child module shared_experts's output

the vision encoder · Llama 4 ViT

model.vision Llama4VisionModellayoutwhat it isread at
image_token_mask ImageTokenMask [batch seq] Which positions hold image tokens: input_ids == the config's image_token_id; read-only

the model's own inputs, at the root

patch_embeddings Patches [images patches vision_hidden_size] The patch embedding's output, one row per patch

the child module patch_embed's output

tower_output Patches [images patches vision_hidden_size] The last block's stream after the tower's final norm, before any pooling or adapter

the child module norm's output

image_features ImageFeatures [image_tokens hidden_size] The image features the text model receives at the image tokens, flat over them

inside the forward: the arguments of inputs_embeds_masked_scatter_0, element 1

model.vision.layers[i] Llama4VisionEncoderLayerlayoutwhat it isread at
layer_input Patches [images patches vision_hidden_size] The tower's stream entering the block

the module's own input

attention_norm_output Patches [images patches vision_hidden_size] The normed stream entering the attention

the child module input_layernorm's output

layer_mid Patches [images patches vision_hidden_size] The tower's stream after the attention add

the child module post_attention_layernorm's input

mlp_norm_output Patches [images patches vision_hidden_size] The normed stream entering the MLP

the child module post_attention_layernorm's output

mlp_input Patches [images patches vision_hidden_size] What the MLP is called with

the child module mlp's input

layer_output Patches [images patches vision_hidden_size] The tower's stream leaving the block

the module's own output

model.vision.layers[i].self_attn Llama4VisionAttentionlayoutwhat it isread at
attention_queries_prerope Queries [batch num_heads seq qk_head_dim] The queries entering the rotary embedding

nowhere: a vision tower's attention: the queries and keys before a rotary embedding, and rotate, are served on the text model's blocks (a tower's rotary, where it has one, runs over 2-D patch positions)

attention_keys_prerope Keys [batch num_kv_heads seq qk_head_dim] The keys entering the rotary embedding

nowhere: a vision tower's attention: the queries and keys before a rotary embedding, and rotate, are served on the text model's blocks (a tower's rotary, where it has one, runs over 2-D patch positions)

⚠︎attention_queries Queries [batch num_heads seq qk_head_dim] The queries entering attention

inside the forward: the arguments of attention_interface_1, element 1

⚠︎attention_keys Keys [batch num_kv_heads seq qk_head_dim] The keys entering attention

inside the forward: the arguments of attention_interface_1, element 2

⚠︎attention_values Values [batch num_kv_heads seq head_dim] The values entering attention

inside the forward: the arguments of attention_interface_1, element 3

⚠︎attention_scores Pattern [batch num_heads query key] The attention scores entering the softmax, masked

inside the forward: the input of nn_functional_softmax_0 inside attention_interface_1

attention_premix HeadOutputs [batch seq num_heads head_dim] Every head's output side by side, as the output projection takes it

the child module o_proj's input

attention_output Patches [images patches vision_hidden_size] What the attention adds to the tower's stream

the module's own output

⚠︎attention_probabilities Pattern [batch num_heads query key] The attention pattern the values are mixed with

inside the forward: the output of nn_functional_dropout_0 inside attention_interface_1

⚠︎attention_head_outputs HeadOutputs [batch seq num_heads head_dim] The per-head outputs before the output projection

inside the forward: the output of attention_interface_1, element 0

⚠︎interface method (Queries, Keys, Values) -> (HeadOutputs, Pattern) The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments

read at the arguments of attention_interface_1, with the queries, keys and values; called, the function that call ran, on the tensors given and the call's other arguments

model.vision.layers[i].mlp Llama4VisionMLPlayoutwhat it isread at
mlp_activation Neurons [batch seq intermediate_size] The activation function's output

the child module act_fn's output

mlp_neurons Neurons [batch seq intermediate_size] What the down projection receives

the child module down_proj's input

mlp_output Patches [images patches vision_hidden_size] What the MLP adds to the tower's stream

the module's own output

Printout

What print(model) shows on meta-llama/Llama-4-Scout-17B-16E: the native modules, standard names and every standard value with its layout.

Llama4ForConditionalGeneration(
  (vision/vision_model): Llama4VisionModel(
    (patch_embed/patch_embedding): Llama4UnfoldConvolution(
      (unfold): Unfold(kernel_size=(14, 14), dilation=1, padding=0, stride=14)
      (linear): Linear(in_features=588, out_features=1408, bias=False)
    )
    (rotary_embedding): Llama4VisionRotaryEmbedding()
    (layernorm_pre): LayerNorm((1408,), eps=1e-05, elementwise_affine=True, bias=True)
    (norm/layernorm_post): LayerNorm((1408,), eps=1e-05, elementwise_affine=True, bias=True)
    (vision_adapter): Llama4VisionPixelShuffleMLP(
      (mlp): Llama4VisionMLP2(
        (fc1): Linear(in_features=5632, out_features=4096, bias=False)
        (down_proj/fc2): Linear(in_features=4096, out_features=4096, bias=False)
        (act_fn/activation_fn): GELU(approximate='none')
      )
    )
    (layers): ModuleList(
      (0-33): 34 x Llama4VisionEncoderLayer(
        (self_attn): Llama4VisionAttention(
          (q_proj): Linear(in_features=1408, out_features=1408, bias=True)
          (k_proj): Linear(in_features=1408, out_features=1408, bias=True)
          (v_proj): Linear(in_features=1408, out_features=1408, bias=True)
          (o_proj): Linear(in_features=1408, out_features=1408, bias=True)
          (attention_output) -> Patches [images patches vision_hidden_size]: What the attention adds to the tower's stream
          (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
          (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
          (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
          (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
          (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
          (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
          (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
          (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
          (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
          (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
        )
        (mlp): Llama4VisionMLP(
          (act_fn/activation_fn): GELU(approximate='none')
          (fc1): Linear(in_features=1408, out_features=5632, bias=True)
          (down_proj/fc2): Linear(in_features=5632, out_features=1408, bias=True)
          (mlp_output) -> Patches [images patches vision_hidden_size]: What the MLP adds to the tower's stream
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives
        )
        (input_layernorm): LayerNorm((1408,), eps=1e-05, elementwise_affine=True, bias=True)
        (post_attention_layernorm): LayerNorm((1408,), eps=1e-05, elementwise_affine=True, bias=True)
        (layer_input) -> Patches [images patches vision_hidden_size]: The tower's stream entering the block
        (attention_norm_output) -> Patches [images patches vision_hidden_size]: The normed stream entering the attention
        (layer_mid) -> Patches [images patches vision_hidden_size]: The tower's stream after the attention add
        (mlp_norm_output) -> Patches [images patches vision_hidden_size]: The normed stream entering the MLP
        (mlp_input) -> Patches [images patches vision_hidden_size]: What the MLP is called with
        (layer_output) -> Patches [images patches vision_hidden_size]: The tower's stream leaving the block
      )
    )
    (tower_output) -> Patches [images patches vision_hidden_size]: The last block's stream after the tower's final norm, before any pooling or adapter
    (image_token_mask) -> ImageTokenMask [batch seq]: Which positions hold image tokens: input_ids == the config's image_token_id; read-only
    (patch_embeddings) -> Patches [images patches vision_hidden_size]: The patch embedding's output, one row per patch
    (image_features) -> ImageFeatures [image_tokens hidden_size]: The image features the text model receives at the image tokens, flat over them
  )
  (projector/multi_modal_projector): Llama4MultiModalProjector(
    (linear_1): Linear(in_features=4096, out_features=5120, bias=False)
  )
  (generator): Generator(
    (streamer): Streamer()
  )
  (embed_tokens): Embedding(202048, 5120, padding_idx=200018)
  (layers): ModuleList(
    (0-2): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (3): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (4-6): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (7): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (8-10): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (11): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (12-14): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (15): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (16-18): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (19): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (20-22): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (23): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (24-26): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (27): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (28-30): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (31): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (32-34): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (35): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (36-38): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (39): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (40-42): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (43): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (44-46): 3 x Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (qk_norm): Llama4TextL2Norm(eps=1e-05)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
    (47): Llama4TextDecoderLayer(
      (self_attn): Llama4TextAttention(
        (q_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (k_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (v_proj): Linear(in_features=5120, out_features=1024, bias=False)
        (o_proj): Linear(in_features=5120, out_features=5120, bias=False)
        (attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
        (attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
        (attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
        (attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
        (attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
        (attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
        (attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
        (attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
        (attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
        (attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
        (interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
      )
      (mlp/feed_forward): Llama4TextMoe(
        (experts): Llama4TextExperts(
          (act_fn): SiLUActivation()
        )
        (router): Llama4Router(in_features=5120, out_features=16, bias=False)
        (shared_experts/shared_expert): Llama4TextMLP(
          (gate_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (up_proj): Linear(in_features=5120, out_features=8192, bias=False)
          (down_proj): Linear(in_features=8192, out_features=5120, bias=False)
          (act_fn/activation_fn): SiLUActivation()
          (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
          (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
          (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        )
        (router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert, before the scoring
        (expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
        (expert_weights): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (expert_outputs): Unavailable: Llama 4's router scales each expert's input by a dense score over every expert; not mapped yet
        (routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
        (shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output (a copy, since the mixture adds the routed sum into the live tensor in place)
        (mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
        (mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
        (mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output viewed in the residual's shape
      )
      (input_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (post_attention_layernorm): Llama4TextRMSNorm((5120,), eps=1e-05)
      (layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
      (attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
      (layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
      (mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
      (mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
      (layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
    )
  )
  (norm): Llama4TextRMSNorm((5120,), eps=1e-05)
  (lm_head): Linear(in_features=5120, out_features=202048, bias=False)
  (logits) -> Logits [batch seq vocab_size]: The logits the model returns, after anything it does past lm_head (a softcap, a scale)
  (token_embeddings) -> Residual [batch seq hidden_size]: The embedding module's output; layers[0].input is what enters the first block
  (final_norm_output) -> Residual [batch seq hidden_size]: The residual stream after the final norm, what lm_head reads
  (lm_head_output) -> Logits [batch seq vocab_size]: The head's logits before anything the model does past lm_head (a softcap, a scale)
  (next_token_probs) -> NextTokenProbs [batch vocab_size]: The next-token distribution at the last position; derived, read-only
  (input_ids) -> Tokens [batch seq]: The token ids the model was called with
  (attention_mask) -> Tokens [batch seq]: The attention mask the model was called with; zeros are padding
  (input_size): [batch, seq] of the current call; read-only
)

Config

model.num_layers48
model.hidden_size5120
model.num_heads40
model.num_kv_heads8
model.head_dim128
model.qk_head_dim128
model.vocab_size202048
model.intermediate_size16384
architecturesLlama4ForConditionalGeneration
num_hidden_layers48
hidden_size5120
intermediate_size8192
num_attention_heads40
num_key_value_heads8
head_dim128
vocab_size202048
max_position_embeddings262144
hidden_actsilu
rms_norm_eps1e-05
tie_word_embeddingsFalse
num_experts_per_tok1
num_local_experts16
attention_biasFalse
use_qk_normTrue
interleave_moe_layer_step1
intermediate_size_mlp16384
no_rope_layer_interval4
attention_chunk_size8192
attn_temperature_tuningTrue
attn_scale0.1
floor_scale8192
Vision Config

Vision Config

model.vision.num_layers34
model.vision.vision_hidden_size1408
model.vision.num_heads16
model.vision.head_dim88
model.vision.intermediate_size5632
model.vision.patch_size14
model.vision.image_size336

The Notes

03 · what to know before you run

The router scales the expert's input, not its output

s   = sigmoid(top_1(router_logits))       # 0 for every expert but the chosen one
out = shared_expert(x) + experts(x * s)

Each token's one expert reads the token's input times its sigmoid score, so expert_weights and expert_outputs are unavailable, and mlp_output is shared_expert_output + routed_output. Steer the routing at router_logits, where an expert's logit at -inf sends its tokens to their next choice.

Vision notes

· Llama 4 ViT · Llama 4

The Llama 4 ViT vision encoder

The block is LayerNorm pre-norm, with biases

h   = x + self_attn(input_layernorm(x))             # 2D rotary on q and k
out = h + mlp(post_attention_layernorm(h))          # fc1, GELU, fc2

Both norms are LayerNorms, and the projections and both MLP linears carry biases. Nothing norms a sublayer's output, so vision.layers[i].input + attention_output + mlp_output == layer_output. On Scout and Maverick the vision encoder is 34 blocks of 1408 wide, 16 heads of 88.

The CLS token is the last row

The tower appends its class_embedding after the 576 patches, so every vision.layers[i] value is [tiles, 577, vision_hidden_size] with the CLS at index -1, and patch_embeddings is the 576 patches alone. layernorm_post norms all 577 rows; the tower then drops the CLS, so vision.tower_output[:, -1] reaches nothing: on the pinned tiny checkpoint a write to it leaves the logits bit-identical, and a write to vision.tower_output[:, :-1] changes them. Select the patches with [:, :-1], not CLIP's [:, 1:].

The pixel-shuffle adapter is inside the vision encoder

vision.vision_adapter takes vision.tower_output[:, :-1], merges each 2 × 2 block of patches into one row (pixel_shuffle_ratio 0.5) and runs a two-layer MLP with a GELU after each linear: 576 patches become 144 rows of projector_output_dim (4096). Its output is the tower's own last_hidden_state.

with model.trace(prompt, images=[image]):
    out = model.vision.tower_output.save()              # [tiles, 577, vision_hidden_size]
    read = model.vision.vision_adapter.input.save()
    shuffled = model.vision.vision_adapter.output.save()

torch.equal(read, out[:, :-1])     # True: the patches, the CLS dropped
shuffled.shape[1]                  # 144 on Scout: 576 / 4

Llama 4

The projector reads 144 rows per tile

projector.input is vision.vision_adapter's output flattened over the tiles, so an image's count of image tokens depends on how many tiles the processor cuts it into.

From the family module

04 · nnterp/families/llama4_text.py

Llama 4, text (Llama4ForCausalLM, model_type llama4_text): Scout and Maverick's language model.

model.{embed_tokens, layers[i].{input_layernorm, self_attn, post_attention_layernorm, feed_forward}, norm} and lm_head: Llama's tree with the feed-forward called feed_forward, renamed to mlp. A llama4 checkpoint (Llama4ForConditionalGeneration, the published Scout and Maverick repos) nests its config's text_config, of this type; the text-generation task builds Llama4ForCausalLM from it, and a wrapper module passed in already loaded keeps the text model at language_model.{model.*, lm_head}, so RENAME carries both spellings and whichever the tree has binds.

The block adds both residuals itself, attention through the shared attention interface (Llama 4's eager forward keeps the softmax in the model dtype). What differs from Llama, inside the attention and the feed-forward:

  • iRoPE. no_rope_layers[i] == 0 marks a NoPE block: no rotary embedding, no qk-norm, full causal attention, and attention temperature tuning (attn_temperature_tuning) scales its queries by a factor that grows with the position. The other blocks apply the rotary embedding, then a weightless RMS qk-norm (Llama4TextL2Norm, use_qk_norm), and attend within chunks of attention_chunk_size tokens (config.layer_types). The queries and keys served are what the interface receives, after all of that; a chunked block's pattern is zero across chunk boundaries.
  • Interleaved mixture of experts. Blocks in moe_layers carry a Llama4TextMoe (a shared expert plus routed experts) returning (out, router_logits) with out flattened to [batch * seq, hidden_size]; the others a dense Llama4TextMLP. The block views either back into the residual's shape before adding it, so mlp_output is read at that view in the block's forward: [batch, seq, hidden_size] on both kinds, and edits to it reach the feed-forward's own output tensor. The shared expert is a Llama4TextMLP too, so it is an Mlp; its mlp_output is unavailable, since the block adds the mixture's sum. The mixture is a Moe whose router returns dense scores [tokens, num_experts] (the sigmoid of the top-k logits, zero elsewhere): the experts run on every token, each scaled on its input by its score, and the routed sum is added into the shared expert's output tensor in place. So router_logits (the router's projection) and expert_indices (its top-k) are the router's own; routed_output is the mixture's sum over the experts; shared_expert_output is a copy taken as the shared expert returns, whose edits are carried back; and expert_weights / expert_outputs are unavailable.
  • Sizes. intermediate_size in this config is the experts' width (and the shared expert's); the dense MLP's is intermediate_size_mlp, which the root's intermediate_size reports. Scout has a mixture on every block, so there it names a width the model never uses, as on Qwen3-MoE; Maverick alternates dense and mixture blocks.

On the wrapper the vision tower vision_model is vision (a Vision) and multi_modal_projector, the last module before the scatter, is projector. The tower is a ViT over each image tile: the patch embedding (patch_embedding, an unfold and a linear) is vision.patch_embed, the blocks (model.layers, pre-norm, on the shared attention interface with a 2D rotary embedding) are vision.layers, and layernorm_post is vision.norm. A CLS token is appended after the patches, so the tower's stream is [tiles, patches + 1, vision_hidden_size] with the CLS last (CLIP's is first); the tower drops it after layernorm_post, then pixel-shuffles and projects the patches in vision.vision_adapter, so vision.tower_output is layernorm_post's output, CLS included, and projector.input is the adapter's output, flattened over the tiles. Loaded with task="image-text-to-text" (the processor), the tower serves vision.image_token_mask and vision.image_features. The text-generation task builds Llama4ForCausalLM, which has no tower.