Braj Kishore
JourneyVaultML FoundationsAI PM GuideAgenticNewsWork With MeMentorshipPulseNow
Say hi

Hiring · Building · Investing

Have a system — or a team —that needs to scale?

info@avyxon.ai

Usually replies within a day · track record here

JourneyVaultML FoundationsAI PM GuideAgenticNewsWork With MeMentorshipPulseNow
LinkedInXYouTubeSubstackInstagramThreadsFacebookDiscordGitHubTopmate
© 2026 Braj Kishore · Bengaluru, INThink Big · Start Small · Scale Fast
ML Foundations
10Track 3 · Architectures & the walls they broke

Convolutional networks (CNN)

Exploiting structure in space: kernels, stride, padding, parameter sharing and the feature hierarchy — plus what AlexNet actually proved in 2012.

55 min1 interactive7 sources

A 3×3 edge detector is nine numbers. Slide it across a million-pixel image and you've found every edge in the picture using nine parameters. A fully-connected layer would have needed millions to learn the same thing separately at every position — and would still have to relearn it if the image shifted by one pixel.

The intuition

You're looking for a face in a crowd photograph through a small cardboard window. You slide the window across the whole picture looking for the same pattern everywhere, rather than learning a separate 'is there an eye here' detector for each of the two million positions. The window is the kernel; sliding it is convolution; using the same window everywhere is parameter sharing.

Unlearn this

That CNNs are obsolete because vision transformers won. At very large data scale ViTs generally do win, because they have weaker inductive bias and can learn better priors from more data. Below that scale — which is most real projects — a CNN's built-in assumptions about locality and translation invariance mean it learns from far less data, and modern convolutional architectures remain competitive.

01The insight: bake the structure of images into the wiring

Images have two properties an MLP ignores. Locality — a pixel is far more related to its neighbours than to a pixel across the frame, so features can be computed from small patches. And translation invariance — a cat is a cat in the top-left or the bottom-right, so a detector that works in one place should work everywhere.

Convolution encodes both. Each unit sees only a small local patch (the receptive field), and the same set of weights is applied at every position (parameter sharing). Two structural assumptions, and they collapse the parameter count by orders of magnitude while making the network generalise across position for free.

This is the clearest example of the general principle: an architecture is a hypothesis about the data. Get the hypothesis right and you need far less data; get it wrong and you're fighting your own model.

02Kernel, stride, padding — and the output-size arithmetic

A kernel (filter) is a small grid of learned weights — typically 3×3, spanning all input channels. Convolution slides it over the input, computing a dot product at each position, producing a feature map that says 'how strongly does this pattern appear here'.

Stride is the step size. Stride 1 examines every position; stride 2 halves the spatial dimensions and is a common way to downsample. Padding adds a border of zeros so the kernel can centre on edge pixels — 'same' padding keeps the output the same size as the input, 'valid' padding uses none and shrinks the output.

The output size formula is a whiteboard staple; know it cold. For input n, kernel f, padding p and stride s, the output is ⌊(n + 2p − f)/s⌋ + 1. Check it: a 224 input, 3×3 kernel, padding 1, stride 1 gives (224 + 2 − 3)/1 + 1 = 224 — same size, which is why 3×3 with padding 1 is the default building block.

Parameter count for a conv layer: (kernel height × kernel width × input channels + 1) × output channels. A 3×3 kernel over 64 input channels producing 128 output channels is (3×3×64 + 1) × 128 = 73,856 parameters — independent of image size, which is the whole point.

out = ⌊(n + 2p − f)/s⌋ + 1

Output spatial size. Memorise it — it comes up at whiteboards constantly.

params = (f·f·C_in + 1)·C_out

Independent of input resolution. A dense layer's parameter count scales with image area; a conv layer's does not.

CNN ExplainerPolo Club, Georgia TechBut what is a convolution?3Blue1BrownConvolutional Neural Networks (CS231n notes)Stanford CS231n

Try it

Slide a kernel across an image

Nine weights, reused at every position. Switch between the vertical and horizontal edge detectors.

03Pooling and the feature hierarchy

Pooling downsamples a feature map — max pooling over a 2×2 window keeps the strongest response in each neighbourhood. It shrinks the spatial dimensions, widens the effective receptive field of later layers, and adds a little tolerance to small shifts. Many modern architectures use strided convolutions instead, which achieve the same downsampling with learned weights.

Stacking convolution and downsampling produces a hierarchy, and it's one of the genuinely beautiful results in the field because you can visualise it. The first layer learns oriented edges and colour blobs — essentially Gabor filters, the same things found in the mammalian visual cortex, discovered independently by gradient descent. The next layers combine edges into corners and textures. Deeper still: object parts — wheels, eyes, letters. The final layers: whole objects.

