Lesson 1 · Unit 04
Debugging models
Find the bug when nothing crashes and nothing learns
What you practise
- Shape mismatches, dtype and device errors, NaN losses, loss that won't fall (learning rate, missing
zero_grad, wrong loss input), overfitting one batch as a test
Try a question from this lesson
Pick one
A 10-class classifier trains with no errors, but the loss reads 2.30 at the first step and 2.30 at the last. What is that number telling you?
Hint
A model that knows nothing spreads its belief evenly over the classes. What does cross-entropy give then?
Correct answer
ln 10: it is still guessing evenly
Why
-ln(1/10) ≈ 2.30 is the loss of an even guess over 10 classes. Starting there is normal; staying there means nothing is being learned. Silent failures like this are the hard ones, and this lesson is a checklist for them.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
A ladder for silent bugs
When a model runs but will not learn, climb in this order. Each rung is cheap, and most bugs live on the first two.
The third rung is the big one: a correct model, loss and loop can memorise a handful of samples and drive the loss to nearly zero. If yours cannot, the pipeline is broken.
1 print the shapes of x, pred and y
2 check dtypes and devices
3 overfit one tiny batch
4 only then tune the learning rate11 more exercises in the app
- 5× multiple choice
- 1× fill the blanks
- 1× true or false
- 1× order the lines
- 1× match the pairs
- 2× type the answer
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.