WeightCode / weights /instances /n8826c49e /model_spec.json
Boom5426's picture
WeightCode records and weights (redacted 2026-11-10, see REDACTIONS.json)
4c27541
Raw History Blame Contribute Delete
15.8 kB
{
"schema": "wrsi.model_spec.v0",
"model_id": "m896cb576",
"input": {
"kind": "token_ids",
"shape": [
59
],
"dtype": "int64",
"vocab_size": 17,
"pad_id": 0,
"layout": "[BOS, command words, SEP, OUT x 48], right-padded with PAD to seq_len; a command has 1 to 9 words of the grammar below; the answer at the k-th OUT slot is the k-th action of the command's meaning, END at every slot after the last action. Grammar: commands: C -> S | S and S | S after S; S -> V | V twice | V thrice; V -> D opposite left | D opposite right | D around left | D around right | D left | D right | U; D -> U | turn; U -> walk | look | run | jump (turn appears only with a direction). [[.]] is a command's meaning, a sequence of actions; meanings concatenate",
"tokens": [
{
"id": 0,
"name": "PAD",
"meaning": "padding after the last OUT slot; attention ignores it as a key"
},
{
"id": 1,
"name": "BOS",
"meaning": "first token of every row"
},
{
"id": 2,
"name": "SEP",
"meaning": "ends the command"
},
{
"id": 3,
"name": "OUT",
"meaning": "one of the 48 output slots after SEP; the prediction at the k-th OUT slot is the k-th action of the command's meaning, or END after the last action"
},
{
"id": 4,
"name": "walk",
"meaning": "primitive: [[walk]] = I_WALK"
},
{
"id": 5,
"name": "look",
"meaning": "primitive: [[look]] = I_LOOK"
},
{
"id": 6,
"name": "run",
"meaning": "primitive: [[run]] = I_RUN"
},
{
"id": 7,
"name": "jump",
"meaning": "primitive: [[jump]] = I_JUMP"
},
{
"id": 8,
"name": "turn",
"meaning": "turn with a direction and no other action: [[turn left]] = I_TURN_LEFT, [[turn right]] = I_TURN_RIGHT; [[turn opposite left]] = I_TURN_LEFT I_TURN_LEFT; [[turn around left]] = I_TURN_LEFT I_TURN_LEFT I_TURN_LEFT I_TURN_LEFT; the same with right"
},
{
"id": 9,
"name": "left",
"meaning": "direction: [[u left]] = I_TURN_LEFT [[u]] for a primitive u"
},
{
"id": 10,
"name": "right",
"meaning": "direction: [[u right]] = I_TURN_RIGHT [[u]] for a primitive u"
},
{
"id": 11,
"name": "opposite",
"meaning": "[[u opposite left]] = I_TURN_LEFT I_TURN_LEFT [[u]]; [[u opposite right]] = I_TURN_RIGHT I_TURN_RIGHT [[u]]"
},
{
"id": 12,
"name": "around",
"meaning": "[[u around left]] = I_TURN_LEFT [[u]] I_TURN_LEFT [[u]] I_TURN_LEFT [[u]] I_TURN_LEFT [[u]]; [[u around right]] = I_TURN_RIGHT [[u]] I_TURN_RIGHT [[u]] I_TURN_RIGHT [[u]] I_TURN_RIGHT [[u]]"
},
{
"id": 13,
"name": "twice",
"meaning": "[[x twice]] = [[x]] [[x]]"
},
{
"id": 14,
"name": "thrice",
"meaning": "[[x thrice]] = [[x]] [[x]] [[x]]"
},
{
"id": 15,
"name": "and",
"meaning": "[[x1 and x2]] = [[x1]] [[x2]]"
},
{
"id": 16,
"name": "after",
"meaning": "[[x1 after x2]] = [[x2]] [[x1]]"
}
]
},
"classes": [
"I_WALK",
"I_LOOK",
"I_RUN",
"I_JUMP",
"I_TURN_LEFT",
"I_TURN_RIGHT",
"END"
],
"parameter_layout": "PyTorch: linear weight [out, in]; embedding weight [rows, d]; all float32",
"n_parameters": 803975,
"layers": [
{
"name": "tok_emb",
"op": "embedding",
"weight": "tok_emb.weight",
"shape_w": [
17,
128
],
"computes": "h[n, t] = weight[x[n, t]] (row = token id)"
},
{
"name": "pos_emb",
"op": "position_embedding",
"weight": "pos_emb.weight",
"shape_w": [
59,
128
],
"computes": "h[n, t] = h[n, t] + weight[t] (row = position 0 .. seq_len - 1)"
},
{
"name": "b1.ln1",
"op": "layernorm",
"input": "h",
"weight": "b1.ln1.weight",
"bias": "b1.ln1.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "b1.attn",
"op": "attention",
"input": "b1.ln1",
"residual": true,
"n_heads": 4,
"head_dim": 32,
"tensors": {
"q.weight": "b1.attn.q.weight",
"q.bias": "b1.attn.q.bias",
"k.weight": "b1.attn.k.weight",
"k.bias": "b1.attn.k.bias",
"v.weight": "b1.attn.v.weight",
"v.bias": "b1.attn.v.bias",
"o.weight": "b1.attn.o.weight",
"o.bias": "b1.attn.o.bias"
},
"shapes": {
"q.weight": [
128,
128
],
"q.bias": [
128
],
"k.weight": [
128,
128
],
"k.bias": [
128
],
"v.weight": [
128,
128
],
"v.bias": [
128
],
"o.weight": [
128,
128
],
"o.bias": [
128
]
},
"mask": "bidirectional: every position attends to every position whose token is not PAD",
"computes": "q = a @ q.weight.T + q.bias, k and v the same; split the last axis into n_heads heads of head_dim (head j holds columns j * head_dim .. (j + 1) * head_dim - 1); per head softmax(q @ k.T / sqrt(head_dim) + mask) @ v; heads concatenated in order; out = concat @ o.weight.T + o.bias; h = h + out"
},
{
"name": "b1.ln2",
"op": "layernorm",
"input": "h",
"weight": "b1.ln2.weight",
"bias": "b1.ln2.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "b1.mlp",
"op": "mlp",
"input": "b1.ln2",
"residual": true,
"activation": "relu",
"tensors": {
"fc1.weight": "b1.mlp.fc1.weight",
"fc1.bias": "b1.mlp.fc1.bias",
"fc2.weight": "b1.mlp.fc2.weight",
"fc2.bias": "b1.mlp.fc2.bias"
},
"shapes": {
"fc1.weight": [
512,
128
],
"fc1.bias": [
512
],
"fc2.weight": [
128,
512
],
"fc2.bias": [
128
]
},
"computes": "h = h + relu(a @ fc1.weight.T + fc1.bias) @ fc2.weight.T + fc2.bias"
},
{
"name": "b2.ln1",
"op": "layernorm",
"input": "h",
"weight": "b2.ln1.weight",
"bias": "b2.ln1.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "b2.attn",
"op": "attention",
"input": "b2.ln1",
"residual": true,
"n_heads": 4,
"head_dim": 32,
"tensors": {
"q.weight": "b2.attn.q.weight",
"q.bias": "b2.attn.q.bias",
"k.weight": "b2.attn.k.weight",
"k.bias": "b2.attn.k.bias",
"v.weight": "b2.attn.v.weight",
"v.bias": "b2.attn.v.bias",
"o.weight": "b2.attn.o.weight",
"o.bias": "b2.attn.o.bias"
},
"shapes": {
"q.weight": [
128,
128
],
"q.bias": [
128
],
"k.weight": [
128,
128
],
"k.bias": [
128
],
"v.weight": [
128,
128
],
"v.bias": [
128
],
"o.weight": [
128,
128
],
"o.bias": [
128
]
},
"mask": "bidirectional: every position attends to every position whose token is not PAD",
"computes": "q = a @ q.weight.T + q.bias, k and v the same; split the last axis into n_heads heads of head_dim (head j holds columns j * head_dim .. (j + 1) * head_dim - 1); per head softmax(q @ k.T / sqrt(head_dim) + mask) @ v; heads concatenated in order; out = concat @ o.weight.T + o.bias; h = h + out"
},
{
"name": "b2.ln2",
"op": "layernorm",
"input": "h",
"weight": "b2.ln2.weight",
"bias": "b2.ln2.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "b2.mlp",
"op": "mlp",
"input": "b2.ln2",
"residual": true,
"activation": "relu",
"tensors": {
"fc1.weight": "b2.mlp.fc1.weight",
"fc1.bias": "b2.mlp.fc1.bias",
"fc2.weight": "b2.mlp.fc2.weight",
"fc2.bias": "b2.mlp.fc2.bias"
},
"shapes": {
"fc1.weight": [
512,
128
],
"fc1.bias": [
512
],
"fc2.weight": [
128,
512
],
"fc2.bias": [
128
]
},
"computes": "h = h + relu(a @ fc1.weight.T + fc1.bias) @ fc2.weight.T + fc2.bias"
},
{
"name": "b3.ln1",
"op": "layernorm",
"input": "h",
"weight": "b3.ln1.weight",
"bias": "b3.ln1.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "b3.attn",
"op": "attention",
"input": "b3.ln1",
"residual": true,
"n_heads": 4,
"head_dim": 32,
"tensors": {
"q.weight": "b3.attn.q.weight",
"q.bias": "b3.attn.q.bias",
"k.weight": "b3.attn.k.weight",
"k.bias": "b3.attn.k.bias",
"v.weight": "b3.attn.v.weight",
"v.bias": "b3.attn.v.bias",
"o.weight": "b3.attn.o.weight",
"o.bias": "b3.attn.o.bias"
},
"shapes": {
"q.weight": [
128,
128
],
"q.bias": [
128
],
"k.weight": [
128,
128
],
"k.bias": [
128
],
"v.weight": [
128,
128
],
"v.bias": [
128
],
"o.weight": [
128,
128
],
"o.bias": [
128
]
},
"mask": "bidirectional: every position attends to every position whose token is not PAD",
"computes": "q = a @ q.weight.T + q.bias, k and v the same; split the last axis into n_heads heads of head_dim (head j holds columns j * head_dim .. (j + 1) * head_dim - 1); per head softmax(q @ k.T / sqrt(head_dim) + mask) @ v; heads concatenated in order; out = concat @ o.weight.T + o.bias; h = h + out"
},
{
"name": "b3.ln2",
"op": "layernorm",
"input": "h",
"weight": "b3.ln2.weight",
"bias": "b3.ln2.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "b3.mlp",
"op": "mlp",
"input": "b3.ln2",
"residual": true,
"activation": "relu",
"tensors": {
"fc1.weight": "b3.mlp.fc1.weight",
"fc1.bias": "b3.mlp.fc1.bias",
"fc2.weight": "b3.mlp.fc2.weight",
"fc2.bias": "b3.mlp.fc2.bias"
},
"shapes": {
"fc1.weight": [
512,
128
],
"fc1.bias": [
512
],
"fc2.weight": [
128,
512
],
"fc2.bias": [
128
]
},
"computes": "h = h + relu(a @ fc1.weight.T + fc1.bias) @ fc2.weight.T + fc2.bias"
},
{
"name": "b4.ln1",
"op": "layernorm",
"input": "h",
"weight": "b4.ln1.weight",
"bias": "b4.ln1.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "b4.attn",
"op": "attention",
"input": "b4.ln1",
"residual": true,
"n_heads": 4,
"head_dim": 32,
"tensors": {
"q.weight": "b4.attn.q.weight",
"q.bias": "b4.attn.q.bias",
"k.weight": "b4.attn.k.weight",
"k.bias": "b4.attn.k.bias",
"v.weight": "b4.attn.v.weight",
"v.bias": "b4.attn.v.bias",
"o.weight": "b4.attn.o.weight",
"o.bias": "b4.attn.o.bias"
},
"shapes": {
"q.weight": [
128,
128
],
"q.bias": [
128
],
"k.weight": [
128,
128
],
"k.bias": [
128
],
"v.weight": [
128,
128
],
"v.bias": [
128
],
"o.weight": [
128,
128
],
"o.bias": [
128
]
},
"mask": "bidirectional: every position attends to every position whose token is not PAD",
"computes": "q = a @ q.weight.T + q.bias, k and v the same; split the last axis into n_heads heads of head_dim (head j holds columns j * head_dim .. (j + 1) * head_dim - 1); per head softmax(q @ k.T / sqrt(head_dim) + mask) @ v; heads concatenated in order; out = concat @ o.weight.T + o.bias; h = h + out"
},
{
"name": "b4.ln2",
"op": "layernorm",
"input": "h",
"weight": "b4.ln2.weight",
"bias": "b4.ln2.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "b4.mlp",
"op": "mlp",
"input": "b4.ln2",
"residual": true,
"activation": "relu",
"tensors": {
"fc1.weight": "b4.mlp.fc1.weight",
"fc1.bias": "b4.mlp.fc1.bias",
"fc2.weight": "b4.mlp.fc2.weight",
"fc2.bias": "b4.mlp.fc2.bias"
},
"shapes": {
"fc1.weight": [
512,
128
],
"fc1.bias": [
512
],
"fc2.weight": [
128,
512
],
"fc2.bias": [
128
]
},
"computes": "h = h + relu(a @ fc1.weight.T + fc1.bias) @ fc2.weight.T + fc2.bias"
},
{
"name": "ln_f",
"op": "layernorm",
"input": "h",
"weight": "ln_f.weight",
"bias": "ln_f.bias",
"shape_w": [
128
],
"shape_b": [
128
],
"eps": 1e-05,
"computes": "y = (a - mean) / sqrt(var + eps) * weight + bias over the last axis (biased variance)"
},
{
"name": "head",
"op": "linear",
"input": "ln_f",
"weight": "head.weight",
"bias": "head.bias",
"shape_w": [
7,
128
],
"shape_b": [
7
],
"computes": "logits[n, t] = a[n, t] @ weight.T + bias, at every position t"
}
],
"output": "logits [N, seq_len, n_classes] at every position; the prediction at a position is the argmax over classes; only OUT positions carry an answer",
"reference_forward": "forward.py: forward(params, x_int64 [N, seq_len]) -> float32 logits [N, seq_len, n_classes]"
}