learn-deep-learning-with-phoebe / Session 4 of 6
Learn Deep Learning with Phoebe · Session 4 of 6

Seeing and embedding

Session 3 gave you the loop, and the loop will train whatever you wire in front of it. Tonight is about the wiring. An architecture, it turns out, is not a bag of tricks - it is a promise about the data, and the history of deep learning is the history of promises that paid off: convolution's bet that nearby pixels relate, AlexNet's bet on GPUs and scale, ResNet's bet that depth needed a highway, and the quiet industrial win of the hidden layer itself - the embedding, the part of the network businesses actually sell.

🟠 Hands-on Builders - you own the loop from session 3 45 min
0-3 · Welcome 3-22 · Architectures as promises 22-40 · Build-along: count what convolution saves 40-45 · Q&A
Part 0

From loops to architectures

You now own the five moves: forward, loss, backward, step, zero the gradients. The loop does not care what network you hand it - it trained the spiral net and it would train a thousand-layer monster with equal obedience. So the question moves up a level: what should you wire, and why does the shape of the wiring matter more than almost any knob you tuned last week? Tonight covers the three architectures that answered that question for vision, and the one output everyone quietly ships to production: the embedding.

🎫 Clear all three quiz questions to stamp your passport Live = presented in the 45 minutes Self-study = the full depth, after class

★ What you walk out with tonight. A one-line definition of inductive bias you can defend in a review. The two most misquoted numbers in deep learning history (AlexNet's 15.3 and ResNet's 3.57), quoted correctly. And a by-hand parameter count that shows convolution saving roughly 545x - and what that saving costs.

LiveAn architecture is a promise about the data4 min▶

Every architecture bakes in an assumption before a single gradient flows. Convolution promises that nearby pixels relate - that a pattern worth detecting in one corner is worth detecting in every corner. Sequence models promise that order matters - that yesterday constrains today. A plain MLP promises nothing at all - every input may relate to every other, equally, in any direction.

Open-mindedness sounds like a virtue, but the MLP pays for it in parameters and data: with no assumption to lean on, every relationship must be learned from scratch, and the data must fund every one of those weights. When the promise matches the data, the architecture learns more from less. When it does not - and session 6's tabular showdown is exactly that mismatch - the promise is dead weight.

Real world

You already run on promises. The tree course's booster promises that axis-aligned splits on individual features capture the signal - a promise tabular data usually keeps. Tonight's question, every time you meet a new dataset: what structure does this data actually have, and which architecture has already promised to exploit it?

Self-studyTonight's vocabulary3 min▶
  • Inductive bias - the assumptions an architecture makes before seeing data. The stronger and truer the bias, the less data pays.
  • Kernel / filter - a small grid of weights (3x3 tonight) slid across the image, computing the same detection everywhere.
  • Receptive field - the patch of input a given unit can actually see. Grows as layers stack.
  • Residual connection - a skip that adds a layer's input to its output: out = x + F(x). Session 4's second act.
  • Embedding - the activation vector of a late hidden layer, used as learned coordinates. Session 4's third act, and the one you can ship.
Part 1 · covers convolution as inductive bias

LeNet's three moves

7 min live

LeCun et al.'s 1998 LeNet-5 paper is the clearest statement of the promise ever written down. Three moves, each one a bet on how images work: local receptive fields (a unit looks at a neighborhood, not the whole image), shared weights (the same detector runs at every position), and spatial subsampling (nearby detections get pooled, buying tolerance to small shifts). Together: shift invariance, and a massive cut in parameters - all still trained end-to-end with the same gradient descent you ran last session.

One kernel, every position the same 9 weights slide to every position 28x28 image (drawn 8x8 here) Fully connected layer, 100 units 784 pixels x 100 = 78,400 weights + 100 biases 16 conv kernels of 3x3 16 x 9 = 144 weights + 16 biases ~545x fewer weights because the kernel promises: patterns repeat in space A vertical-edge detector useful at (3, 4) is useful at (20, 9) too - so LeNet learns it once and reuses it. The saving is a promise about images, not a discount on all data. Break the promise and you paid for nothing.
🔍 Click to zoom - the same nine weights everywhere, and what that buys
LiveThe numbers, said correctly4 min▶

