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. The slider picks a block; this family's blocks differ by layer_types.
identity h = (layers[i].input + a.residual_bias) * a.residual_scale + self_attn.attention_output; (h + m.residual_bias) * m.residual_scale + 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 Zyphra/ZAYA1-8B: the native modules, standard names and every standard value with its layout.
ZayaForCausalLM(
(lm_head): Linear(in_features=2048, out_features=262272, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(262272, 2048, padding_idx=0)
(layers): ModuleList(
(0-39): 40 x ZayaDecoderLayer(
(self_attn): ZayaAttention(
(o_proj): Linear(in_features=1024, out_features=2048, bias=False)
(qkv_proj): ZayaCCAProjection(
(q_proj): Linear(in_features=2048, out_features=1024, bias=False)
(k_proj): Linear(in_features=2048, out_features=256, bias=False)
(v_proj_current): Linear(in_features=2048, out_features=128, bias=False)
(v_proj_delayed): Linear(in_features=2048, out_features=128, bias=False)
(conv_qk_depthwise): Conv1d(1280, 1280, kernel_size=(2,), stride=(1,), groups=1280)
(conv_qk_grouped): Conv1d(1280, 1280, kernel_size=(2,), stride=(1,), groups=10)
)
(qk_norm): ZayaQKNorm()
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output plus the merge's hidden_states_bias, times its hidden_states_scale
(attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
(attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
(interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
)
(mlp): ZayaSparseMoeBlock(
(router/gate): ZayaRouter(
(down_proj): Linear(in_features=2048, out_features=256, bias=True)
(router_mlp): ZayaRouterMLP(
(norm): ZayaRMSNorm((256,), eps=1e-05)
(fc1): Linear(in_features=256, out_features=256, bias=True)
(fc2): Linear(in_features=256, out_features=256, bias=True)
(out_proj): Linear(in_features=256, out_features=17, bias=False)
(act_fn): GELU(approximate='none')
)
)
(experts): ZayaExperts(
(act_fn): SiLUActivation()
)
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output plus the merge's hidden_states_bias, times its hidden_states_scale
(router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert and a last one for skip, before the scoring
(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
(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
)
(input_layernorm): ZayaRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): ZayaRMSNorm((2048,), eps=1e-05)
(post_attention_residual_scale): ZayaResidualScaling()
(post_mlp_residual_scale): ZayaResidualScaling()
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention's merge
(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
(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): ZayaRMSNorm((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 Zyphra/ZAYA1-8B-FP8-Experts: the native modules, standard names and every standard value with its layout.
ZayaForCausalLM(
(lm_head): Linear(in_features=2048, out_features=262272, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(262272, 2048, padding_idx=0)
(layers): ModuleList(
(0-39): 40 x ZayaDecoderLayer(
(self_attn): ZayaAttention(
(o_proj): Linear(in_features=1024, out_features=2048, bias=False)
(qkv_proj): ZayaCCAProjection(
(q_proj): Linear(in_features=2048, out_features=1024, bias=False)
(k_proj): Linear(in_features=2048, out_features=256, bias=False)
(v_proj_current): Linear(in_features=2048, out_features=128, bias=False)
(v_proj_delayed): Linear(in_features=2048, out_features=128, bias=False)
(conv_qk_depthwise): Conv1d(1280, 1280, kernel_size=(2,), stride=(1,), groups=1280)
(conv_qk_grouped): Conv1d(1280, 1280, kernel_size=(2,), stride=(1,), groups=10)
)
(qk_norm): ZayaQKNorm()
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output plus the merge's hidden_states_bias, times its hidden_states_scale
(attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
(attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
(interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
)
(mlp): ZayaSparseMoeBlock(
(router/gate): ZayaRouter(
(down_proj): Linear(in_features=2048, out_features=256, bias=True)
(router_mlp): ZayaRouterMLP(
(norm): ZayaRMSNorm((256,), eps=1e-05)
(fc1): Linear(in_features=256, out_features=256, bias=True)
(fc2): Linear(in_features=256, out_features=256, bias=True)
(out_proj): Linear(in_features=256, out_features=17, bias=False)
(act_fn): GELU(approximate='none')
)
)
(experts): ZayaExperts(
(act_fn): SiLUActivation()
)
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output plus the merge's hidden_states_bias, times its hidden_states_scale
(router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert and a last one for skip, before the scoring
(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
(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
)
(input_layernorm): ZayaRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): ZayaRMSNorm((2048,), eps=1e-05)
(post_attention_residual_scale): ZayaResidualScaling()
(post_mlp_residual_scale): ZayaResidualScaling()
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention's merge
(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
(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): ZayaRMSNorm((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 Zyphra/ZAYA1-8B-MXFP4-Experts: the native modules, standard names and every standard value with its layout.
ZayaForCausalLM(
(lm_head): Linear(in_features=2048, out_features=262272, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(262272, 2048, padding_idx=0)
(layers): ModuleList(
(0-39): 40 x ZayaDecoderLayer(
(self_attn): ZayaAttention(
(o_proj): Linear(in_features=1024, out_features=2048, bias=False)
(qkv_proj): ZayaCCAProjection(
(q_proj): Linear(in_features=2048, out_features=1024, bias=False)
(k_proj): Linear(in_features=2048, out_features=256, bias=False)
(v_proj_current): Linear(in_features=2048, out_features=128, bias=False)
(v_proj_delayed): Linear(in_features=2048, out_features=128, bias=False)
(conv_qk_depthwise): Conv1d(1280, 1280, kernel_size=(2,), stride=(1,), groups=1280)
(conv_qk_grouped): Conv1d(1280, 1280, kernel_size=(2,), stride=(1,), groups=10)
)
(qk_norm): ZayaQKNorm()
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output plus the merge's hidden_states_bias, times its hidden_states_scale
(attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
(attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
(interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
)
(mlp): ZayaSparseMoeBlock(
(router/gate): ZayaRouter(
(down_proj): Linear(in_features=2048, out_features=256, bias=True)
(router_mlp): ZayaRouterMLP(
(norm): ZayaRMSNorm((256,), eps=1e-05)
(fc1): Linear(in_features=256, out_features=256, bias=True)
(fc2): Linear(in_features=256, out_features=256, bias=True)
(out_proj): Linear(in_features=256, out_features=17, bias=False)
(act_fn): GELU(approximate='none')
)
)
(experts): ZayaExperts(
(act_fn): SiLUActivation()
)
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output plus the merge's hidden_states_bias, times its hidden_states_scale
(router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert and a last one for skip, before the scoring
(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
(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
)
(input_layernorm): ZayaRMSNorm((2048,), eps=1e-05)
(post_attention_layernorm): ZayaRMSNorm((2048,), eps=1e-05)
(post_attention_residual_scale): ZayaResidualScaling()
(post_mlp_residual_scale): ZayaResidualScaling()
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention's merge
(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
(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): ZayaRMSNorm((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 Zyphra/ZAYA1-74B-preview: the native modules, standard names and every standard value with its layout.
ZayaForCausalLM(
(lm_head): Linear(in_features=4096, out_features=262272, bias=False)
(generator): Generator(
(streamer): Streamer()
)
(embed_tokens): Embedding(262272, 4096, padding_idx=0)
(layers): ModuleList(
(0-59): 60 x ZayaDecoderLayer(
(self_attn): ZayaAttention(
(o_proj): Linear(in_features=2048, out_features=4096, bias=False)
(qkv_proj): ZayaCCAProjection(
(q_proj): Linear(in_features=4096, out_features=2048, bias=False)
(k_proj): Linear(in_features=4096, out_features=256, bias=False)
(v_proj_current): Linear(in_features=4096, out_features=128, bias=False)
(v_proj_delayed): Linear(in_features=4096, out_features=128, bias=False)
(conv_qk_depthwise): Conv1d(2304, 2304, kernel_size=(2,), stride=(1,), groups=2304)
(conv_qk_grouped): Conv1d(2304, 2304, kernel_size=(2,), stride=(1,), groups=18)
)
(qk_norm): ZayaQKNorm()
(attention_output) -> Residual [batch seq hidden_size]: What the attention adds to the residual stream: its output plus the merge's hidden_states_bias, times its hidden_states_scale
(attention_queries_prerope) -> Queries [batch num_heads seq qk_head_dim]: The queries entering the rotary embedding
(attention_keys_prerope) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering the rotary embedding
(attention_queries) -> Queries [batch num_heads seq qk_head_dim]: The queries entering attention
(attention_keys) -> Keys [batch num_kv_heads seq qk_head_dim]: The keys entering attention
(attention_values) -> Values [batch num_kv_heads seq head_dim]: The values entering attention
(attention_scores) -> Pattern [batch num_heads query key]: The attention scores entering the softmax, masked
(attention_premix) -> HeadOutputs [batch seq num_heads head_dim]: Every head's output side by side, as the output projection takes it
(attention_probabilities) -> Pattern [batch num_heads query key]: The attention pattern the values are mixed with
(attention_head_outputs) -> HeadOutputs [batch seq num_heads head_dim]: The per-head outputs before the output projection
(interface): The attention function this call ran, as f(queries, keys, values) -> (head outputs, pattern), with the rest of the call's arguments
)
(mlp): ZayaSparseMoeBlock(
(router/gate): ZayaRouter(
(down_proj): Linear(in_features=4096, out_features=256, bias=True)
(router_mlp): ZayaRouterMLP(
(norm): ZayaRMSNorm((256,), eps=1e-05)
(fc1): Linear(in_features=256, out_features=256, bias=True)
(fc2): Linear(in_features=256, out_features=256, bias=True)
(out_proj): Linear(in_features=256, out_features=25, bias=False)
(act_fn): GELU(approximate='none')
)
)
(experts): ZayaExperts(
(act_fn): SiLUActivation()
)
(mlp_output) -> Residual [batch seq hidden_size]: What the MLP adds to the residual stream: its output plus the merge's hidden_states_bias, times its hidden_states_scale
(router_logits) -> RouterLogits [batch seq num_experts]: The router's logits, one per expert and a last one for skip, before the scoring
(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
(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
)
(input_layernorm): ZayaRMSNorm((4096,), eps=1e-05)
(post_attention_layernorm): ZayaRMSNorm((4096,), eps=1e-05)
(post_attention_residual_scale): ZayaResidualScaling()
(post_mlp_residual_scale): ZayaResidualScaling()
(layer_mid) -> Residual [batch seq hidden_size]: The residual stream after the attention's merge
(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
(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): ZayaRMSNorm((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
)<|im_end|> to every promptOn ZAYA1-8B a plain prompt's last position is <|im_end|>, so the logits there are not the prediction
after your text. Tokenize with add_special_tokens=False and prepend <bos> (id 2) yourself, or read
position -2. ZAYA1-74B-preview's tokenizer appends nothing.
merge(o, r) = (o + hidden_states_bias) * hidden_states_scale + (r + residual_bias) * residual_scale
h = post_attention_residual_scale(self_attn(input_layernorm(x)), x)
out = post_mlp_residual_scale(mlp(post_attention_layernorm(h)), h)
attention_output and mlp_output are each merge's first term, and the merge also shifts and
rescales the stream, so zeroing attention_output leaves (x + residual_bias) * residual_scale, not
x, and zeroing the chosen expert's weight leaves hidden_states_bias * hidden_states_scale. A write
to a contribution is divided back by hidden_states_scale over the whole tensor, which in bfloat16
rounds the positions it does not touch; load in float32 for small edits.
Each merge multiplies the stream by its residual_scale, channel by channel, so a contribution reaches
the last block's stream multiplied by the product of every later residual_scale. On ZAYA1-8B that
product is far below one on every channel, and a direct logit attribution has to carry it.
Each block's router adds the previous block's router state to its input, and the block returns that
state beside the stream, so layer_output is not the whole state between blocks. A patch of
layer_output alone leaves this run's router state for the later routers; for a full interchange
between two prompts of one length, patch layers[i].output, both elements.
On ZAYA1-8B and 74B-preview, with two key/value heads, attention_values head 0 is v_proj_current
of each token and head 1 is v_proj_delayed of the token before. The query heads that read key/value
head 1, the second half, move the previous token's value, so a weight on key j in their pattern
carries token j - 1's.
ZAYA (ZayaForCausalLM, Zyphra's ZAYA1).
Llama's containers over a block with residual scaling modules: after each
sublayer a ZayaResidualScaling merges the sublayer's output o into the
stream r with learned per-channel scales and biases::
merge(o, r) = (o + hidden_states_bias) * hidden_states_scale + (r + residual_bias) * residual_scale
h = post_attention_residual_scale(self_attn(input_layernorm(x)), x)
out = post_mlp_residual_scale(mlp(post_attention_layernorm(h)), h)
What each sublayer adds is its scaled term, (o + hidden_states_bias) * hidden_states_scale, so attention_output and mlp_output are that
product: a computed copy of the module's output, inverted on assignment, with a
transform carrying an in-place edit back, as on Granite. The stream itself is
also rescaled, so the contribution identity is
layer_output == (h + residual_bias) * residual_scale + mlp_output with
h == (input + residual_bias) * residual_scale + attention_output (each merge's
own parameters, layers[i].post_*_residual_scale._module, which each sublayer
reads through its parent as merge), the plain one only
at their initial values (scales one, biases zero). The model also scales and
shifts the embedding module's output before the first block.
The attention runs the shared attention interface; its queries and keys come from a
compressed convolutional projection (qkv_proj, a causal convolution over q/k
and a delayed half of the values) and qk_norm, so there are no q_proj /
k_proj on the module. The block returns (hidden_states, prev_router_hidden_states): the mixture's router carries a state from one block
to the next. The mixture (ZayaSparseMoeBlock) is on every block and returns
(hidden_states, router_state); its experts are moe_intermediate_size wide,
which the root's intermediate_size reports (the config has no dense width).
qk_norm L2-normalizes queries and keys and multiplies the keys by a learned
per-head temp; at its initial value of zero every key is zero and the pattern
uniform.
The mixture is a Moe; its router, gate (aliased router), mixes the
previous block's router state into its input and scores num_experts + 1
classes with a small MLP (router_mlp), whose output is router_logits: the
last column is skip. A slot that picks it runs no expert: its weight is 0 and
its index 0, an alias of expert 0, so usage counts mask expert_weights == 0.
The router picks on its softmax plus balancing_biases; on ZAYA1-8B and
ZAYA1-74B-preview (num_experts_per_tok 1) the skip class's bias is -1 and some
expert's is positive on every block, so skip is never chosen there; the tiny picks it.
The stream is float32 whatever the load dtype (the model keeps ZAYA's
residual_in_fp32 path), so layer_output is float32 on a bfloat16 load. The
model casts it to the final norm's dtype before the norm, and project_on_vocab
does the same.