Starting question
What is learned inside a small causal transformer, and which architectural decisions make learning easier or harder? A useful answer should go beyond a diagram: it should identify specific operations, testable expectations, and measurable differences across controlled changes.
What we plan to build
A small causal transformer, from scratch, on top of adjoint , the lab’s in-house CPU autograd engine. Owning both the model and the engine keeps the stack small enough to read end to end, so every operation in the forward and backward pass is one we can inspect.
- Token and position embeddings, and a stack of transformer blocks with masked scaled dot-product attention, residual connections, and layer normalization.
- An autoregressive training loop with cross-entropy loss, written against adjoint’s autograd.
- Deterministic tests of the causal mask, tensor shapes, forward pass, and gradients.
The matrix M masks future positions for causal attention. The softmax converts the available attention scores into weights, and their weighted combination of the value vectors produces the output.
First planned experiment
One ablation: remove layer normalization while keeping everything else fixed. Train on a small, controlled synthetic task, across multiple seeds, with one fixed evaluation set and matched compute budgets for both conditions. Record final loss and accuracy per seed, plus a few selected internal activations.
The goal is not a benchmark number. It is to see whether a specific architectural piece changes the training trajectory in a way that reproduces across seeds, under matched conditions, on an evaluation set chosen before the runs.
Results
Not started
When runs exist, this section will hold loss curves across seeds with and without layer norm, final evaluation accuracy per seed, and the exact training script and config. Until then, this page describes an intention, not a result.
Related work
- Karpathy, nanoGPT .
- Elhage et al. 2021, “A Mathematical Framework for Transformer Circuits” (Transformer Circuits Thread).
- Olsson et al. 2022, “In-context Learning and Induction Heads,” arXiv:2209.11895 .
- Power et al. 2022, “Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets,” arXiv:2201.02177 .
- Nanda, Chan, Lieberum, Smith, and Steinhardt 2023, “Progress measures for grokking via mechanistic interpretability” (ICLR 2023), arXiv:2301.05217 .
Our approach follows this line of work: reimplement at small scale, then change one component at a time and measure what moves.
Next note: adjoint vs PyTorch