family granitemoehybrid
One block of the stack. Hover any part for its nnterp name; click to pin the card. The slider picks a block, each tick's color gives its block's shape, and the diagram redraws for the block picked.
One block of the stack. Hover any part for its nnterp name; click to pin the card. The slider picks a block, each tick's color gives its block's shape, and the diagram redraws for the block picked.
One block of the stack. Hover any part for its nnterp name; click to pin the card.
One block of the stack. Hover any part for its nnterp name; click to pin the card.
identity layers[i].input + linear_attn.attention_output + mlp.mlp_output == layer_output
⚠︎ marks a value this checkpoint has only under some load: hover it for the condition.
⚠︎ marks a value this checkpoint has only under some load: hover it for the condition.
⚠︎ marks a value this checkpoint has only under some load: hover it for the condition.
⚠︎ marks a value this checkpoint has only under some load: hover it for the condition.
What print(model) shows on ibm-granite/granite-4.0-h-350m-base: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=768, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 768, padding_idx=100256)
(layers): ModuleList(
(0-9): 10 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(10): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=768, out_features=768, bias=False)
(k_proj): Linear(in_features=768, out_features=256, bias=False)
(v_proj): Linear(in_features=768, out_features=256, bias=False)
(o_proj): Linear(in_features=768, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(11-12): 2 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(13): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=768, out_features=768, bias=False)
(k_proj): Linear(in_features=768, out_features=256, bias=False)
(v_proj): Linear(in_features=768, out_features=256, bias=False)
(o_proj): Linear(in_features=768, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(14-16): 3 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(17): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=768, out_features=768, bias=False)
(k_proj): Linear(in_features=768, out_features=256, bias=False)
(v_proj): Linear(in_features=768, out_features=256, bias=False)
(o_proj): Linear(in_features=768, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(18-26): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(27): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=768, out_features=768, bias=False)
(k_proj): Linear(in_features=768, out_features=256, bias=False)
(v_proj): Linear(in_features=768, out_features=256, bias=False)
(o_proj): Linear(in_features=768, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(28-31): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-350m: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=768, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 768, padding_idx=100256)
(layers): ModuleList(
(0-9): 10 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(10): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=768, out_features=768, bias=False)
(k_proj): Linear(in_features=768, out_features=256, bias=False)
(v_proj): Linear(in_features=768, out_features=256, bias=False)
(o_proj): Linear(in_features=768, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(11-12): 2 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(13): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=768, out_features=768, bias=False)
(k_proj): Linear(in_features=768, out_features=256, bias=False)
(v_proj): Linear(in_features=768, out_features=256, bias=False)
(o_proj): Linear(in_features=768, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(14-16): 3 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(17): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=768, out_features=768, bias=False)
(k_proj): Linear(in_features=768, out_features=256, bias=False)
(v_proj): Linear(in_features=768, out_features=256, bias=False)
(o_proj): Linear(in_features=768, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(18-26): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(27): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=768, out_features=768, bias=False)
(k_proj): Linear(in_features=768, out_features=256, bias=False)
(v_proj): Linear(in_features=768, out_features=256, bias=False)
(o_proj): Linear(in_features=768, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(28-31): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=768, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=768, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3376, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((768,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-1b-base: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=1536, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 1536, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-1b: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=1536, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 1536, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-micro-base: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=2048, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 2048, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-micro: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=2048, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 2048, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-tiny-base: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=1536, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 1536, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-tiny: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=1536, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 1536, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-small-base: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=4096, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 4096, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-h-small: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=4096, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 4096, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=4096, out_features=3072, bias=False)
(down_proj/output_linear): Linear(in_features=1536, out_features=4096, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(8448, 8448, kernel_size=(4,), stride=(1,), padding=(3,), groups=8448)
(in_proj): Linear(in_features=4096, out_features=16768, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((4096,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-tiny-base-preview: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=1536, out_features=50304, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(50304, 1536, padding_idx=0)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-tiny-preview: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=1536, out_features=49160, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(49160, 1536, padding_idx=0)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=512, bias=False)
(v_proj): Linear(in_features=1536, out_features=512, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(block_sparse_moe): GraniteMoeHybridMoE(
(router): GraniteMoeHybridTopKRouter()
(experts): GraniteMoeHybridExperts(
(act_fn): SiLUActivation()
)
)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1536, out_features=2048, bias=False)
(down_proj/output_linear): Linear(in_features=1024, out_features=1536, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(3328, 3328, kernel_size=(4,), stride=(1,), padding=(3,), groups=3328)
(in_proj): Linear(in_features=1536, out_features=6448, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((1536,), eps=1e-05)
(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
)What print(model) shows on ibm-research/granite-4.0-h-3b-ar: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=2048, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 2048, padding_idx=100256)
(layers): ModuleList(
(0-4): 5 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(5): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(6-14): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(15): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(16-24): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(25): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(26-34): 9 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(35): GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
(36-39): 4 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(linear_attn/mamba): GraniteMoeHybridMambaLayer(
(act): SiLUActivation()
(conv1d): Conv1d(4352, 4352, kernel_size=(4,), stride=(1,), padding=(3,), groups=4352)
(in_proj): Linear(in_features=2048, out_features=8512, bias=False)
(norm): GraniteMoeHybridRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the Mamba-2 mixer adds to the residual stream: its output times residual_multiplier
(attention_queries) -> SSDQueries [batch seq groups state_dim]: C, the queries reading the state
(attention_keys) -> SSDKeys [batch seq groups state_dim]: B, the keys writing into the state
(attention_values) -> SSDValues [batch seq heads head_dim]: x, the values written into the state
(betas) -> Gates [batch seq heads]: dt, the per-token write strength into the state
(decays) -> Gates [batch seq heads]: A * dt, the per-token log decay of the state
(state_input) -> State | None [batch heads key_dim value_dim]: The state entering the layer, or None at the start of a prompt (a copy of the cache's buffer)
(attention_head_outputs) -> SSDHeadOutputs [batch seq heads head_dim]: y, the per-head outputs before the gated norm and the output projection
(state_output) -> State [batch heads key_dim value_dim]: The state leaving the layer
(states) -> States [batch seq heads key_dim value_dim]: The state after every token of this call; needs nnterp.chunk_per_token(model)
(state): Unavailable: the chunk scan computes every token's state in one tensor per call, not one occurrence per token to walk with tracer.iter; read states, or state_after(t), after nnterp.chunk_per_token(model)
(set_state_after): Unavailable: the chunk scan computes every boundary state in one cumulative step from the initial state, so a state written at token t does not flow into later tokens' states; assign state_input to change where a call starts
)
(mlp_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-350m-base: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=1024, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 1024, padding_idx=100256)
(layers): ModuleList(
(0-27): 28 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1024,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1024,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1024, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=1024, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1024, out_features=1024, bias=False)
(k_proj): Linear(in_features=1024, out_features=256, bias=False)
(v_proj): Linear(in_features=1024, out_features=256, bias=False)
(o_proj): Linear(in_features=1024, out_features=1024, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((1024,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-350m: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=1024, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 1024, padding_idx=100256)
(layers): ModuleList(
(0-27): 28 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((1024,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((1024,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=1024, out_features=4096, bias=False)
(down_proj/output_linear): Linear(in_features=2048, out_features=1024, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=1024, out_features=1024, bias=False)
(k_proj): Linear(in_features=1024, out_features=256, bias=False)
(v_proj): Linear(in_features=1024, out_features=256, bias=False)
(o_proj): Linear(in_features=1024, out_features=1024, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((1024,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-1b-base: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=2048, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 2048, padding_idx=100256)
(layers): ModuleList(
(0-39): 40 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-1b: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=2048, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 2048, padding_idx=100256)
(layers): ModuleList(
(0-39): 40 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2048, out_features=8192, bias=False)
(down_proj/output_linear): Linear(in_features=4096, out_features=2048, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2048, out_features=2048, bias=False)
(k_proj): Linear(in_features=2048, out_features=512, bias=False)
(v_proj): Linear(in_features=2048, out_features=512, bias=False)
(o_proj): Linear(in_features=2048, out_features=2048, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((2048,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-micro-base: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=2560, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 2560, padding_idx=100256)
(layers): ModuleList(
(0-39): 40 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2560,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2560,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2560, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2560, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2560, out_features=2560, bias=False)
(k_proj): Linear(in_features=2560, out_features=512, bias=False)
(v_proj): Linear(in_features=2560, out_features=512, bias=False)
(o_proj): Linear(in_features=2560, out_features=2560, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((2560,), eps=1e-05)
(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
)What print(model) shows on ibm-granite/granite-4.0-micro: the native modules, standard names and every standard value with its layout.
GraniteMoeHybridForCausalLM(
(lm_head): Linear(in_features=2560, out_features=100352, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(100352, 2560, padding_idx=100256)
(layers): ModuleList(
(0-39): 40 x GraniteMoeHybridDecoderLayer(
(input_layernorm): GraniteMoeHybridRMSNorm((2560,), eps=1e-05)
(post_attention_layernorm): GraniteMoeHybridRMSNorm((2560,), eps=1e-05)
(mlp/shared_mlp): GraniteMoeHybridMLP(
(act_fn/activation): SiLUActivation()
(input_linear): Linear(in_features=2560, out_features=16384, bias=False)
(down_proj/output_linear): Linear(in_features=8192, out_features=2560, bias=False)
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output, unscaled
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: the routed experts plus the shared expert, times residual_multiplier
(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_weights) -> ExpertWeights [batch seq top_k]: The weight each selected expert's output is scaled by
(expert_indices) -> ExpertIndices [batch seq top_k]: The expert each routing slot sends the token to
(expert_outputs) -> ExpertOutputs [batch seq top_k hidden_size]: Each routing slot's weighted expert output
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output
)
(self_attn): GraniteMoeHybridAttention(
(q_proj): Linear(in_features=2560, out_features=2560, bias=False)
(k_proj): Linear(in_features=2560, out_features=512, bias=False)
(v_proj): Linear(in_features=2560, out_features=512, bias=False)
(o_proj): Linear(in_features=2560, out_features=2560, bias=False)
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output times residual_multiplier
(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_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_input) -> Residual [batch seq hidden_size]: What the feed-forward is called with: the input of each of its modules
(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
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): GraniteMoeHybridRMSNorm((2560,), eps=1e-05)
(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
)mlp is the shared MLPh = x + mixer(input_layernorm(x)) * residual_multiplier # linear_attn or self_attn
n = post_attention_layernorm(h)
out = h + (block_sparse_moe(n) + mlp(n)) * residual_multiplier
attention_output, on either mixer, and mlp_output are the tensors the block adds, outputs times
residual_multiplier. mlp is the shared MLP every block has, so mlp.output is its output
alone; on the mixture checkpoints (H-Tiny, H-Small, the Tiny previews) mlp_output also holds the
routed experts' term, layers[i].block_sparse_moe.output, and a write to it replaces both. In
bfloat16 a write to either contribution moves the other positions by rounding; load in float32 for
small edits.
The tokenizer adds no beginning-of-sequence token, so the prompt's first token takes most of the attention and its stream has a norm many times the other positions'. Leave position 0 out of activation statistics and steering-vector norms.
logits_scaling, and the embeddings multipliedmodel.logits is lm_head.output / logits_scaling and project_on_vocab divides too, so a softmax
over lm_head.output is sharper than the model's own distribution. layers[0].input is
token_embeddings times embedding_multiplier, and embeddings passed as inputs_embeds are
multiplied too, so to set what block 0 reads, edit layers[0].input.
GraniteMoE-Hybrid (GraniteMoeHybridForCausalLM, IBM Granite 4.0 and 4.0-H).
Llama's containers over one block class that holds either a Mamba-2 mixer or
attention, by config.layers_block_type, and then a feed-forward::
model.layers[i] GraniteMoeHybridDecoderLayer
.input_layernorm
.mamba GraniteMoeHybridMambaLayer, an SSD mixer (or .self_attn)
.post_attention_layernorm
.block_sparse_moe GraniteMoeHybridMoE (only when num_local_experts > 0)
.shared_mlp GraniteMoeHybridMLP (on every block)
h = x + mixer(input_layernorm(x)) * residual_multiplier
out = h + (block_sparse_moe(n) + shared_mlp(n)) * residual_multiplier with n = post_attention_layernorm(h)
(shared_mlp(n) alone on a dense checkpoint, Granite-4.0-H-Micro's.) mamba
is linear_attn (nnterp.StateSpace) and shared_mlp, the one feed-forward
every block has, is mlp; each block has self_attn or linear_attn,
never both. As on Granite (granite.py) the block adds each sublayer's output
times residual_multiplier: both mixers' attention_output are the module's
output times it, computed copies divided on assignment and carried back by a
transform. No module returns the feed-forward's sum, so mlp_output is the
block's binding of it (hidden_states_4 with experts, hidden_states_5
without) times the multiplier, and the family's Layer sets sourced for
it; the mixer and the shared expert, whose modules keep no config, read the
multiplier (and the Mlp whether routed experts run) off their parent block. A write lands on the sum, replacing both experts' contribution.
mlp.output is the shared expert's output alone and
layers[i].block_sparse_moe.output the routed experts'; mlp_input is the
pre-MLP norm's output, which both are called with, not mlp.input, the
shared expert's argument alone, so a write to it reaches both. The mixture's values
live on mlp (a Moe), which reads block_sparse_moe's router and
experts through its parent: shared_expert_output is mlp.output
and routed_output + shared_expert_output == mlp_output / residual_multiplier. mlp.intermediate_size
and the root's intermediate_size are the shared expert's width,
shared_intermediate_size; the routed experts are intermediate_size wide.
The attention runs the shared attention interface with attention_multiplier as its
scale and no rotary under position_embedding_type nope (Granite-4.0-H);
embedding_multiplier and logits_scaling are as on Granite.