Neural Networks Overview
Deep Neural Networks: From Fundamentals to Modern Architectures
Backpropagation and Computational Efficiency
The central insight of backpropagation is that the computational cost of training a neural network scales linearly with depth, not exponentially. This efficiency arises because each calculation performed during the backward pass can be reused multiple times. When computing the partial derivative of performance with respect to a weight in an earlier layer, the same intermediate terms appear in the derivatives for multiple downstream weights. The key slogan is: what's computed is computed and need not be recomputed.
The gradient of the loss with respect to each weight is obtained by applying the chain rule repeatedly. For a simple network, the partial derivative of performance P with respect to a weight w1 involves terms that appear in the derivative with respect to w3 as well. This redundancy means that the number of computations remains proportional to the number of weights, avoiding the exponential blowup that would occur if each path through the network were evaluated independently.
The Dot Product in Neural Computation
A single neuron computes the dot product between its input vector x and its weight vector w, followed by a nonlinear activation function:
The sum ∑iwixi is precisely the dot product w⋅x. This observation connects neural networks to a fundamental computational primitive: the dot product appears throughout cognitive science as a similarity measure. Even when inputs are binary (0 or 1), the operation remains meaningful, and in biological neurons, outputs often exhibit graded responses proportional to input intensity, supporting a real-valued dot-product interpretation.
Convolutional Neural Networks
Convolutional neural networks (CNNs) apply learnable filters (kernels) across spatial dimensions of an input image, preserving local structure while reducing parameter count.
Convolution Operation
Instead of connecting every input pixel to every neuron, a CNN uses a kernel — a small window (e.g., 10×10 pixels) that slides across the image. At each position, the kernel's weights are multiplied by the overlapping image patch, and the result is a single output value. This operation produces a feature map where each spatial location encodes the response of that kernel at that position.

Images are typically compressed to 256×256 pixels before processing. The convolution operation dramatically reduces the number of parameters compared to a fully connected layer because the same kernel weights are shared across all spatial positions.
Pooling
After convolution, pooling summarizes local neighborhoods. Max pooling selects the maximum value within each small region (e.g., 2×2 or 3×3), discarding the other values. This provides translation invariance — small shifts in the input do not change the pooled output. Pooling also reduces the spatial dimensions of the feature maps, further decreasing computational load.

