Neurocourse

How a neural network learns: from the perceptron to billions of weights

A neural network learns like someone shooting hoops: throw, miss, nudge your hand — billions of times over. We'll see what the 'knobs' inside actually are, why this kind of training costs millions of dollars, and why AI has no idea what happened last week.

In a hurry to get practical? Lessons 4–5 are about what's under AI's hood. You can skim them and come back later: the hands-on part starts at lesson 9. And every optional deep-dive in these two lessons sits in an "Under the hood (optional)" block right at the end — the main thread without them is short.

The idea of a "neural network" is nearly 70 years old. Rosenblatt's perceptron from lesson one embodied the same idea — learn from examples. But how to train networks with many layers came later, and the scale has grown by a factor of billions since. Let's take the idea apart.

An analogy: a beginner at the basketball hoop

Picture someone throwing a ball at a hoop for the first time. First throw — badly off. The brain notes: too hard, aim left. Second — closer. Adjust. By the thousandth throw it goes in almost every time. Nobody handed them "the formula for a perfect shot" — it came together out of feedback. A neural network learns in exactly this way.

The training loop: four steps

  1. Predict. You show the model an example (a photo, a chunk of text) and it gives an answer. Early in training it's basically random.
  2. Compare. The answer is checked against the right one. The gap is the error, and you can put a number on it.
  3. Adjust. Inside the network sit billions of numeric "knobs", called weights. A special algorithm nudges each one a tiny bit so the error shrinks. A tiny bit is the key part: sharp moves break what's already been learned.
  4. Repeat. Next example. Billions of times over.

When you hear "a 70-billion-parameter model", that's the count of those weight-knobs. Just don't mix a parameter up with a neuron: a parameter is the strength of one connection (closer to a synapse in the brain), not the "neuron" itself. For a very rough sense of scale: the human brain has ~86 billion neurons and trillions of connections between them — so even a huge model is, by connection count, incomparably simpler than a brain.

Why this costs millions

Billions of examples × billions of weights × thousands of passes = a monstrous amount of computation. Big models train for months on tens of thousands of GPUs, the bills run to tens of millions of dollars, and the data centres draw as much power as a small city. Now it's clear why the breakthrough waited for the 2010s: that much power simply didn't exist before. And why only a handful of companies build big models — while everyone uses them.

Three ways to train (you'll meet these in every AI article)

  • Supervised: examples that come with the answers ("this is a cat", "this is spam") — like our hoop analogy. Most applied models learn this way.
  • Unsupervised: the model looks for structure in the data with no hints — grouping customers by behaviour on its own, say.
  • Reinforcement: learning through a reward for the result — that's how AlphaGo, playing millions of games against itself, found moves no human knew. And it's how today's chatbots get their final polish, from human ratings of answers — which is why they're polite and follow instructions.

The spam filter, end to end (the whole loop in a minute)

Take a familiar example and run the loop: the filter is shown an email → it predicts "spam, probability 0.3" → the right answer was "spam" → the error is large → the weights tied to the words "prize" and "free" and the odd sender address get nudged up a bit → the next similar email scores 0.7. A billion emails later, the filter catches 99% of spam. Nobody wrote a rule saying "the word 'prize' is suspicious" — that rule grew out of the examples. Now you can see this process behind every AI feature.

Two consequences that explain a lot

1. A model only knows what was in the data. Training ended, knowledge froze. The date after which the model has "seen" nothing is called the knowledge cutoff. Yesterday's news, your company's private documents, today's prices — none of it exists for the model until you show it separately (by uploading a file or letting it search the web).

2. Data quality = model quality. Train on text full of errors and you get errors. If the data leaned one way, the model inherits the lean. Remember "garbage in, garbage out": it comes back in your own requests to AI (your prompts) and in working with AI bots.

Can you top up its training?

Yes — and cheaper than training from scratch: take a finished model and teach it further on your own examples (fine-tuning), or simply hand it the knowledge it needs right in your request. The second way is prompting, and you'll get good at it in this course.

Under the hood (optional): why "neural"

What follows is an optional deep-dive for the curious. It won't change how you work with AI in practice, so feel free to skip straight to the next lesson.

The name "neural network" isn't a metaphor — it's lifted straight from biology. A neuron in the brain connects to thousands of other neurons, and each connection has its own strength: one solid, another barely there. It works simply: it collects the signals from everything it's connected to, multiplies each by the strength of that connection, adds them all up — and if the sum crosses a threshold, it "fires" a signal on down the chain. (The threshold is like a switch: press it too gently and the light doesn't come on.)

An artificial neuron copies that scheme. And the strength of each connection is exactly the weight — the numeric knob from the training loop above. Training a network = tuning the strength of connections, just as your brain strengthens the connections it needs when you pick up a new skill. That's where "neural" comes from.

After that the paths diverge: a brain learns from a couple of examples and runs on 20 watts (less than the bulb in your fridge), while neural networks need millions of examples and megawatts. So "neural" is about where the inspiration came from, not an "electronic brain": we copied the brain's wiring diagram, not the way it thinks.

Practice · 3 tasks

Short questions on the lesson — with an explanation for every answer.

Skip this lesson →