Nobody designed that hierarchy. It falls out of the architecture plus the objective, and it is the most convincing demonstration of representation learning available.

What are Convolutional Neural Networks (CNNs)?IBM TechnologyFeature VisualizationOlah, Mordvintsev & Schubert, Distill

042012: what AlexNet actually proved

AlexNet won ILSVRC 2012 with a top-5 error of about 15.3%, against roughly 26% for the runner-up using hand-engineered features. In one competition the entire computer-vision research programme changed direction.

The architecture was not the novelty. Convolutional networks dated to the 1980s, and LeCun's LeNet-5 had been reading handwritten cheques commercially since the nineties. What was new was the combination: ImageNet's 1.2 million labelled images, two consumer GPUs to make the training feasible, ReLU activations for faster convergence, dropout to control overfitting, and data augmentation.

The lesson generalised. Rich Sutton's 'bitter lesson' names it: methods that scale with computation eventually beat methods that encode human insight. Every milestone since — AlphaGo, transformers, GPT-scale models — is the same lesson at a larger compute budget.

ResNet in 2015 handled the next wall. Beyond about twenty layers, deeper networks trained worse, not from overfitting but from optimisation failure. Skip connections gave gradients an additive path around each block, and networks went to 152 layers and beyond. Residual connections are now in essentially every deep architecture, transformers included.

The Bitter LessonRich Sutton · 2019

05The walls: fixed grids, no time, and the ViT question

A CNN expects a fixed-size grid and has no representation of order or time. It can classify a frame; it cannot, on its own, understand that this frame follows that one. Video, speech and language need a different mechanism — which is where recurrence, and later attention, come in.

Its receptive field also grows slowly. Early layers see only a few pixels, and relating two distant corners of an image requires many stacked layers. Self-attention relates any two positions in one operation, which is precisely the advantage vision transformers exploit.

The current practical answer, worth giving in full because it shows judgement rather than fashion: with very large datasets or strong pretraining, ViTs generally lead. With modest data and no pretraining, CNNs usually win, because their inductive bias substitutes for data you don't have. And modern convolutional designs that borrow transformer training recipes remain competitive, so 'CNNs are dead' is a slogan rather than a finding.

An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale (ViT)Dosovitskiy et al., ICLR · 2020
The vocabulary, defined once
Kernel / filter
A small grid of learned weights slid across the input. 3×3 is the modern default.
Parameter sharing
The same kernel applied at every position. Source of both the parameter savings and translation invariance.
Stride / padding
Step size of the slide / border added so the kernel can reach the edges. Together they set the output size.
Receptive field
The region of the input a given unit can see. Grows with depth; the reason CNNs need many layers for global context.
Pooling
Downsampling a feature map (usually max over 2×2). Shrinks spatial size and adds small-shift tolerance.
Feature hierarchy
Edges → textures → parts → objects, learned rather than designed. Representation learning made visible.
Residual connection
An additive identity path around a block. Solved the degradation problem and made very deep networks trainable.

The lab

Everything above, with the dials exposed. Break it deliberately — the failure modes are where the understanding is.

Try it

Slide a kernel across an image

Nine weights, reused at every position. Switch between the vertical and horizontal edge detectors.

What they actually ask

Convolutional networks (CNN) — the interview questions

QWhy is a CNN better than an MLP for images?Answer it out loud first, then open this

Two structural assumptions that match the data. Local receptive fields, because pixels relate to their neighbours, so features come from small patches. And parameter sharing, because a cat is a cat anywhere in the frame, so the same kernel is reused at every position. Together they cut parameters by orders of magnitude and give translation invariance for free, instead of forcing the network to learn it from examples.

QWalk me through the shapes in a small CNN.Answer it out loud first, then open this

Take 224×224×3 in. Conv 3×3, 64 channels, padding 1, stride 1 → 224×224×64, with (3·3·3+1)·64 = 1,792 parameters. Max pool 2×2 → 112×112×64, no parameters. Conv 3×3, 128 channels → 112×112×128, with (3·3·64+1)·128 = 73,856 parameters. Pool again → 56×56×128. Note the parameter counts don't depend on resolution — only on kernel size and channel counts.

What they're listening for
Doing the arithmetic out loud, including the +1 for bias, is what they're checking. Vagueness here reads as never having built one.

QCNN or vision transformer?Answer it out loud first, then open this