Multiple Kernels and Full Architecture
A CNN typically uses many kernels (e.g., 100) in parallel, each learning to detect different features — edges, textures, shapes. The output of all kernels after convolution and pooling forms a set of feature maps. These are then flattened and fed into one or more fully connected layers that combine the features to produce class probabilities.
The Power of Scale
Modern deep networks differ from earlier small networks along several dimensions:
Parameters: From a few hundred to 60 million parameters
Classes: From 10 digits to 1,000 classes in ImageNet
Training data: From hundreds of samples per class to 1,000+ examples per class, totaling about a million images
Error rates: In 2012, top-5 error was approximately 15%; top-1 error about 37%
The net result is a function approximator that achieves performance previously thought impossible. The surprising success comes from throwing immense computation into this architecture, even though the theoretical understanding of why it works remains incomplete.
Autocoding (Autoencoders)
Autoencoders are neural networks trained to reconstruct their input through a narrower hidden layer. The architecture consists of:
Input layer (x1 through xn)
Hidden layer with fewer neurons (the bottleneck)
Output layer (z1 through zn) trained to match the desired values d1 through dn, where the desired values are set equal to the inputs
By forcing the data through a smaller hidden layer, the network must learn compact representations that capture the essential structure of the input distribution. This is unsupervised learning: no labels are used — only the input patterns themselves.
Demonstration: Animal Shadows
In a simplified example, three animals (cheetah, zebra, giraffe) are recognized by the height of their shadow. The input layer consists of 10 neurons representing shadow-height levels. The hidden layer has only 3 neurons. After training the autoencoder to reconstruct the shadow-height profile, the hidden layer neurons specialize to encode different height ranges — though the representation may be distributed and difficult to interpret directly.
Layer-by-Layer Training
Once a layer is trained as an autoencoder, its weights are frozen. The next layer can then be trained on the output of the first. This process stacks multiple levels of representation:
Train first hidden layer to reconstruct input → freeze weights
Train second hidden layer to reconstruct first layer's output → freeze weights
Continue until a final classification layer is trained on labeled data
This approach accumulates knowledge about the statistical structure of the environment before using class labels. It appears in various forms, including Boltzmann machines.
The Output Layer: Sigmoid, Probability, and Softmax
Sigmoid Function and Likelihood
The output of a single neuron with sigmoid activation is:
where w is the weight and T is the threshold (bias). Varying T shifts the sigmoid left or right; varying w changes its steepness.
Training the output layer involves maximizing the likelihood of observing the training data. For a binary classification problem, if z is interpreted as the probability of a positive example, then the probability of a negative example is 1−z. The overall probability of the data is the product over all training examples. Gradient ascent (or descent on negative log-likelihood) adjusts w and T to make the sigmoid fit the data optimally.
Softmax for Multiclass
For m classes, each output neuron produces a value fi. To obtain proper probabilities that sum to 1, the softmax function is applied:
This normalizes all outputs into a probability distribution. The softmax layer is what produces the top-5 classification results, giving a ranked list of likely categories rather than a single guess.
Combining Autocoding and Softmax
The complete pipeline:
Train lower layers as autoencoders (unsupervised)
Freeze those weights
Attach a softmax output layer
Train the output layer using labeled data (supervised, maximizing likelihood)
The demonstration showed that after training only the hidden layer as an autoencoder, the output layer still gives near-0.5 probabilities. But after training the output layer with softmax, the network quickly achieves correct classifications.
Dropout: Preventing Overfitting
Dropout randomly deactivates a fraction of neurons during each training iteration, forcing the network to learn redundant representations and acting as a regularizer.
On each training pass, a coin is flipped for every neuron. If tails, that neuron is "dropped out" — it has no influence on the output for that iteration. On the next iteration, a different random subset is dropped. This prevents neurons from co-adapting too strongly and reduces the risk of getting stuck in local maxima.
Wide Networks and Avoiding Local Maxima
Deep networks in practice are often wide — they may have 60 million parameters but rarely more than 10 layers deep. The width is crucial for training: wider networks turn problematic local maxima into saddle points, which are easier to escape.
In demonstrations, a 5-layer network trained from scratch showed an interesting behavior: initially, all outputs turned red (negative), a sensible default when uncertain. After many iterations (around 160,000), the error rate suddenly dropped dramatically — "falling off a cliff." This suggests that the network slowly discovered a path through the weight space that led to a good solution.
When neurons were sequentially killed off after training, the network could quickly retrain to a solution, even down to only 2 neurons per layer. However, if the network started with only 2 neurons per layer from the beginning, it often got stuck in a local maximum. This confirms that initial width helps the optimizer find better pathways.
Do Neural Networks "See" Like Humans?
Despite their engineering success, deep neural networks do not perceive the world the way humans do. Several experiments reveal this disparity:
Adversarial perturbations: Changing a tiny number of pixels in an image (imperceptible to humans) can cause a high-confidence school bus prediction to drop to nearly zero, or fool the network into seeing a school bus in what looks like visual noise.
Texture over structure: Networks often rely on local texture rather than global shape. An image that retains local patterns of a school bus but lacks its overall form may still be classified as a school bus.
Mutilation experiments: By selectively removing frequency bands or hiding rectangular patches, researchers found that networks could still identify objects even after substantial image degradation that would confuse humans. Examples include:
Railroad cars identified from severely altered images
Guitars that could not be mutilated much before losing classification
Barbells misidentified as lamps or toilets
Grasshoppers, wolves, rabbits, and Russian wolfhounds recognized from partial data
The fundamental limitation: neural networks learn to associate statistical patterns in data with labels. They have no understanding of what a Frisbee is, what it means to play, or what youth feels like. They are powerful function approximators, not reasoning systems.
Summary: Key Concepts
Backpropagation computes gradients efficiently by reusing previously calculated terms
Convolution uses shared-weight kernels sliding over spatial data to detect features
Max pooling provides local translation invariance and reduces dimensionality
Autoencoders learn compact representations through input reconstruction
Softmax converts output values into a probability distribution over classes
Dropout improves generalization by randomly deactivating neurons during training
Wide networks (many parameters per layer) help avoid local maxima by creating saddle points
Despite successes, networks rely on local correlations and can be easily fooled — they do not "see" like humans

Ask anything
We've read this whole study set, so questions about it get the best answers.