family apertus
Llama's block with its norms named attention_layernorm and feedforward_layernorm, every query and key head RMS-normed before the rotary embedding, and an MLP with no gate whose activation, xIELU, has two parameters learned per block.
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.
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 + self_attn.attention_output + mlp.mlp_output == layer_output
⚠︎ marks a value this checkpoint has only under some load: hover it for the condition.
What print(model) shows on swiss-ai/Apertus-8B-2509: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=4096, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 4096, padding_idx=3)
(layers): ModuleList(
(0-31): 32 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(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)
(q_norm): ApertusRMSNorm((128,), eps=1e-05)
(k_norm): ApertusRMSNorm((128,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=4096, out_features=21504, bias=False)
(down_proj): Linear(in_features=21504, out_features=4096, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((4096,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((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 swiss-ai/Apertus-8B-Instruct-2509: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=4096, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 4096, padding_idx=3)
(layers): ModuleList(
(0-31): 32 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(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)
(q_norm): ApertusRMSNorm((128,), eps=1e-05)
(k_norm): ApertusRMSNorm((128,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=4096, out_features=21504, bias=False)
(down_proj): Linear(in_features=21504, out_features=4096, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((4096,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((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 swiss-ai/Apertus-70B-2509: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=8192, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 8192, padding_idx=3)
(layers): ModuleList(
(0-79): 80 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(q_proj): Linear(in_features=8192, out_features=8192, bias=False)
(k_proj): Linear(in_features=8192, out_features=1024, bias=False)
(v_proj): Linear(in_features=8192, out_features=1024, bias=False)
(o_proj): Linear(in_features=8192, out_features=8192, bias=False)
(q_norm): ApertusRMSNorm((128,), eps=1e-05)
(k_norm): ApertusRMSNorm((128,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=8192, out_features=43008, bias=False)
(down_proj): Linear(in_features=43008, out_features=8192, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((8192,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((8192,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((8192,), 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 swiss-ai/Apertus-70B-Instruct-2509: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=8192, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 8192, padding_idx=3)
(layers): ModuleList(
(0-79): 80 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(q_proj): Linear(in_features=8192, out_features=8192, bias=False)
(k_proj): Linear(in_features=8192, out_features=1024, bias=False)
(v_proj): Linear(in_features=8192, out_features=1024, bias=False)
(o_proj): Linear(in_features=8192, out_features=8192, bias=False)
(q_norm): ApertusRMSNorm((128,), eps=1e-05)
(k_norm): ApertusRMSNorm((128,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=8192, out_features=43008, bias=False)
(down_proj): Linear(in_features=43008, out_features=8192, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((8192,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((8192,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((8192,), 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 swiss-ai/Apertus-v1.1-0.5B: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=1024, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 1024, padding_idx=3)
(layers): ModuleList(
(0-19): 20 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(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)
(q_norm): ApertusRMSNorm((64,), eps=1e-05)
(k_norm): ApertusRMSNorm((64,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=1024, out_features=6144, bias=False)
(down_proj): Linear(in_features=6144, out_features=1024, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((1024,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((1024,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((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 swiss-ai/Apertus-v1.1-0.5B-Instruct: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=1024, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 1024, padding_idx=10)
(layers): ModuleList(
(0-19): 20 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(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)
(q_norm): ApertusRMSNorm((64,), eps=1e-05)
(k_norm): ApertusRMSNorm((64,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=1024, out_features=6144, bias=False)
(down_proj): Linear(in_features=6144, out_features=1024, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((1024,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((1024,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((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 swiss-ai/Apertus-v1.1-1.5B: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=2048, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 2048, padding_idx=3)
(layers): ModuleList(
(0-15): 16 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(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)
(q_norm): ApertusRMSNorm((64,), eps=1e-05)
(k_norm): ApertusRMSNorm((64,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=2048, out_features=12288, bias=False)
(down_proj): Linear(in_features=12288, out_features=2048, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((2048,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((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 swiss-ai/Apertus-v1.1-1.5B-Instruct: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=2048, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 2048, padding_idx=10)
(layers): ModuleList(
(0-15): 16 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(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)
(q_norm): ApertusRMSNorm((64,), eps=1e-05)
(k_norm): ApertusRMSNorm((64,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=2048, out_features=12288, bias=False)
(down_proj): Linear(in_features=12288, out_features=2048, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((2048,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((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 swiss-ai/Apertus-v1.1-4B: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=3072, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 3072, padding_idx=3)
(layers): ModuleList(
(0-23): 24 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(q_proj): Linear(in_features=3072, out_features=3072, bias=False)
(k_proj): Linear(in_features=3072, out_features=1024, bias=False)
(v_proj): Linear(in_features=3072, out_features=1024, bias=False)
(o_proj): Linear(in_features=3072, out_features=3072, bias=False)
(q_norm): ApertusRMSNorm((128,), eps=1e-05)
(k_norm): ApertusRMSNorm((128,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=3072, out_features=16384, bias=False)
(down_proj): Linear(in_features=16384, out_features=3072, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((3072,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((3072,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((3072,), 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 swiss-ai/Apertus-v1.1-4B-Instruct: the native modules, standard names and every standard value with its layout.
ApertusForCausalLM(
(lm_head): Linear(in_features=3072, out_features=131072, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(131072, 3072, padding_idx=10)
(layers): ModuleList(
(0-23): 24 x ApertusDecoderLayer(
(self_attn): ApertusAttention(
(q_proj): Linear(in_features=3072, out_features=3072, bias=False)
(k_proj): Linear(in_features=3072, out_features=1024, bias=False)
(v_proj): Linear(in_features=3072, out_features=1024, bias=False)
(o_proj): Linear(in_features=3072, out_features=3072, bias=False)
(q_norm): ApertusRMSNorm((128,), eps=1e-05)
(k_norm): ApertusRMSNorm((128,), eps=1e-05)
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
)
(mlp): ApertusMLP(
(up_proj): Linear(in_features=3072, out_features=16384, bias=False)
(down_proj): Linear(in_features=16384, out_features=3072, bias=False)
(act_fn): XIELUActivation()
(mlp_activation) -> Neurons [batch seq intermediate_size]: The activation function's output
(mlp_neurons) -> Neurons [batch seq intermediate_size]: What the down projection receives: act(gate)·up on a gated MLP, the activation itself otherwise
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm/attention_layernorm): ApertusRMSNorm((3072,), eps=1e-05)
(post_attention_layernorm/feedforward_layernorm): ApertusRMSNorm((3072,), eps=1e-05)
(layer_input) -> Residual [batch seq hidden_size]: The residual stream entering the block
(attention_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the attention
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention add
(mlp_norm_output) -> Residual [batch seq hidden_size]: The normed stream entering the MLP
(mlp_input) -> Residual [batch seq hidden_size]: What the MLP is called with
(layer_output) -> Residual [batch seq hidden_size]: The residual stream leaving the block, a tensor even when the block returns a tuple
)
)
(norm): ApertusRMSNorm((3072,), 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
)h = x + self_attn(attention_layernorm(x))
out = h + mlp(feedforward_layernorm(h))
mlp(z) = down_proj(xielu(up_proj(z)))
Llama's two pre-norms under their own names: attention_layernorm feeds the attention and
feedforward_layernorm the MLP. nnterp aliases them input_layernorm and
post_attention_layernorm, so either name reads the same module. The config carries
post_norm: false and qk_norm: true; the modeling code reads neither and builds this block on
every checkpoint.
attention_output is self_attn.output[0] and mlp_output is mlp.output, added to the stream
with nothing in between. The identity holds exactly in float32 on the pinned checkpoint:
with model.trace(prompt):
x = model.layers[1].input.save()
attn = model.layers[1].self_attn.attention_output.save()
mlp = model.layers[1].mlp.mlp_output.save()
out = model.layers[1].layer_output.save()
torch.testing.assert_close(x + attn + mlp, out)
up_proj widens the normed stream to intermediate_size (21504 on 8B), act_fn applies xIELU,
and down_proj narrows it back. xIELU is alpha_p·x² + beta·x for x > 0 and
alpha_n·(expm1(min(x, eps)) − x) + beta·x otherwise, with beta 0.5, eps −1e-6 and two scalars
learned per block. The parameters mlp.act_fn.alpha_p and mlp.act_fn.alpha_n hold them before a
transform: the effective alpha_p is softplus(alpha_p) and the effective alpha_n is
beta + softplus(alpha_n). On v1.1-0.5B the effective alpha_p is largest at block 1 (17.75) and
smallest at block 12 (0.54), and alpha_n lies between 0.85 and 6.28, so one pre-activation value
gives a different activation in each block. act_fn is a module, so
mlp.act_fn.input is the pre-activation and mlp.act_fn.output the activation:
mlp = model.layers[1].mlp
with model.trace(prompt):
pre = mlp.act_fn.input.save() # equals mlp.up_proj.output
acts = mlp.act_fn.output.save() # equals mlp.down_proj.input
The negative branch dips below zero and then grows again: as x falls, the output grows like
(alpha_n − beta)·|x|. At block 8 of v1.1-0.5B its minimum is −0.14, near x = −0.63; it gives −0.107 at −1, 1.78 at
−5 and 10.3 at −20. At that block 93% of the pre-activations are negative, and under 0.4% of the
activations lie within 1e-3 of zero. The activations are therefore not sparse: a large negative pre-activation
writes its down_proj column with a positive weight, as a large positive one does. Read
act_fn.output, not the sign of act_fn.input, to tell whether a neuron fires.
q = rope(q_norm(q_proj(x).view(..., heads, head_dim))) # one gain, every head
k = rope(k_norm(k_proj(x).view(..., kv_heads, head_dim)))
q_norm and k_norm are RMSNorms over one head's head_dim, one gain vector for every head,
applied before the rotary. attention_queries and attention_keys are read after both; at position 0,
where the rotation is the identity, they equal q_norm.output and k_norm.output. On v1.1-0.5B
the gains reach 81.5 (q_norm) and 87.0 (k_norm) at block 0. Scaling one head's slice of
q_proj.output is renormalized away. At block 8 of v1.1-0.5B, doubling head 3's slice moves the
logits by 8e-5, doubling head 3 of attention_queries moves them by 1.26, and tripling a
key/value head's slice of v_proj.output, which no norm follows, moves them by 23.8.
attn = model.layers[1].self_attn
with model.trace(prompt):
attn.attention_queries[:, 1] *= 2 # head 1's scores x2
8B has 32 query heads over 8 key/value heads, 70B 64 over 8, both 128 wide. The v1.1 sizes: 16
over 4 at 64 wide (0.5B), 32 over 8 at 64 wide (1.5B), 24 over 8 at 128 wide (4B).
attention_keys and attention_values are read before repeat_kv, [batch, kv_heads, seq,
head_dim], and an edit to key/value head j reaches query heads 4j to 4j + 3 on 8B.
The six attention interior values need attn_implementation="eager". There is no softcap, window
or sink, and on v1.1-0.5B in float32 the default sdpa load's logits differ from the eager
load's by at most 5e-5. The 2509 checkpoints use rope_type llama3 (rope_theta 12,000,000,
factor 8 over 8192 original positions, 65536 in all). The v1.1 checkpoints use the plain rotary
(rope_theta 500,000, 4096 positions).
<s>, and it is the sinkThe tokenizer prepends <s> (id 1). On v1.1-0.5B the layer_output at that position, block 8, has a norm of
19,000 against 140 to 240 at the other positions of a test prompt. A mean over positions is
dominated by it unless [:, 1:] is dropped first.
The instruct templates write <s> themselves, so a templated string traced as is starts with two;
pass add_special_tokens=False. The 2509 instruct template also writes a system turn with
Current date: set to the day it runs, so the same messages tokenize differently from one day to
the next:
text = model.tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True)
with model.trace(text, add_special_tokens=False):
probs = model.next_token_probs.save()
model.logits is model.lm_head.output: no cap and no scale, and project_on_vocab is
lm_head(norm(hidden)). lm_head and embed_tokens are one matrix on v1.1-0.5B and its Instruct, and separate on
every other checkpoint listed here. Apertus v1.5 (apertus1p5) is another architecture, a
multimodal wrapper, and is not this family.
Apertus (ApertusForCausalLM).
Llama's tree and Llama's block under other norm names: model.{embed_tokens, layers[i].{attention_layernorm, self_attn, feedforward_layernorm, mlp}, norm} and
lm_head, the residual added in the block, attention through the shared eager
forward. attention_layernorm feeds the attention and feedforward_layernorm
the MLP, so they are aliased input_layernorm and post_attention_layernorm.
The attention norms its queries and keys per head (q_norm, k_norm) before
the rotary embedding. The MLP has no gate: down_proj(xielu(up_proj(x))).