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.
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 == layer_output
⚠︎ marks a value this checkpoint has only under some load: hover it for the condition.
What print(model) shows on AntonV/mamba2-130m-hf: the native modules, standard names and every standard value with its layout.
Mamba2ForCausalLM(
(lm_head): Linear(in_features=768, out_features=50288, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(50288, 768)
(layers): ModuleList(
(0-23): 24 x Mamba2Block(
(norm): Mamba2RMSNorm()
(linear_attn/mixer): Mamba2Mixer(
(act): SiLUActivation()
(conv1d): Conv1d(1792, 1792, kernel_size=(4,), stride=(1,), padding=(3,), groups=1792)
(in_proj): Linear(in_features=768, out_features=3352, bias=False)
(norm): MambaRMSNormGated()
(out_proj): Linear(in_features=1536, out_features=768, bias=False)
(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
(attention_output) -> Residual [batch seq hidden_size]: What the mixer adds to the residual stream
)
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid): Unavailable: a state-space block: one sublayer, the mixer, so there is no stream between sublayers and no MLP
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): Mamba2RMSNorm()
(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 AntonV/mamba2-370m-hf: the native modules, standard names and every standard value with its layout.
Mamba2ForCausalLM(
(lm_head): Linear(in_features=1024, out_features=50288, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(50288, 1024)
(layers): ModuleList(
(0-47): 48 x Mamba2Block(
(norm): Mamba2RMSNorm()
(linear_attn/mixer): Mamba2Mixer(
(act): SiLUActivation()
(conv1d): Conv1d(2304, 2304, kernel_size=(4,), stride=(1,), padding=(3,), groups=2304)
(in_proj): Linear(in_features=1024, out_features=4384, bias=False)
(norm): MambaRMSNormGated()
(out_proj): Linear(in_features=2048, out_features=1024, bias=False)
(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
(attention_output) -> Residual [batch seq hidden_size]: What the mixer adds to the residual stream
)
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid): Unavailable: a state-space block: one sublayer, the mixer, so there is no stream between sublayers and no MLP
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): Mamba2RMSNorm()
(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 AntonV/mamba2-780m-hf: the native modules, standard names and every standard value with its layout.
Mamba2ForCausalLM(
(lm_head): Linear(in_features=1536, out_features=50288, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(50288, 1536)
(layers): ModuleList(
(0-47): 48 x Mamba2Block(
(norm): Mamba2RMSNorm()
(linear_attn/mixer): Mamba2Mixer(
(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): MambaRMSNormGated()
(out_proj): Linear(in_features=3072, out_features=1536, bias=False)
(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
(attention_output) -> Residual [batch seq hidden_size]: What the mixer adds to the residual stream
)
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid): Unavailable: a state-space block: one sublayer, the mixer, so there is no stream between sublayers and no MLP
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): Mamba2RMSNorm()
(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 AntonV/mamba2-1.3b-hf: the native modules, standard names and every standard value with its layout.
Mamba2ForCausalLM(
(lm_head): Linear(in_features=2048, out_features=50288, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(50288, 2048)
(layers): ModuleList(
(0-47): 48 x Mamba2Block(
(norm): Mamba2RMSNorm()
(linear_attn/mixer): Mamba2Mixer(
(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): MambaRMSNormGated()
(out_proj): Linear(in_features=4096, out_features=2048, bias=False)
(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
(attention_output) -> Residual [batch seq hidden_size]: What the mixer adds to the residual stream
)
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid): Unavailable: a state-space block: one sublayer, the mixer, so there is no stream between sublayers and no MLP
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): Mamba2RMSNorm()
(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 AntonV/mamba2-2.7b-hf: the native modules, standard names and every standard value with its layout.
Mamba2ForCausalLM(
(lm_head): Linear(in_features=2560, out_features=50288, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(50288, 2560)
(layers): ModuleList(
(0-63): 64 x Mamba2Block(
(norm): Mamba2RMSNorm()
(linear_attn/mixer): Mamba2Mixer(
(act): SiLUActivation()
(conv1d): Conv1d(5376, 5376, kernel_size=(4,), stride=(1,), padding=(3,), groups=5376)
(in_proj): Linear(in_features=2560, out_features=10576, bias=False)
(norm): MambaRMSNormGated()
(out_proj): Linear(in_features=5120, out_features=2560, bias=False)
(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
(attention_output) -> Residual [batch seq hidden_size]: What the mixer adds to the residual stream
)
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid): Unavailable: a state-space block: one sublayer, the mixer, so there is no stream between sublayers and no MLP
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): Mamba2RMSNorm()
(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 mistralai/Mamba-Codestral-7B-v0.1: the native modules, standard names and every standard value with its layout.
Mamba2ForCausalLM(
(lm_head): Linear(in_features=4096, out_features=32768, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(32768, 4096)
(layers): ModuleList(
(0-63): 64 x Mamba2Block(
(norm): Mamba2RMSNorm()
(linear_attn/mixer): Mamba2Mixer(
(act): SiLUActivation()
(conv1d): Conv1d(10240, 10240, kernel_size=(4,), stride=(1,), padding=(3,), groups=10240)
(in_proj): Linear(in_features=4096, out_features=18560, bias=False)
(norm): MambaRMSNormGated()
(out_proj): Linear(in_features=8192, out_features=4096, bias=False)
(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
(attention_output) -> Residual [batch seq hidden_size]: What the mixer adds to the residual stream
)
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid): Unavailable: a state-space block: one sublayer, the mixer, so there is no stream between sublayers and no MLP
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): Mamba2RMSNorm()
(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
)attention_head_outputsout = h + mixer(norm(h))
mixer: y = ssd(x, dt, A, B, C) + D * x # x: attention_values; y: attention_head_outputs
return out_proj(norm(y * silu(z))) # one norm over the mixer's whole width
The mixer gates y with silu(z) and then normalizes it over all heads together, whatever
n_groups is. A head's term in attention_output depends on every other head, so zeroing one head
of attention_head_outputs rescales the rest.
C and B are shared by the heads of a groupattention_queries (C) and attention_keys (B) have one row per group of heads, and the 130m to
2.7b checkpoints have one group, so an edit to either reaches every head. Mamba-Codestral has eight
groups.
There is no attention_probabilities. Per head the scan is a causal linear map over tokens, and the
served values give its weights exactly:
y_t = sum_s alpha[t, s] * x_s + D * x_t
alpha[t, s] = (C_t . B_s) * exp(decays_{s+1} + ... + decays_t) * betas_s
Repeat C and B from groups to heads first.
Mamba-2 (Mamba2ForCausalLM).
A pure state-space model: no attention and no MLP. The tree::
backbone.embeddings
backbone.layers[i] Mamba2Block
.norm RMSNorm, the block's only norm
.mixer Mamba2Mixer, an SSD mixer
backbone.norm_f
lm_head
Each block is hidden + mixer(norm(hidden)) (the residual in float32 when
residual_in_fp32), so the block's one contribution is the mixer's output
and layer.input + linear_attn.attention_output == layer_output. The mixer
is nnterp.StateSpace under the standard name linear_attn (the recurrent
mixer's name on every hybrid). The block's
norm keeps its name: a "norm" key would also match the mixer's own
gated norm, and its output is linear_attn.input. There is no
self_attn and no mlp, so support lists neither.
The sizes are the mixer's: num_heads and head_dim are the SSD heads
(config.num_heads, config.head_dim), and intermediate_size is the
mixer's inner width, expand * hidden_size, what in_proj expands to and
out_proj reads from (the model has no MLP). With residual_in_fp32 the
residual stream is float32 whatever the weights are, and the model casts it
to lm_head's dtype and its logits to float32, so project_on_vocab is the
family's own.