AI Foundations for Developers COURSE·LESSON 13 OF 410 completed

Representations and Learning Curves

Models learn useful intermediate descriptions

A representation is a way to encode an input for later computation. One-hot encoding represents a category with a single 1 among zeros. It treats categories as distinct without imposing an arbitrary numeric order. Learned embeddings use dense vectors, allowing the training objective to organize relationships among inputs.

For support tickets, an early layer might capture useful word combinations while later layers encode task-relevant interactions. This is a conceptual description, not a guarantee that a particular neuron means “refund.” Distributed representations can encode overlapping information across many dimensions.

Transfer learning reuses representations learned on one task or dataset. You might freeze a text encoder and train a small classifier on its embeddings. That needs less training than updating every parameter but may not adapt sufficiently to specialized vocabulary.

Read training and validation together

Imagine these losses over five epochs:

text
epoch       1     2     3     4     5
training   .90   .60   .40   .25   .15
validation .95   .65   .50   .58   .72

The best validation loss is at epoch 3. Choosing epoch 5 because its training loss is smallest would reward fitting the training data beyond the point that improves validation. Save checkpoints and define the selection rule before looking at the final test set.

If training and validation errors are both high, investigate inadequate features, optimization failure, label noise, insufficient capacity, and task mismatch. If only validation error is high, investigate overfitting and distribution differences. Learning curves diagnose possibilities; they do not uniquely identify a cause.

Experiments need reproducibility

Record the dataset version, preprocessing, random seed, model checkpoint, hyperparameters, and evaluation code. A seed can improve repeatability but does not guarantee bit-for-bit results across hardware and numerical implementations. Repeat meaningful experiments when variance could change the decision.

Avoid changing labels, prompts, data, and metrics simultaneously. You will struggle to know which change helped. Keep a compact experiment log: hypothesis, single change, validation result, failure slices, and decision.

Checkpoint with answers

Is a frozen encoder always enough? No. Its representations might omit distinctions required by the new task.

Which checkpoint should the example select? Epoch 3 under the stated validation-loss rule.

Exercise: A validation improvement is smaller than normal run-to-run variation. What next? Answer: repeat controlled runs, inspect uncertainty and practical impact, and avoid claiming a reliable improvement from one favorable result.

Learn at your own pace0 / 41 lessons complete