family gpt_oss
One block of the stack. Hover any part for its nnterp name; click to pin the card. The slider picks a block; this family's blocks differ by layer_types.
One block of the stack. Hover any part for its nnterp name; click to pin the card. The slider picks a block; this family's blocks differ by layer_types.
identity layers[i].input + self_attn.attention_output + mlp.mlp_output == layer_output
What print(model) shows on openai/gpt-oss-20b: the native modules, standard names and every standard value with its layout.
GptOssForCausalLM(
(lm_head): Linear(in_features=2880, out_features=201088, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(201088, 2880, padding_idx=199999)
(layers): ModuleList(
(0-23): 24 x GptOssDecoderLayer(
(self_attn): GptOssAttention(
(q_proj): Linear(in_features=2880, out_features=4096, bias=True)
(k_proj): Linear(in_features=2880, out_features=512, bias=True)
(v_proj): Linear(in_features=2880, out_features=512, bias=True)
(o_proj): Linear(in_features=4096, out_features=2880, bias=True)
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(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_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
(interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
)
(mlp): GptOssMLP(
(router): GptOssTopKRouter()
(experts): GptOssExperts()
(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
(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): GptOssRMSNorm((2880,), eps=1e-05)
(post_attention_layernorm): GptOssRMSNorm((2880,), 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): GptOssRMSNorm((2880,), 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 openai/gpt-oss-120b: the native modules, standard names and every standard value with its layout.
GptOssForCausalLM(
(lm_head): Linear(in_features=2880, out_features=201088, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(201088, 2880, padding_idx=199999)
(layers): ModuleList(
(0-35): 36 x GptOssDecoderLayer(
(self_attn): GptOssAttention(
(q_proj): Linear(in_features=2880, out_features=4096, bias=True)
(k_proj): Linear(in_features=2880, out_features=512, bias=True)
(v_proj): Linear(in_features=2880, out_features=512, bias=True)
(o_proj): Linear(in_features=4096, out_features=2880, bias=True)
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(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_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
(interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
)
(mlp): GptOssMLP(
(router): GptOssTopKRouter()
(experts): GptOssExperts()
(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
(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): GptOssRMSNorm((2880,), eps=1e-05)
(post_attention_layernorm): GptOssRMSNorm((2880,), 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): GptOssRMSNorm((2880,), 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
)softmax(attention_scores) is not the patternattention_scores is read before each head's learned sink joins the softmax, so its softmax
overstates every key, and 1 - attention_probabilities.sum(-1) is the sink's share of each row. An
edit to attention_scores is renormalized against the sink; an edit to attention_probabilities is
not.
expert_outputs are weighted and sum to mlp_outputThe router softmaxes its top four logits alone, so a token's expert_weights sum to one. Each
expert_outputs slot is an expert's output, its down_proj bias included, times its weight, and
with no shared expert the slots sum to mlp_output.
GPT-OSS (GptOssForCausalLM).
Llama's tree with a mixture-of-experts MLP that returns (hidden_states, router_scores), sliding-window layers, and an attention sink: each head
carries a learned logit that joins the softmax as one extra key column and is
dropped afterwards. So the pattern's rows sum to less than one, and the
softmax's input is one key wider than the pattern and shifted by its row max;
the standard attention_scores is therefore read one step earlier, at the
masked scores just before the sink joins them (a binding that exists only
when an attention mask is passed, as it is on every prompt).