4.3.1 · D3Pretraining & Fine-Tuning LLMs

Worked examples — GPT family architecture evolution

2,936 words13 min readBack to topic

The scenario matrix

Before working examples, let us list every kind of case the GPT-architecture math can throw at us. Each row is a "cell". Every cell is covered by at least one worked example below.

# Cell (scenario class) Degenerate / limiting version Example
A Counting attention params () tiny vs GPT-3 Ex 1, Ex 2
B Counting MLP params () & full-layer total when MLP dominates Ex 2
C Causal mask correctness position 1 (sees only itself), last position (sees all) Ex 3
D Cross-entropy loss numeric perfect model (), random model () Ex 4
E The variance fix (no effect) vs large Ex 5
F Scaling-law forecast (sign of ) scale up (loss falls, ) vs scale down (loss rises, ) Ex 6, Ex 7
G Limiting behaviour of the power law () and () Ex 8
H Real-world word problem compute budget → predicted loss Ex 9
I Exam-style twist (spot the wrong claim) encoder/fine-tune myth Ex 10

The three "signs" that matter in this topic are:

  • the sign inside the mask ( = allowed to look, = forbidden),
  • the sign of when you scale (negative when you grow, positive when you shrink),
  • the sign of the exponent in the power law (loss decreases as grows, so the useful form has in the denominator).

A & B — parameter counting (small and huge)


C — the causal mask at its boundaries


D — cross-entropy loss, from perfect to random


E — the fix at two extremes


F & G — scaling-law forecasts, both signs and both limits


H — a real-world word problem


I — the exam twist: spot the false claim


Recall Quick self-test

First token in a 4-length sequence attends to how many positions? ::: Exactly 1 (only itself). Ratio of MLP params to attention params per layer? ::: 2 : 1 ( vs ). Uniform-guess loss for vocab ? ::: nats ( for ). Sign of when you make the model bigger? ::: Negative (loss falls). What does dividing by do to the score variance? ::: Rescales it back to exactly 1 for any . In the scaling law, what does mean? ::: A fitted reference parameter-count (where extrapolated loss = 1 nat); it cancels in every ratio.