LeNet-5 reached 0.95 percent test error on MNIST digits, and 0.8 percent when the training set was augmented with distorted copies. Trained end-to-end with gradient descent - the promise did not need a special optimizer, just the loop you already run.

  • Precision trap: the 0.7 percent sometimes quoted from that paper belongs to boosted LeNet-4 - an ensemble, not LeNet-5. Same lesson as every headline number tonight: check whether it is one model or a committee.
  • Lineage trap: convolution did not appear in 1998. LeCun's zip-code nets used it in 1989, and the architectural idea traces to Fukushima's Neocognitron in 1980. 1998 is when the recipe was written down cleanly, not when it was invented.

What the 3x3 kernel cannot do: see anything wider than 3 pixels. One conv layer is nearsighted by design. The fix is stacking - each layer's units look at 3x3 patches of the layer below, so the effective receptive field grows with depth. Depth is how convolution keeps its local promise and still ends up seeing the whole image.

Self-studyThe three moves, one table3 min▶
MoveThe promise it encodesWhat it buys
Local receptive fieldsMeaning is local: edges, corners, strokes live in small neighborhoodsEach unit needs 9 weights, not 784
Shared weightsA pattern worth detecting here is worth detecting everywhereOne detector serves all positions - the ~545x cut
Spatial subsamplingThe exact pixel position of a detection matters less than its rough locationTolerance to small shifts and distortions

All three are restrictions - the network is less free than an MLP. That is the point. Inductive bias is the art of forbidding the network from learning things that cannot be true of the data.

Part 2 · covers scale and depth

AlexNet and ResNet: the two numbers everyone misquotes

8 min live

Two papers turned convolution's promise into the modern field: AlexNet proved the promise scales, ResNet proved depth could be made trainable. Both come with a famous number, and both numbers are routinely quoted wrong. Tonight you learn the numbers with their fine print, because precision here is a professional tell.

LiveAlexNet 2012: the GPU moment, quoted exactly4 min▶

Krizhevsky, Sutskever and Hinton entered the ILSVRC-2012 image recognition challenge with a 60-million-parameter convolutional network and, in the paper's own words:

The paper's words"...winning top-5 test error rate of 15.3%, compared to 26.2% achieved by the second-best entry." The network took "between five and six days to train on two GTX 580 3GB GPUs".

Now the fine print, which is course content, not a footnote:

  • 15.3 was their ENTRY - a 7-CNN ensemble. The single network scored 18.2 percent on validation. Say "their entry scored 15.3", never "the network scored 15.3".
  • The runner-up at 26.2 was classical computer vision - hand-engineered features, the best the old paradigm had. That is what makes the gap historic: it was a paradigm gap, not a tuning gap.
  • The accurate shorthand: AlexNet's entry cut top-5 error by over 10 points, roughly 40 percent relative. Never say "halved" - it overshoots.
Real world

Five to six days on two consumer gaming GPUs. The bitter economics lesson of 2012 was not the architecture - LeNet had the promise 14 years earlier - it was that compute plus data had finally caught up to the promise. When you evaluate a deep learning pitch, ask the AlexNet question: does this team have the data and compute to fund the architecture they chose?

LiveResNet 2015: the degradation problem4 min▶

By 2015 the field had a strange embarrassment. He et al. open their paper with it:

The paper's words"Deeper neural networks are more difficult to train." Their fix: "explicitly reformulate the layers as learning residual functions with reference to the layer inputs."

The embarrassment, precisely: stack more plain layers and training error got worse. Not test error - training error. A 56-layer plain net fit the training data worse than a 20-layer one. That rules out overfitting entirely (an overfitter aces training and flunks test). This is the degradation problem: an optimization failure, a network that mathematically contains the shallower solution but that gradient descent cannot steer to it.

The residual fix is one addition: out = x + F(x). Each block now learns the difference from identity, and doing nothing (F = 0) is trivially learnable. Result: 152 layers, "8x deeper than VGG", and first place at ILSVRC 2015 with a top-5 error of 3.57 percent.

  • Precision trap: 3.57 is - again - an ensemble number. The committee habit runs right through this history.
  • Mechanism trap: "ResNet fixed vanishing gradients" is wrong. Batch normalization had largely handled vanishing gradients already; the paper's claim is optimization tractability - identity shortcuts make the deeper solution easy to find.
  • Scope trap: the celebrated 1000+ layer experiments are on CIFAR, not ImageNet.
