Skip to main content

Module author

Module author 

Source
Expand description

A model’s computation written as a LOGOS program, from its ModelSpec.

Every program here is ordinary LOGOS tensor sugar — the claim “the model is authored in LOGOS” rests on it — and nothing in it is written for one model: a layer’s statements follow from its mixer, its feed-forward block and its norms. The forms are the ones a deployment runs: the single-token forward, a decode step over KV caches and recurrent state, a prefill chunk, a batch of decode steps; each also cut into its embedding, its layers and its head, so a backend can lower a layer at a time. Weights are declared as tensors the host fills, and recorded with the file each is loaded from: <var>.f (f32) or <var>.q/<var>.s (Q8_0 quants and block scales).

A stacked form (prefill, batch) carries its tensors with a b prefix (bxn0); per-sequence state carries a _s{b} suffix (Kc3_s1).

Structs§

NotYet
Why a spec cannot be written as a program yet.

Enums§

AttnForm
How an attention layer reads its keys and values.
RowState
Whose carried state the rows of a stacked step update.

Functions§

check
Can every layer of spec be written in the language as it stands? The sugar’s rotation is NEOX-paired (an interleaved checkpoint is bound through a per-head permutation of its Q and K rows, a fused projection through each part’s rows); an attention reads values of any width at the scale it gives, its scores and the logits soft-capped where the model caps them, and a latent attention its latent at the scale it gives.
check_tp
Can spec be split over tp chips? At any width of at least one chip (share), when every attention is unbiased and sinkless and every FFN is dense (its columns split; an expert mixture would split by experts).
decode_batch
B DECODE STEPS AT ONCE: sequence b brings token tok_b at position pos_b (1-based) and its own carried state, and every sequence emits its own next token. The hidden states are stacked into a B × d matrix and everything that reads a weight runs on the stack; what depends on one sequence’s position or state runs per sequence, on that sequence’s row, exactly as the single step writes it.
decode_batch_embed
A batched decode step’s embedding lookups alone: the stacked X out.
decode_batch_head
A batched decode step’s head alone: the last layer’s stacked output in, every sequence’s next token out.
decode_embed
A decode step’s embedding lookup alone: token tok in, the first hidden state x out.
decode_head
A decode step’s head alone: the final norm, the LM head and the arg-max.
decode_layer
Layer l of a decode step alone, its attention reading a KV cache of ctx positions up to pos.
decode_step
ONE DECODE STEP: token tok at position pos (1-based) in, the next token out. Every attention layer appends this token’s key and value to its KV cache (ctx positions, the step’s carried state alongside any recurrent memories and conv rings) and attends over the first pos rows; the step ends with the arg-max of the logits.
forward
The single-token forward with no history: the token’s hidden state x in, the logits out.
head
The final norm and LM head alone, reading the last layer’s output.
layer
Layer l alone, as the forward writes it: its incoming hidden state declared as an input, the RoPE tables when it is an attention layer, then the layer.
layer_input
The hidden-state tensor layer l reads: x for the first layer, the previous layer’s output after.
prefill
A PREFILL CHUNK: the tokens toks of ONE sequence at positions pos0, pos0 + 1, … (1-based) as one step, the next token after the last of them out. The hidden states are stacked into a T × d matrix, so every projection, norm, FFN and residual reads its weights once for the chunk; the chunk’s keys and values append to the cache as one block from pos0, and the rows attend as one causal block. The state is the decode step’s own, so a decode step continues where the chunk stops; the LM head reads the last row only.
prefill_head
A prefill chunk’s head alone: the last layer’s stacked output in, the next token after the chunk’s last out.
stacked_layer
Layer l of a stacked step alone, its rows’ state held as rows says: the positions the rows read, the stacked input, the RoPE tables when it is an attention layer, then the layer.
stacked_layer_input
The stacked hidden states layer l of a stacked step reads: X for the first layer, the previous bxo after.
tp_decode_batch
A BATCHED decode step over tp chips — the serving shape: the stacked sequences with every layer split, the embedding and the head on the replicated spine.
tp_decode_layer
Layer l of a tensor-parallel decode step alone: its input and position declared, the rotary tables for an attention layer, then the split layer.
tp_decode_step
A whole decode step over tp chips: the embedding lookup and the head replicated, every layer split.
tp_stacked_layer
Layer l of a batched tensor-parallel decode step alone.

Type Aliases§

Authored
A program and its weight manifest: (source, f32 weights → (file, count), q8 weights → file stem).
TpAuthored
A tensor-parallel program, its weight manifest, and its placement.