Audit a Training Run Systematically

Diagnose data, target, mask, shape, scale, loss, gradient, optimizer, validation, and checkpoint failures in dependency order. Require controlled variables and narrow conclusions for every ablation.

Training joins many contracts. Diagnose them in dependency order so a later symptom is not mistaken for the first error.

1. Data and Targets

  • decode several input and target rows;
  • verify one-position shifting and sequence boundaries;
  • check vocabulary and context ranges;
  • confirm validation examples never enter updates;
  • record realized sequence counts.

An input copied as its own target creates an easier but wrong problem. A future token placed in the input can make loss fall while invalidating the model.

2. Architecture and Information Flow

  • assert all shapes and the 368-parameter ledger;
  • verify tied parameter identity;
  • intervene on future tokens and test earlier-logit invariance;
  • confirm training and evaluation use the intended model behavior.

Dropout is zero in this model, but calling train() and eval() remains good state discipline and matters when stochastic or stateful layers are introduced.

3. Forward Values and Loss

  • locate the first non-finite or extreme activation;
  • inspect residual, score, logit, and probability ranges;
  • ensure loss consumes raw logits along the vocabulary axis;
  • compare initial loss with the uniform baseline ln8\ln8;
  • compare final validation loss with the corpus floor, not zero.

4. Gradients and Updates

  • distinguish missing, zero, finite, and non-finite gradients;
  • record per-parameter and global norms before clipping;
  • verify clipping occurs before step();
  • compare update magnitude with parameter magnitude;
  • confirm the learning rate is nonzero and parameters actually change.

5. Experimental State

  • hold seeds and data fixed during ablations;
  • restore optimizer and RNG state for continuation;
  • record configuration and software environment;
  • rerun the one-sequence overfit test after structural changes.

Compact Failure Matrix

ObservationFirst discriminating test
initial loss near zerodecode targets and run future-token intervention
loss exactly constantcompare parameters before and after one step
loss oscillates or becomes non-finitereduce rate and inspect first extreme value
one-sequence test failstrace gradients and update order before adding data
training falls, validation does notverify split, counts, and distribution
loss below the claimed population floorrecompute data frequencies and check leakage
reload logits differcompare model config, vocabulary, weights, and mode
resumed next step differscompare optimizer, scheduler, batch, and RNG state

Ablations Need Controls

For each change, state:

  1. the hypothesis;
  2. the one variable changed;
  3. the variables held fixed;
  4. the measurements collected;
  5. the result;
  6. the narrow conclusion;
  7. what the result does not establish.

Changing initialization, optimizer, learning rate, corpus, and seed together is not an interpretable ablation.

Q1. Choose the first audit

A run begins with loss 0.02, far below both ln8\ln8 and the corpus floor. What should you inspect before tuning the optimizer?

Choose the first audit

Select one choice, then check.

Hint
The anomaly exists before the first update.
Solution
Decode input-target alignment and test the causal mask with a future-token intervention. Optimizer tuning cannot explain an impossible initial objective.
Not attempted
Review

Not marked done.

Generation Comes after the Training Audit

A trained checkpoint is ready for Chapter 8 only after its architecture, data, loss, gradients, validation evidence, and reload behavior pass these checks.

Pause and reflect

In your own words, note what you understood, what remains unclear, or what you want to revisit. The note stays with this lesson.

0 of 1 exercises marked done

Review

Not marked done.