The degradation problem (TRAIN error) training error training iterations plain 56-layer: WORSE plain 20-layer Worse on the data it trains on - so this is an optimization failure, not overfitting. The residual fix input x weight layers learn F(x) + skip: identity, gradient highway out = x + F(x) Learning "do nothing" now means F(x) = 0 - trivial. The deeper net can always match the shallower one, then improve.
🔍 Click to zoom - deeper got worse on TRAIN error, and the one addition that fixed it
Self-studyThis is session 3's spiral lesson, in architecture form3 min▶

Remember the spiral: the 1x8 net sat at 55 percent looking like a capacity problem, then the same net hit 100 with a hotter rate and more epochs. The capacity was there; the optimizer had not arrived. The degradation problem is the same story at scale: the 56-layer plain net contained the 20-layer solution (set 36 layers to identity), but gradient descent could not find it.

Residual connections are the architectural version of that lesson: instead of asking the optimizer to work harder, reshape the problem so the good solutions are easy to reach. Capacity is not just what a network can express - it is what the optimizer can find. ResNet moved "find" closer to "can".

Part 3 · covers representations as the product

Embeddings: the layer you actually ship

4 min live

Back in session 2 you met the 1986 backprop paper's real pitch - not the algorithm, the payoff: hidden units "come to represent important features of the task domain". Four decades later that sentence is an industry. The layers before the output are a learned coordinate system where similar things sit near each other - and word embeddings, product embeddings, and customer embeddings are exactly that: hidden-layer activations, extracted and sold as a feature.

The embedding space (2D projection) dress skirt gown jeans cargo pants joggers returns-risk customers distance = learned similarity What the dots are Each dot is a hidden-layer activation vector, projected down to 2D for viewing. Nobody placed these points. Training on the task pushed similar things together - the 1986 promise, made measurable and sellable. The output layer answers one question. The layer before it answers thousands - that is why embeddings get shipped.
🔍 Click to zoom - the hidden layer as a learned coordinate system
LiveFrom 1986's promise to a product3 min▶

Train a network on any task and the late hidden layers become a map: inputs the task treats similarly end up close together. Extract that vector and you have an embedding - a learned feature that other models, searches, and recommenders can reuse. The classifier was the training exercise; the representation is the asset.

Real world

Mango Lane could embed products from co-purchase sequences: train a net to predict what gets bought together, then harvest the hidden layer. Products bought in similar contexts land near each other - dresses near skirts - without anyone tagging categories. The recommendation course's matrix factorization is a shallow cousin of exactly this: two embedding tables and a dot product, no depth.

The honest boundary. Transformers and LLMs are this idea at industrial scale - embeddings of words and their contexts, stacked and refined. They belong to the GenAI shelf of this hub, and this course stops at the pointer. What you should carry across: when someone says "the model understands", the checkable claim underneath is "the embedding places similar things near each other".

Build-along

Count what convolution saves

★ 18 min · everyone builds

No code tonight - arithmetic and paper. The promise of Part 1 becomes a number you compute yourself, and by step 5 you will have designed your own embedding.

Price the open mind. A 28x28 grayscale image (784 pixels) into a fully-connected layer of 100 units: every unit sees every pixel, so 784 x 100 = 78,400 weights, plus 100 biases. Write it down - that is what "promises nothing" costs.

Price the promise. The same image through 16 conv kernels of 3x3: each kernel is 9 shared weights, so 16 x 9 = 144 weights, plus 16 biases. Write both numbers side by side and the ratio: 78,400 / 144 is roughly 545x fewer weights. That factor is bought entirely by the assumption that patterns repeat across the image.

Say what the kernel cannot see - one sentence. A 3x3 kernel is blind to anything wider than 3 pixels. Then say the fix: stacking layers grows the receptive field, because each layer's units see 3x3 patches of the layer below - depth is how a local promise ends up covering the whole image.

Sketch a residual block on paper. Take any two layers you like, wrap them as F, and draw the skip: out = x + F(x). Mark the skip arrow and note next to it: the gradient now has a highway - and "do nothing" costs the optimizer nothing, because F(x) = 0 recovers the input exactly.

Design your domain's embedding - one sentence. Name the entities (products? customers? support tickets?), and say what similarity should mean (bought in the same baskets? churn for the same reasons?). If you can write that sentence, you have specified an embedding; the network's job is only to make it measurable.

What to bring to session 5. Your parameter counts. Session 5 is about what a network does when you give it far more parameters than data - and its first exhibit is a net you will price the same way you priced these.

Homework

Before session 5

