Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← All weeks

Understanding Modern AI / Week 02

Neural Network Internals

Build a checked neural network and model comparison. Extend Week 1 with a small neural network, numerical gradient checks, and validation-selected settings.

Your lessons

  1. 01

    Tensors and a neural network forward pass

    60 minutes planned · 7 sections
    Start →
  2. 02

    Backpropagation and checking gradients

    60 minutes planned · 7 sections
    Start →
  3. 03

    Training and comparing neural networks

    60 minutes planned · 8 sections
    Start →

// Put it into practice

A checked neural network and model comparison

  1. Download week02.py from a lesson's practice section. Follow its setup instructions before running it.
  2. Lesson 1: Calculate a two-layer forward pass for a tiny batch, then reproduce it in PyTorch.
  3. Lesson 2: Compare hand, automatic, and centered finite-difference gradients away from activation kinks.
  4. Lesson 3: Extend the Week 1 baseline with a small neural network and compare fixed splits and training curves.
  5. Run the supplied assertions and record actual results; a simulated contract check does not certify real model quality.
Download week 2 Python lab ↓

Read the script’s setup instructions and run it on your own computer. The website does not execute code or verify your results.

// Independent work

W02-LAB

Week 2: A checked neural network and model comparison

Extend Week 1 with a small neural network, numerical gradient checks, and validation-selected settings.

Extend the guided artifact rather than start a second project. Gradient checks pass and both classifiers use the same untouched test partition; curves and errors support the comparison.

What to produce

  • A checked neural network and model comparison
  • Setup commands, data or generation procedure, versions, and recorded outputs
  • Acceptance results and a precise limitation

Check your work

  • Gradient checks pass and both classifiers use the same untouched test partition; curves and errors support the comparison.
  • Each claimed execution is supported by actual saved output.
  • Fixture results and real model results are identified separately.
  • Setup and reproduction use the taught tools without private credentials.
Self-assessment rubric
Technical correctness · 35 points
Implementation or analysis follows the relevant technical mechanism and handles the stated case.
Evaluation and evidence · 30 points
Reproducible tests, appropriate baseline, and accurate interpretation.
Engineering quality · 20 points
Clear structure, safe boundaries, and usable reproduction instructions.
Explanation and reflection · 15 points
Explains tradeoffs, limitations, and next experiment with evidence.

// Retrieve before you reread

Week 2 knowledge check

Try all 6 questions. Check your answers, review the explanations, and retry whenever you like. Answers are checked on this device.

1. A batch X is (5,4), weights are (4,3), and bias is (3,). What are output shape and parameter count?
2. What does composing three affine layers without activation functions represent?
3. For x=3,w=1,b=0,target=5 and half squared error, what is the weight derivative?
4. A prediction array (4,1) is compared with targets (4,). Which check should precede calculating paired loss?
5. Validation losses are 0.6,0.3,0.4 over epochs 1–3. Which checkpoint should early stopping preserve?
6. Which combination is appropriate for validating a dropout network?

Next: week 3 →