GraniteMoeHybridForCausalLM
GraniteMoeHybridForCausalLM at 40 layers and hidden size 2048. 2 published checkpoints share this shape.
Layer map
One character per layer, input on the left.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
| layer kind | count | |
|---|---|---|
| A | attention | 40 |
The pass (full forward)
The order of operations for one forward. ×N marks a position that fires once per layer.
17 steps across nested levels, recorded from one complete forward of this shape in the author's independent implementation — the structure is what that run emitted, not a reading of the configuration.
forward
├─ embed
├─ layer ×N
│ ├─ rmsnorm_attn
│ ├─ wq
│ ├─ wk
│ ├─ wv
│ ├─ rope
│ ├─ attn
│ │ ├─ scores
│ │ └─ attn_mix
│ ├─ wo
│ ├─ rmsnorm_mlp
│ ├─ w_gate
│ ├─ w_up
│ └─ w_down
└─ head
Recorded separately from the structure: layer fired 40 times. A ×N run says only that it repeated — how long a run is is not part of the structure, so two models differing only in depth have the same pass.
The same thing in canonical form:
0(1 2*N(3 4 5 6 7 8(9 10) 11 12 13 14 15) 16)
Numbers are positions in the pass, not layer indices. Two passes count as the same structure when these strings match.
Implementing it
One forward, written out, per checkpoint whose arithmetic actually differs. A shape groups checkpoints by class, depth, width and layer stack — none of which decides an activation, a rope base or a routing rule — so where the members of this shape disagree there is a block each, and each names the checkpoint it was generated from.
It is not the recorded pass above, which is captured from a real forward; it is what the published configuration says the arithmetic is. Where the configuration does not say, the line says that instead of guessing.
The names are the ones the published checkpoint uses where a name is published, and canonical otherwise. A checkpoint loader may store them differently — fusing a gate/up pair into one matrix, or splitting one published projection in two — and those are that loader's names, not the model's. Everything spelled here is what the download contains.
Generated from granite-4.0-1b, which covers all 2 checkpoints of this shape — they agree on every field below.
# This config publishes a full `mamba_*` block and uses none of it.
# d_state 256, 128 heads, 1 group(s), conv width 4,
# chunk 256 — and `layer_types` lists every layer as
# attention. The class name says hybrid; the layer table says dense,
# and the layer table is the fact. A loader that reads the keys as a
# stack builds a model this checkpoint has no weights for.
x = embed[ids] * 12 # [T, 2048] <- embedding_multiplier
for i in 0 .. 39:
h = rmsnorm(x, layers[i].input_layernorm, eps=1e-05)
q = h @ layers[i].self_attn.q_proj.T # [T, 16*128]
k = h @ layers[i].self_attn.k_proj.T # [T, 4*128]
v = h @ layers[i].self_attn.v_proj.T # [T, 4*128]
q, k = rope(q, k, theta=10000000)
k, v = repeat_kv(k, v, 4) # 16 query heads share 4 key/value heads
a = softmax(q @ k.T * 0.0078125, mask=causal) @ v # <- attention_multiplier
a = a @ layers[i].self_attn.o_proj.T
x = x + a * 0.22 # <- residual_multiplier
h = rmsnorm(x, layers[i].post_attention_layernorm)
g, u = split(h @ layers[i].shared_mlp.input_linear.T, 2) # [T, 4096] each
y = (silu(g) * u) @ layers[i].shared_mlp.output_linear.T
x = x + y * 0.22
x = rmsnorm(x, model.norm)
logits = (x @ embed.T) / 8 # tied to the input embedding; <- logits_scaling
head_dim is not published; 2048 / 16 = 128 is used.
The Granite multipliers are the part with no Llama analogue: embedding_multiplier, attention_multiplier, residual_multiplier, logits_scaling. They are ordinary floats and a port that ignores them still produces fluent text, which is what makes them worth printing where they act.
num_local_experts: 0 on a class whose tensors are named for a mixture of experts. The MLP is the shared expert alone; nothing is routed.
Geometry
| layers | 40 |
| hidden size | 2,048 |
| attention heads | 16, 4 key/value |
| feed-forward width | 4,096 |
| vocabulary | 100,352 |
| trained context | 131,072 tokens |
| largest checkpoint | 1.6B |
Weight structure
The tensors one element of the repeating stack holds, by the names the published checkpoint uses.
| repeating stack | depth | what one element holds |
|---|---|---|
model.layers.# | 40 | input_layernorm.weight, post_attention_layernorm.weight, self_attn.k_proj.weight, self_attn.o_proj.weight, self_attn.q_proj.weight, self_attn.v_proj.weight, shared_mlp.input_linear.weight, shared_mlp.output_linear.weight |
Other shapes of GraniteMoeHybridForCausalLM
Only the columns that differ are shown; a cell with several values means the checkpoints of that shape disagree.
| shape | layers | width | stack | heads | KV heads | FFN width | experts | active | vocabulary | context | checkpoints |
|---|---|---|---|---|---|---|---|---|---|---|---|
40L x 4,096 | 40 | 4,096 | 36 state space + 4 attention | 32 | 8 | 768 | 72 | 10 | 100,352 | 131,072 | 2 |
40L x 2,560 | 40 | 2,560 | attention | 40 | 8 | 8,192 | — | — | 100,352 | 131,072 | 3 |
40L x 2,048 (this sheet) | 40 | 2,048 | attention | 16 | 4 | 4,096 | — | — | 100,352 | 131,072 | 2 |
40L x 2,048 | 40 | 2,048 | 36 state space + 4 attention | 32 | 8 | 8,192 | — | — | 100,352 | 131,072 | 2 |
40L x 1,536 | 40 | 1,536 | 36 state space + 4 attention | 12 | 4 | 512 / 4,096 | — / 62 / 64 | — / 6 | 49,160 / 50,304 / 100,352 | 131,072 | 6 |
32L x 768 | 32 | 768 | 28 state space + 4 attention | 12 | 4 | 2,048 | — | — | 100,352 | 32,768 | 2 |
28L x 1,024 | 28 | 1,024 | attention | 16 | 4 | 2,048 | — | — | 100,352 | 32,768 | 2 |
How this was checked
implemented, evidence grade shape-parity, per the assessment, for each checkpoint of this shape: a converted checkpoint of this shape was compared against a reference recording; whether it holds this checkpoint's weights is not established. The implementation meant here and below is an unpublished independent inference implementation by the author.
What stands behind the block above, beyond the published configuration it is read from:
- a decoder implemented from the published configuration
- a state-space mixer implemented from the published configuration
- a checkpoint loader, which is where published tensor names are read
- an independent reference implementation of this architecture in Python, driving the published modelling code — an executable statement of what the model should compute, written against the publication rather than against any one implementation of it
Where an independent implementation and the published configuration disagree, the configuration is what this page reports and the disagreement is what it says.
Checkpoints with this architecture
| model | parameters | context |
|---|---|---|
granite-4.0-1b | 1.6B | 131,072 |
granite-4.0-1b-base | 1.6B | 131,072 |