Build & train a neural net

Based on Andrej Karpathy’s course.

Python · ~60 min · tests verify your work

Start building

Use the template, open it in your editor, and tell your AI tutor to take it from there.

Use this template

Free · no signup to start · you keep the code

Just want to read the code first?

Clone it locally - no GitHub account needed. Your changes stay on your machine, so use the template above to keep your progress.

git clone https://github.com/ash25082003/onlearn-zero-to-hero-neural-net-training
Prefer to read first? Train a neural net from scratch

What you’ll build

On top of your autograd engine, build Neuron, Layer, and MLP, then write the gradient-descent loop that trains them. Watch the loss fall; that's your network learning, weight by weight.

What you’ll learn

By the end, you’ll be able to:

  • Build Neuron, Layer, and MLP classes on top of your autograd engine
  • Write a gradient-descent training loop from scratch
  • Compute a loss, backpropagate it, and nudge every weight toward a better answer
  • Train the network until the loss visibly drops
  • See exactly what a forward pass, backward pass, and weight update really are

Before you start: Do the autograd engine first. This builds directly on the Value class you wrote there.

Your AI tutor

It won't write the loop for you. It asks the question that makes the next line obvious, then runs the tests to check.