cognisoc / zigllm
Notes from the margins

Blog

Essays on what you learn by reading and writing the layers of a transformer in Zig. Companion reading for the project itself.

  1. §6 · Inference · 2026-04-02

    How a sampling loop becomes 'generation'

    Generation is not a single decision. It's a loop, a probability distribution, and a choice about how greedy or how wild to be. zigllm's Layer 6 makes the loop visible — and shows you why temperature, top-k, and top-p exist.

    Read essay →
  2. §1 · Foundation · 2026-03-18

    Tensors as the lingua franca

    Tensors aren't a 'data structure.' They're a language. Every layer of zigllm — from raw memory to a sampled token — speaks it, and the shape of each tensor tells you what stage of the pipeline you're in.

    Read essay →
  3. §2 · Linear algebra · 2026-03-04

    What you actually learn by writing the matmul yourself

    Matrix multiplication is the heart of a transformer. Writing it by hand in Zig — strides, SIMD, K-quantization — is where 'I know how this works' stops being a claim and starts being legible.

    Read essay →

RSS feed