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 jetmoe/jetmoe-8b: the native modules, standard names and every standard value with its layout.
JetMoeForCausalLM(
(lm_head): Linear(in_features=2048, out_features=32000, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(32000, 2048)
(layers): ModuleList(
(0-23): 24 x JetMoeDecoderLayer(
(mlp): JetMoeMoE(
(act_fn/activation): SiLUActivation()
(input_linear): JetMoeParallelExperts()
(down_proj/output_linear): JetMoeParallelExperts()
(router): JetMoeTopKGating(
(layer): Linear(in_features=2048, out_features=8, bias=False)
)
(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): Unavailable: JetMoE's mixture runs its experts over the slots sorted by expert; no tensor holds them in token order
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output, before the mixture's bias
(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
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm): JetMoeRMSNorm((2048,), eps=1e-06)
(post_attention_layernorm): JetMoeRMSNorm((2048,), eps=1e-06)
(self_attn/self_attention): JetMoeAttention(
(experts): JetMoeMoA(
(input_linear): JetMoeParallelExperts()
(down_proj/output_linear): JetMoeParallelExperts()
(router): JetMoeTopKGating(
(layer): Linear(in_features=2048, out_features=8, bias=False)
)
)
(kv_proj): Linear(in_features=2048, out_features=4096, bias=False)
(attention_premix): Unavailable: a mixture of attention heads: the output projection is per expert, inside experts
(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_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
(interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
)
(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): JetMoeRMSNorm((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 jetmoe/jetmoe-8b-sft: the native modules, standard names and every standard value with its layout.
JetMoeForCausalLM(
(lm_head): Linear(in_features=2048, out_features=32000, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(32000, 2048)
(layers): ModuleList(
(0-23): 24 x JetMoeDecoderLayer(
(mlp): JetMoeMoE(
(act_fn/activation): SiLUActivation()
(input_linear): JetMoeParallelExperts()
(down_proj/output_linear): JetMoeParallelExperts()
(router): JetMoeTopKGating(
(layer): Linear(in_features=2048, out_features=8, bias=False)
)
(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): Unavailable: JetMoE's mixture runs its experts over the slots sorted by expert; no tensor holds them in token order
(routed_output) -> Residual [batch seq hidden_size]: The routed experts' combined output, before the mixture's bias
(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
(shared_expert_output) -> Residual [batch seq hidden_size]: The shared expert's output
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream
)
(input_layernorm): JetMoeRMSNorm((2048,), eps=1e-06)
(post_attention_layernorm): JetMoeRMSNorm((2048,), eps=1e-06)
(self_attn/self_attention): JetMoeAttention(
(experts): JetMoeMoA(
(input_linear): JetMoeParallelExperts()
(down_proj/output_linear): JetMoeParallelExperts()
(router): JetMoeTopKGating(
(layer): Linear(in_features=2048, out_features=8, bias=False)
)
)
(kv_proj): Linear(in_features=2048, out_features=4096, bias=False)
(attention_premix): Unavailable: a mixture of attention heads: the output projection is per expert, inside experts
(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_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
(interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
)
(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): JetMoeRMSNorm((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
)Each chosen attention expert projects the token's queries for num_kv_heads heads, so query head
h belongs to slot h // num_kv_heads, and the expert behind it changes from token to token.
nnterp serves no routing values for the attention. Its router logits are
self_attn.experts.router.layer.output, flat over tokens, and their top top_k give each slot's
expert in order. To ablate attention expert e, zero attention_head_outputs in the slots that
chose it.
attention_keys holds one copy of the keys per slotThe shared keys and values are tiled to every query head, so attention_keys and
attention_values have num_heads heads, top_k copies of num_kv_heads. An edit to one head
reaches only its slot's queries. Edit key/value head j at every copy (j, j + num_kv_heads), or
at kv_proj.output, to reach every query that reads it.
mlp_output is routed_output plus the mixture's bias, and attention_output is the experts'
gated sum plus self_attn.experts.bias. Ablating every expert leaves the bias in the stream.
JetMoE (JetMoeForCausalLM).
Llama's tree with the attention under its own name: model.{embed_tokens, layers[i].{input_layernorm, self_attention, post_attention_layernorm, mlp}, norm}
and lm_head, the residual added in the block, which returns a bare tensor.
self_attention is aliased self_attn.
The attention is a mixture of attention heads: a router picks
num_experts_per_tok experts per token, each expert projects that token's
queries for num_key_value_heads heads (experts.map) and later projects their
outputs back (experts.reduce, in place of an o_proj). Keys and values come
from one shared kv_proj and are tiled (repeat, not interleaved) to every
query head before the shared attention interface, so the interface sees num_heads
key/value heads and interface head h is routing slot h // num_kv_heads over
kv head h % num_kv_heads: which expert's parameters a head's query came from
varies by token. The attention returns (attn_output, attn_weights, router_logits). The MLP is a mixture of experts (Moe) that returns the routed hidden
states plus a bias as one tensor.
The MLP's mixture has no experts module: its router (JetMoeTopKGating) takes a
top-k of the logits of a child nn.Linear (router.layer), softmaxes the top-k,
and sorts the slots by expert; the mixture then runs input_linear and
output_linear over the sorted slots. So expert_indices and expert_weights
are the router's top-k indices and gates, [tokens, top_k] in token order, before
the sort; routed_output is the mixture's routed sum before + bias; and the
per-slot outputs, sorted by expert, are unavailable.