AI Grimoire

Working out

Notes

The entries state what a thing is. These state how I got there — the derivation taken slowly, the wrong turning that made the right one make sense, the question I could not answer and left standing.

17 notes, 1 of them still open — marked at the top rather than quietly left.

Attention from scratch

6 parts

building the operation up from the problem it was invented to solve, one step at a time

01
Why attention exists
The fixed-size bottleneck that broke sequence-to-sequence models, and the obvious fix nobody could take.
7 min
02
Building the attention weights
From "which positions matter" to softmax over scaled dot products, by elimination.
9 min
03
Reading an attention matrix
What the n×n matrix contains, what the pretty heatmaps show, and how much of it is an artefact.
8 min
04
The quadratic problem
Where the n² really comes from, and why the escape routes divide into exactly three kinds.
9 min
05
Many heads at once
Why one attention operation is not enough, and what the heads actually turn out to be doing.
9 min
06
What attention cannot do
Four limits that are structural rather than incidental, and the behaviours each one explains.
10 min

Alignment from scratch

5 parts

from "a base model completes text" to a policy trained against a learned reward, one honest step at a time

01
What alignment is asking for
A base model is not disobedient, it is doing something else entirely — and naming that is the first step.
7 min
02
Where demonstrations run out
Fine-tuning on good answers works, and then stops working for a reason worth understanding.
8 min
03
Turning comparisons into a number
Bradley–Terry, a scalar head, and the moment the proxy starts lying to you.
9 min
04
The leash
The KL term is not a stabiliser. It is what keeps the reward meaningful, and PPO is what it costs.
10 min
05
Removing the reward model
DPO inverts the closed form from part 4, and what it gives up is not obvious until you look for it.
10 min

Making it fit

4 parts

the memory arithmetic of training something larger than the machine you have

01
Counting the bytes
Where training memory actually goes, and why the answer is rarely the weights.
8 min
02
Throwing work away
Recomputation is a trade with a bad exchange rate applied uniformly, and a good one applied selectively.
8 min
03
Splitting the work
Data parallelism is one collective, and the reason it scales when nothing else does.
9 min
04
When it all runs at once
Four parallelisms, one cluster, and the silent misconfiguration that halves it.
9 min

Loose notes

How I read a paper in this fieldopen
A working procedure, and the four questions that decide whether the result transfers.
2d ago
Things I had backwards
Eight beliefs I held confidently and had to revise, and what each one cost.
2d ago