30 min
  1. Redo the parameter count for a 5x5 kernel (25 weights each, 16 kernels). Notice the ratio against fully-connected barely moves - the saving comes from sharing, not from the kernel being tiny.
  2. Stack receptive fields by hand: two 3x3 conv layers - how wide a patch of the original image can a second-layer unit see? (Draw it: 5x5.) Three layers? (7x7.) Write the pattern.
  3. Rehearse the two corrections aloud: "15.3 was their entry - a 7-CNN ensemble; the single net was 18.2 on validation" and "degradation is a training failure, not overfitting - deeper plain nets got worse train error". Once each, out loud. They will come up in real meetings.
  4. Find the embedding already near you: one system at work that ranks, recommends, or searches. Ask what representation it compares. If the answer is hand-built rules or raw features, you have found where a learned embedding would go.
  5. Optional: skim section 1 of the ResNet paper (arXiv:1512.03385) - just the figure showing 56-layer vs 20-layer training curves. You now know exactly what you are looking at.
Check yourself

Three questions

Clear all three and session 4 gets stamped in your passport.

1 · Your by-hand count showed 16 conv kernels using ~545x fewer weights than a fully-connected layer on the same image. Why is this a promise about images rather than a free lunch on all data?

Shared weights encode "a pattern worth detecting here is worth detecting everywhere" - true of images, where a vertical edge means the same thing at any position. On data without that structure (session 6's tabular churn table, for instance), the restriction removes capacity the data actually needed. Inductive bias is a bet: 545x cheaper when it pays, dead weight when it does not.

2 · Before ResNet, a plain 56-layer network performed worse than a plain 20-layer one. What made this the "degradation problem" rather than ordinary overfitting?

An overfitter aces training and flunks test. The 56-layer plain net got worse on the training set itself, despite mathematically containing the 20-layer solution. He et al.'s fix reformulates layers "as learning residual functions with reference to the layer inputs" - making "do nothing" trivially learnable. And note the adjacent trap: this is optimization tractability, not vanishing gradients - BatchNorm had largely handled those.

3 · A slide claims "AlexNet halved ImageNet error: 15.3% vs 26.2%". What is the precise version?

The paper reports a "winning top-5 test error rate of 15.3%, compared to 26.2% achieved by the second-best entry" - and that winning entry averaged 7 CNNs, with the single network at 18.2 percent validation. 26.2 to 15.3 is not halving; "cut top-5 by over 10 points, roughly 40 percent relative" is the honest shorthand. Say "their entry" and you will be more precise than most conference speakers.

Sources covered

What this session teaches, and where it came from

✓LeCun et al. 1998, LeNet-5Convolution as inductive bias: local fields, shared weights, subsampling; 0.95% MNIST (0.8% with distortions) - 0.7% belongs to the boosted LeNet-4 ensemble; lineage credited to LeCun 1989 and Fukushima 1980
✓Krizhevsky, Sutskever & Hinton 2012, AlexNetEntry 15.3% vs 26.2% top-5, 60M parameters, five to six days on two GTX 580s - with the ensemble caveat (single net 18.2 val) and the "over 10 points, ~40% relative" shorthand
✓He et al. 2015, ResNetThe degradation problem as a training failure; residual reformulation; 152 layers, ensemble 3.57% top-5 - not a vanishing-gradients fix, and the 1000+ layer runs are CIFAR
◐Rumelhart, Hinton & Williams 1986The representations thread only - hidden units "come to represent important features of the task domain" - carried forward from session 2 into the embedding story

Every fact on this page, and its verification tier, is recorded in the course's source map.

Session 4 cheat sheet · pin this

Architecture = promiseConvolution: nearby pixels relate. Sequences: order matters. MLP: nothing - and it pays in parameters and data.
LeNet's three movesLocal receptive fields, shared weights, spatial subsampling. Shift invariance plus a massive parameter cut.
The countFC on 28x28: 78,400 weights. 16 kernels of 3x3: 144. Roughly 545x - bought by the promise, not for free.
AlexNet, said rightTheir ENTRY (7-CNN ensemble) hit 15.3 vs 26.2. Over 10 points, ~40% relative. Never "halved".
Degradation ≠ overfittingDeeper plain nets got worse TRAIN error. Fix: out = x + F(x). Tractability, not vanishing gradients.
EmbeddingsLate hidden layers = learned coordinates where similar things sit near each other. The 1986 promise, shipped as a product.