How LLMs Really Work · Lesson 1 of 15 · 2 min read · 6 min video
Neural networks, visually
Neurons, weights and how a network learns from its mistakes, drawn step by step.
📄 Download slides (PDF)Every large language model is, underneath, a neural network: a big pile of simple maths units wired together. Understand one small network and the giant ones stop feeling like magic.
One neuron
A neuron takes some numbers in, and gives one number out:
- Multiply each input by a weight (how much that input matters)
- Add them up, plus a bias (a starting nudge)
- Pass the total through an activation function that bends it, for example "if it's negative, make it 0"
Say a neuron predicts "will it rain in Vizag this evening?" from humidity and cloud cover. If cloud cover gets a big weight, cloudy evenings push the output up. The weights are what the neuron knows.
Layers
Put many neurons side by side and you get a layer. Stack layers and you get a network:
- Input layer: the raw numbers (pixels, or numbers that stand for words)
- Hidden layers: each one builds more abstract features. Edges, then shapes, then "this looks like a face"
- Output layer: the answer, such as a probability for each possible next word
Without the bending activation function, stacking layers would collapse into one big straight-line formula. The bends are what let a network learn curved, complicated patterns.
How it learns
Learning means finding good weights. The loop is always the same:
- Forward pass: feed an example through and get a prediction
- Loss: measure how wrong it was with one number
- Backpropagation: work out, for every weight, which direction would reduce the loss
- Update: nudge every weight a tiny step in that direction (this is gradient descent)
- Repeat for millions of examples
Picture the loss as a hilly landscape in fog. You can't see the lowest valley, but you can feel which way is downhill under your feet, take a small step, and feel again.
# One neuron learning y = 2x with gradient descent
w, lr = 0.0, 0.1
data = [(1, 2), (2, 4), (3, 6)]
for step in range(50):
for x, y in data:
pred = w * x
grad = 2 * (pred - y) * x # slope of the squared error
w -= lr * grad / 10
print(round(w, 3)) # ≈ 2.0From tiny to huge
A modern LLM uses exactly these ideas, just at enormous scale: billions of weights, dozens of layers, trained on trillions of words. Nothing new is added at the bottom. Scale, data and a clever layer design (the transformer, coming up in this course) do the rest.
In one line
A neural network is layers of weighted sums with bends in between, and training is nudging every weight downhill on the error, millions of times.
Share with a friend