Neural Networks

Neural networks are parametric function approximators built from layered compositions of weighted sums and nonlinear activation functions, trained by gradient descent on a loss function. Key result: a feedforward network with a single sufficiently large hidden layer can approximate any continuous function on a compact set to arbitrary accuracy (Universal Approximation). Applies in: machine learning, computer vision, natural language processing, function approximation, control. Who/when: McCulloch & Pitts (1943), Rosenblatt (1958), Rumelhart–Hinton–Williams backpropagation (1986), deep learning revival (2006–2012).

A neural network is a function formed by composing affine maps with elementwise nonlinearities, parameterized by a vector of weights and biases. It matters because, given enough parameters and data, such compositions can represent astonishingly rich classes of functions and are trainable by the chain rule (backpropagation) at scale. The central engineering insight is that stacking simple nonlinear units in layers turns a hard representation problem into a tractable optimization problem. A surprising fact: even though the loss landscape of a deep network is highly non-convex with exponentially many critical points, simple stochastic gradient descent reliably finds solutions that generalize — a phenomenon still not fully understood theoretically.

The Core Insight

A single neuron computes a linear decision boundary; it cannot represent nonlinearly separable patterns (e.g., XOR). But if you feed the outputs of many neurons into another layer of neurons, the composition of affine maps and nonlinearities becomes a universal building block. Depth and nonlinearity together convert a limited linear model into a representation that can bend, fold, and carve the input space arbitrarily. Crucially, the whole composite remains differentiable in its parameters, so the gradient of any scalar loss can be computed efficiently by reverse-mode differentiation.

Formal Statement

Artificial Neuron

A single neuron with input , weight vector , bias , and activation function computes:

1
⟳model the biological neuron's "weighted summation of inputs followed by a threshold firing rule"; replace the hard threshold with a smooth for differentiability.

Here is the pre-activation (or logit), and is the activation (output). The bias shifts the decision boundary away from the origin.

Feedforward Network / Multilayer Perceptron

A network of layers maps input through layers indexed . Let be the weight matrix and the bias of layer . Then:

2
⟳stack neurons of form [1] into one layer; each row of is one neuron's weight vector, and is applied elementwise.

The full network is the composition where , and .

Common Activation Functions

3
⟳sigmoid is the logistic CDF squashing ; is a rescaled sigmoid; ReLU is the simplest piecewise-linear nonlinearity, .

Loss Functions

For supervised learning with targets , common losses for a dataset of examples are mean squared error (regression) and cross-entropy (classification):

4
⟳MSE is the negative log-likelihood under a Gaussian noise model; cross-entropy is the negative log-likelihood under a categorical (softmax) model.

The softmax output converts logits into a probability vector: .

Universal Approximation (Cybenko 1989; Hornik 1991)

Let be a continuous, non-constant, bounded function (e.g. sigmoid). For any continuous function on a compact set and any , there exist , weights , biases , and coefficients such that:

5
⟳the set of single-hidden-layer functions is dense in ; Cybenko's proof uses the Hahn–Banach theorem and discriminatory property of to show no nonzero signed measure annihilates this set.

That is, a single hidden layer of unbounded width can approximate any continuous function uniformly on compacts. Width may be exponential; depth can give exponentially more efficient representations.

Why It Holds / Derivation

The defining algorithm is backpropagation — efficient computation of by the chain rule.

Backpropagation

Goal: compute and for all layers. Step 1 — Define the error signal. Let , the sensitivity of the loss to the pre-activation of neuron in layer . Collect into . Step 2 — Output layer. By the chain rule through :
6
⟳; the second factor is ; is elementwise product.
Step 3 — Recursive backward pass. Since and :
7
⟳apply the multivariable chain rule ; the first partial is .
Step 4 — Parameter gradients. Since depends on through :
8
⟳ and ; multiply by .
Step 5 — Cost. One forward pass plus one backward pass computes the entire gradient in time — the same order as evaluating the network itself.

Gradient Descent Update

Parameters are updated against the gradient with learning rate . Stochastic gradient descent (SGD) uses a minibatch :

9
⟳first-order Taylor expansion shows movement along decreases loss for small ; the minibatch estimate is an unbiased gradient estimator.

A two-hidden-layer feedforward network: forward signal flow and backward gradient flow

Feedforward Network — forward (gold) and backprop (gray) x a⁽¹⁾ a⁽²⁾ ŷ δ propagated backward: δ⁽ˡ⁾ = (Wᵀ δ⁽ˡ⁺¹⁾) ⊙ σ′(z⁽ˡ⁾) z⁽ˡ⁾ = W⁽ˡ⁾a⁽ˡ⁻¹⁾ + b⁽ˡ⁾ → a⁽ˡ⁾ = σ(z⁽ˡ⁾)

Frank Rosenblatt | 1928–1971

An American psychologist who, in 1958, built the Perceptron — both an algorithm and a physical machine (the Mark I Perceptron) with motor-driven potentiometers as adjustable weights, designed to recognize images. Rosenblatt proved the Perceptron Convergence Theorem: for linearly separable data, the simple update on misclassified points terminates in finitely many steps. His optimistic claims drew sharp criticism; Minsky and Papert's 1969 book Perceptrons showed single-layer perceptrons cannot compute XOR, contributing to the first "AI winter." Multilayer networks with backpropagation eventually vindicated the broader research program two decades later.

Building Intuition

