sammatuba

ESSAY · PROJECT 0003

Einsum is a contract between dimensions

Dataset the ARENA 3.0 curriculum (TARA vault submodule, pinned 81533b2) + the TARA Learning Plan v2 · Charts 1 · Written SEP 2026

Entry 1 of the ARENA guide. Part 0.0, prerequisites. Route position: program week 1, tagged [light], verify don't redo.

The mental model

Every tensor operation in ARENA is written with einsum, and an einsum string is not notation to parse. It is a contract you can check by eye. Take the line the whole curriculum leans on:

"batch samples features, out features -> batch samples out"

Three rules, readable from the string alone. A dimension that appears in one operand and in the output belongs to that operand only: out comes from the weights. A dimension that appears in both operands and survives into the output was never shared work at all: batch and samples just ride along. A dimension that appears in both operands and vanishes from the output is the work: features is the axis the multiplication contracts over. That is the entire operation, x @ W.T, stated as three ownership rules.

The reason this part exists is that shape errors stop being puzzles once you read them this way. "mat1 and mat2 shapes cannot be multiplied" is the contract being violated, and the einsum string tells you which clause broke. ARENA's quiz makes you earn this once: four candidate strings, one correct contraction, three that leak or lose the wrong axes.

The picture

The exercises

One exercise block, quoted from the pinned 0.0 page:

Everything else in 0.0 is a self-audit (maths you half-know, tooling you half-set-up), meant to be skimmed against your own gaps, not studied.

What it unlocks

Every later chapter writes its math in einsum. The 1.1 attention implementation, the single hardest exercise of the program's first month, is unreadable without this contract, and trivial with it. The route tags 0.0 [light] for exactly this reason: verify, don't redo. ARENA's own advice is that you should spend the saved hours on chapter 1.

Budget and receipts

ARENA's budget: ~45 minutes for the einops exercises. The route reserves a verify-only pass plus the recap exercises that week 1's session amended back in (0.0 §2).

[TODO: receipts: hours spent vs budget, last exercise reached, what broke (fill from the TARA vault when the week closes)]

NEXT You build ResNet34 by hand before anyone hands you a model · GUIDE HOME