Artificial Intelligence: A Visual Learner's Series
Part 7: Deep learning
From a single artificial neuron to the architectures behind image recognition and language models.
Neurons and layers
In one line: A neural network stacks simple units that each weigh their inputs and pass on a signal; stacking layers lets it represent complex patterns.
Each circle computes a weighted sum, adds a bias, then applies an activation like ReLU:
Without the nonlinear activation, all the layers collapse into one linear model.
Watch out: "Neuron" is a metaphor; real brain cells are far more complex.
Training with backpropagation
In one line: Predict, measure the error, then trace backward to see how much each weight contributed and nudge every one to do better.
Repeat over many small batches (stochastic gradient descent); one pass through all the data is an epoch.
Residual connections, normalization and ReLU keep the error signal from fading in deep networks; dropout fights overfitting.
Watch out: Learning rate, batch size and architecture can make or break training.
Convolutional networks for images
In one line: Slide small pattern detectors across the image, building up from edges to whole objects.
pixels ─▶ edges & color blobs ─▶ textures & curves ─▶ eyes, ears ─▶ "cat"
layer 1 layer 2 layer 3+ output
The same filter is reused at every position (weight sharing), so an ear detector works anywhere in the frame.
Transfer learning: start from a network pretrained on millions of images.
Watch out: Networks latch onto shortcuts, like learning "snow in the background" means wolf.
Attention and transformers
In one line: Attention lets every word look directly at every other word and weigh which ones matter.
Change "big" to "small" and the heavy line swings to "suitcase."
Each word produces a query, key and value; relevance is how well one word's query matches another's key.
A transformer stacks layers of self-attention and processes all words in parallel, making huge-scale training practical.
Watch out: Attention cost grows with the square of the text length.
Generative models
In one line: Generative models learn what real data looks like well enough to create new examples.
| Model | Core idea |
|---|---|
| Variational autoencoder | Compress to a small code, learn to decode new samples from it |
| GAN | A generator and a fake-spotter compete and improve each other |
| Diffusion model | Learn to turn noise into an image one denoising step at a time |
| Autoregressive model | Generate one token at a time, each based on everything before (language models) |
Watch out: Fluent output isn't accurate output; generative models can fabricate confidently.
Self-test
Draw a network with 2 inputs, one hidden layer of 3 and 1 output. How many weights does it have?
Sketch the forward and backward passes and say what flows in each direction.
Write a sentence where a pronoun is ambiguous and draw the attention lines for both readings.