Depends on data scale. With a large dataset or strong pretrained weights, ViTs generally win — weaker inductive bias, so they learn better priors when there's enough data, and attention relates distant regions in one step. With modest data and no pretraining, a CNN's built-in locality and translation invariance substitute for the data you don't have. In practice I'd start from pretrained weights either way and let a validation comparison decide.

Before you move on

Recall beats re-reading, every time. Answer before you flip.

Convolutional networks (CNN) · self-test1 / 3

Input 32×32, kernel 5×5, padding 0, stride 1 — output size?

Go to the primary sources

Where each claim above comes from. Open them alongside the lesson rather than after it — the papers are shorter than you think, and the figures usually carry the whole argument.

Paper
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale (ViT)(2020)Dosovitskiy et al., ICLRThe paper behind the CNN-vs-ViT question, and it's explicit about the data-scale condition under which transformers overtake CNNs.
Watch
  • But what is a convolution?3Blue1BrownThe operation itself, from sliding windows to image kernels, before any neural network is involved.
  • What are Convolutional Neural Networks (CNNs)?IBM TechnologyA short whiteboard walkthrough of the edges → parts → objects hierarchy, if you want it said out loud once more.
Read
  • Feature VisualizationOlah, Mordvintsev & Schubert, DistillWhat the layers actually learned, rendered. Scroll the layer-by-layer gallery — edges, then textures, then parts, then objects.
  • The Bitter Lesson(2019)Rich SuttonSix paragraphs arguing that general methods plus compute beat human-encoded knowledge, every time, and that we keep resisting it.
Docs
  • Convolutional Neural Networks (CS231n notes)Stanford CS231nThe definitive written treatment: output-size arithmetic, parameter sharing, pooling, and full worked layer shapes.
Play with it
  • CNN ExplainerPolo Club, Georgia TechAn interactive, live CNN in the browser: click any activation to see the exact kernel arithmetic that produced it. The best CNN teaching tool that exists.

External links open in a new tab. Every URL was reachable when this page was written; links rot, so treat the list as a map rather than a guarantee.

Got it? Tick it off — progress saves on this device.

← PreviousFeed-forward networks (ANN / MLP)Next →Recurrent networks (RNN, LSTM, GRU)
Slide a kernel across an image14×14 → 14×14
Kernel

Input · 14×14

The nine multiplies

0.06×1.000.80×0.000.95×-1.000.06×2.000.80×0.000.95×-2.000.80×1.000.95×0.000.06×-1.00Σ = -1.93one output pixel

Feature map · 14×14

Output size

⌊(14 + 2·1 − 3) / 1⌋ + 1 = 14

3×3 with padding 1 and stride 1 preserves the spatial size — which is why it's the default building block.

Parameters — the whole argument

conv (3·3·3 + 1) · 64 = 1,792

dense, on a 224×224 image = 9,633,856

5.4e+3× fewer parameters — and the convolution's count doesn't depend on image size at all.

Vertical edges. A Sobel kernel. Strongly positive where brightness falls left-to-right, negative where it rises — so vertical edges light up and flat regions go to zero. Switch between the vertical and horizontal edge detectors and watch which strokes of the digit survive: the same image, two filters, two completely different feature maps. In a real CNN nobody writes these nine numbers — gradient descent finds them, and the first layer of a trained network reliably converges on oriented edge detectors that look very like these.

Click anywhere on the feature map to move the window. The same nine weights are used at every position — that reuse is where both the parameter saving and the translation invariance come from.

Slide a kernel across an image14×14 → 14×14
Kernel

Input · 14×14

The nine multiplies

0.06×1.000.80×0.000.95×-1.000.06×2.000.80×0.000.95×-2.000.80×1.000.95×0.000.06×-1.00Σ = -1.93one output pixel

Feature map · 14×14

Output size

⌊(14 + 2·1 − 3) / 1⌋ + 1 = 14

3×3 with padding 1 and stride 1 preserves the spatial size — which is why it's the default building block.

Parameters — the whole argument

conv (3·3·3 + 1) · 64 = 1,792

dense, on a 224×224 image = 9,633,856

5.4e+3× fewer parameters — and the convolution's count doesn't depend on image size at all.

Vertical edges. A Sobel kernel. Strongly positive where brightness falls left-to-right, negative where it rises — so vertical edges light up and flat regions go to zero. Switch between the vertical and horizontal edge detectors and watch which strokes of the digit survive: the same image, two filters, two completely different feature maps. In a real CNN nobody writes these nine numbers — gradient descent finds them, and the first layer of a trained network reliably converges on oriented edge detectors that look very like these.

Click anywhere on the feature map to move the window. The same nine weights are used at every position — that reuse is where both the parameter saving and the translation invariance come from.