Think of each neuron as drawing a hyperplane in input space and outputting "how far, and on which side" (softened by ). The first hidden layer carves space into linear regions; the second layer takes logical combinations of those regions (intersections via AND-like patterns, unions via OR-like patterns); deeper layers combine those into ever-more-elaborate shapes. With ReLU, the network is literally a continuous piecewise-linear function — the input space is partitioned into polytopes, and the network is affine on each. Depth multiplies the number of linear regions exponentially, which is why deep narrow networks can be vastly more expressive than shallow wide ones with the same parameter count. Training "bends" all these boundaries simultaneously by following the negative gradient downhill on the loss surface.

Worked Examples

Forward pass through one neuron

Given: input , weights , bias , activation = sigmoid. Step 1 — Pre-activation: . Step 2 — Activation: . Step 3 — Derivative (for later backprop): .

One backprop / SGD step on MSE

Given: the neuron above with output , target , MSE loss , learning rate . Step 1 — Loss gradient w.r.t. output: . Step 2 — Error signal: . Step 3 — Weight gradients: ; ; . Step 4 — Update [9]: ; ; .

Common Misconceptions

"More layers always help." Naïvely stacking layers can worsen training due to vanishing/exploding gradients: by [7], is repeatedly multiplied by and . With sigmoids (), the gradient shrinks geometrically with depth, so early layers barely learn. Remedies — ReLU activations, careful initialization (He/Xavier), batch normalization, and residual connections — were essential to make deep networks trainable. Depth without these tricks is often harder, not better. "Universal approximation means networks can learn anything from data." Theorem [5] is purely about existence of weights, not learnability. It guarantees nothing about (a) finding those weights by gradient descent, (b) how many samples are required, or (c) generalization to unseen inputs. Approximation, optimization, and generalization are three separate problems.

A single neuron cannot solve XOR

The XOR function maps , , , . A single neuron computes , whose decision boundary is a single line. No line separates from — the positive and negative classes are interleaved at opposite corners. Resolution: one hidden layer of two neurons (e.g. computing OR and NAND) followed by an AND output neuron solves XOR exactly. This concrete failure of single-layer perceptrons, highlighted by Minsky–Papert (1969), motivated multilayer networks.

Connections

Neural networks sit at the intersection of several fields. The training objective and update rule come from Gradient Descent and Convex Optimization (though the landscape is non-convex). Backpropagation is exactly reverse-mode Automatic Differentiation applied to a computational graph. The cross-entropy loss and softmax derive from Maximum Likelihood Estimation under a categorical model, linking to Probability Theory. The single-neuron model with sigmoid is precisely Logistic Regression, so a network generalizes a stack of regressions. Universal approximation rests on density arguments from Functional Analysis (Hahn–Banach, Stone–Weierstrass). The matrix operations in [2] are Linear Algebra, and convolutional variants connect to Fourier Analysis and signal processing.

Real-World Applications

  • Image classification & detection: Convolutional networks (AlexNet 2012, ResNet 2015) power face recognition, medical imaging diagnosis, and autonomous-vehicle perception.
  • Natural language processing: Transformer networks (BERT, GPT) drive machine translation, search, summarization, and conversational assistants.
  • Speech recognition: Recurrent and transformer models underlie Siri, Google Assistant, and real-time transcription.
  • Protein structure prediction: DeepMind's AlphaFold predicts 3-D protein folds from amino-acid sequences, a landmark in computational biology.
  • Game playing & control: AlphaGo / AlphaZero combine neural value/policy networks with tree search to surpass human champions at Go, chess, and shogi.
  • Recommendation systems: Netflix, YouTube, and Amazon use deep networks to rank content from user-interaction data.
  • Generative modeling: Diffusion models and GANs synthesize photorealistic images, audio, and video.

Historical Development

  • 1943 — McCulloch & Pitts publish a logical model of the neuron as a threshold unit, showing networks can compute logical functions.
  • 1949 — Donald Hebb proposes Hebbian learning ("neurons that fire together wire together").
  • 1958 — Rosenblatt introduces the Perceptron and proves its convergence theorem for linearly separable data.
  • 1969 — Minsky & Papert's Perceptrons exposes the XOR limitation; funding and interest decline (first AI winter).
  • 1974/1986 — Werbos (1974) and Rumelhart, Hinton & Williams (1986) popularize backpropagation for training multilayer networks.
  • 1989 — Cybenko proves the Universal Approximation Theorem; LeCun applies convolutional networks to handwritten digits (LeNet).
  • 1997 — Hochreiter & Schmidhuber introduce LSTM, solving long-range dependency learning in recurrent nets.
  • 2012 — Krizhevsky, Sutskever & Hinton's AlexNet wins ImageNet by a wide margin on GPUs, igniting the deep-learning era.
  • 2017 — Vaswani et al. introduce the Transformer ("Attention Is All You Need"), now the dominant architecture for language and beyond.

Subtleties & Limits

Despite practical success, deep learning's theory has large gaps. Why does SGD generalize? Overparameterized networks with more parameters than data points can fit random labels yet still generalize on real data, defying classical bias-variance intuition (the "double descent" phenomenon). Why is non-convex optimization easy? The loss surface has exponentially many saddle points and local minima, yet SGD reliably finds good solutions — partial explanations invoke the geometry of overparameterized landscapes and the "lottery ticket" hypothesis. Expressivity vs. trainability: depth gives exponential expressive power, but provably learnable function classes remain narrow. Robustness and interpretability: networks are vulnerable to imperceptible adversarial perturbations and remain largely black boxes. Sample/energy efficiency: humans learn from far fewer examples and far less energy than current models. These questions span optimization theory, statistical learning theory, and approximation theory.

See Also

Backpropagation · Automatic Differentiation · Universal Approximation Theorem · Stochastic Gradient Descent · Activation Functions · Deep Learning · Support Vector Machines

Before this

Where this leads