An opinionated introduction to deep learning

Deep learning as optimization, and then as human-in-the-loop meta-optimization

September 17, 2026

Tags: math, optimization

Note: This post is a writeup of a set of slides from May 2025. The text is essentially unchanged from the slides, just reformatted as a post; the original slides are available as a PDF.

Outline

We will begin by formalizing deep learning as an optimization problem and briefly cover:

Then we will discuss how deep learning is not quite an optimization problem, at least in the way we formulated it. How do our goals vary from the simple formulation and what can we do about it?

Note: This is “Eric’s take” rather than anything comprehensive. Everything discussed has many alternatives, variants, and generalizations — it’s a big field.

Deep learning as optimization

Deep learning terminology

A deep learning model (a network) is a parametrized function 𝑓(𝑥;𝜃), where:

Training

Training is optimizing a network 𝑓 over its parameters 𝜃𝑝 to minimize a loss function :𝑚×𝑚.

To train a network, one needs a “train set” consisting of pairs (𝑥,𝑦)𝑛×𝑚. Here, 𝑥 are the inputs to the network, and 𝑦 are the corresponding desired outputs.

Typically, training proceeds by attempting to solve the following optimization problem:

minimize𝜃𝑝(𝑥,𝑦)train set(𝑓(𝑥;𝜃),𝑦)

That is, we want to optimize over the parameters 𝜃𝑝 to minimize the loss of 𝑓 over the train set.

This approach is sometimes called “empirical risk minimization”: we seek to minimize the “risk” (loss) empirically over the data we have (the train set).

Gradient descent

Often, the optimization problem

minimize𝜃𝑝(𝑥,𝑦)train set(𝑓(𝑥;𝜃),𝑦)

is solved by variants of gradient descent. Gradient descent is a simple iterative algorithm. To minimize some function 𝐹:𝑝 over some values 𝜃𝑝, we start with some initial point 𝜃0, then iteratively compute

𝜃𝑖𝜃𝑖1𝛾𝐹(𝜃𝑖1)

where 𝛾>0 is a hyperparameterA hyperparameter is a value that is chosen before training and fixed, rather than optimized over called the learning rate (or step size). Here is the gradient of 𝐹 with respect to 𝜃, also denoted 𝜃 for clarity sometimes.

In some scenarios, this procedure can be guaranteed to converge, meaning the sequence of 𝜃𝑖 tends toward some fixed limit. This is neither necessary nor sufficient for it to be useful.

Applying gradient descent to deep learning models

Recall that the optimization problem we want to solve is:

minimize𝜃𝑝(𝑥,𝑦)train set(𝑓(𝑥;𝜃),𝑦)

To solve this with gradient descent (directly/naively), our function 𝐹 must be

𝐹(𝜃)=(𝑥,𝑦)train set(𝑓(𝑥;𝜃),𝑦)

That is, to perform one update of gradient descent we pass through the entire train set. In practice, we often perform stochastic gradient descent instead:

  1. Initialize with some point𝜃0
  2. At step 𝑖, draw a random pair (𝑥𝑖,𝑦𝑖) from the train set at random
  3. Update the parameters as𝜃𝑖𝜃𝑖1𝛾𝜃(𝑓(𝑥𝑖;𝜃𝑖1),𝑦𝑖)

Advantages of stochastic gradient descent (SGD)

Stochastic gradient descent has several important advantages over ordinary gradient descent:

  1. if the train set is very large (or infinite, in the case of randomly generated data), we might never finish completing a single update. Instead, with SGD, a single update can be finished relatively quickly.
  2. the random noise incurred by performing individual random updates can actually be helpful. The model “jumps around” more in parameter space over the course of training, which can help escape local minimaThis is a thing people say, and it makes sense, but I haven’t read any papers about it nor ever tried full-dataset gradient descent..

SGD variants

In practice, there are often many more adjustments made to SGD. For example:

Review: Jacobians

Let 𝑓:𝑛𝑚 be a vector-valued function. Then we can write it as 𝑚 scalar-valued functions 𝑓1,,𝑓𝑚 as:

𝑓(𝜃)=(𝑓1(𝜃)𝑓2(𝜃)𝑓𝑚(𝜃))

Then the Jacobian matrix of 𝑓 at 𝜃 is defined as:

𝐽𝑓(𝜃)=(𝜕𝑓1𝜕𝜃1𝜕𝑓1𝜕𝜃2𝜕𝑓1𝜕𝜃𝑛𝜕𝑓𝑚𝜕𝜃1𝜕𝑓𝑚𝜕𝜃2𝜕𝑓𝑚𝜕𝜃𝑛)

which is the 𝑚×𝑛 matrix of partial derivatives.

Computing the gradient

Recall that 𝑓 is frequently composed of simpler functions called layers. The gradient of 𝑓 can thus be computed via the chain rule from the gradient of each individual layer.

The chain rule says if 𝑓=𝑔, then we can take the derivative with respect to 𝜃 as

𝐽𝑓(𝜃)=𝐽(𝑔(𝜃))𝐽𝑔(𝜃)

This is a matrix-multiplication between 𝐽(𝑔(𝜃)) and 𝐽𝑔(𝜃). If we had 𝑓=12𝑘 for some value 𝑘, then

𝐽𝑓(𝜃)=𝐽1(2(𝑘(𝜃)))𝐽2(3(𝑘(𝜃)))𝐽𝑘(𝜃)

we have 𝑘 matrix multiplications. The computational complexity of this operation depends on the sizes of all the individual matrices, and the order in which the product is conducted. Since matrix multiplication is associative, 𝐴𝐵𝐶=𝐴(𝐵𝐶)=(𝐴𝐵)𝐶, we can choose the order to minimize the computation time.

Backpropagation as optimized matrix multiplication associativity

Wikipedia gives the concrete case that if A is a 10 × 30 matrix, B is a 30 × 5 matrix, and C is a 5 × 60 matrix, then

using that the straightforward multiplication of a matrix that is 𝑋×𝑌 by a matrix that is 𝑌×𝑍 requires 𝑋𝑌𝑍 ordinary multiplications and 𝑋(𝑌1)𝑍 ordinary additions.

Backpropagation is the insight that when 𝑚𝑛, that is, there are many fewer outputs than inputs, the best order in which to conduct this large matrix product is often from the output layer back toward the input.

Deep learning as human-in-the-loop meta-optimization

Deep learning is not a tractable mechanical optimization problem

The goals of deep learning frequently differ from solving the optimization problem

minimize𝜃𝑝(𝑥,𝑦)train set(𝑓(𝑥;𝜃),𝑦)

as follows:

Typically, what we want to solve is more like:

minimize𝜃𝑝𝑥real worldweight(𝑥)evaluate(𝑓(𝑥;𝜃))

where:

and typically each of those items is infeasible to obtain or compute in general, and we have little hope that we can run some mechanical code (e.g. gradient descent) to solve this.

Deep learning as meta-optimization

So, how do we tackle deep learning problems? We manually approximate each quantity in the previous intractable problem and iterate, iterate, iterate (“grad-student descent”).

Typically, this involves:

One test dataset is not enough

The process of developing a network sometimes “burns” the test dataset: while the network wasn’t trained on it, the optimization of generating the network has encoded dataset-specific properties into the network, such that it won’t perform quite as well on truly unseen data. Alternatively, the test dataset may not be truly representative of real-world data.

So, a truly held-out test dataset must be collected and evaluated. If performance is not up-to-snuff, or the network shows performance issues down the line, the whole process is repeated.

Alternative philosophy: bootstrapping proxies

Another complementary way to see deep learning is as an opportunistic exploitation of proxies to the true problem we want to solve:

Instead of solving intractable problems, find a sequence of similar-but-tractable oneswith “tractable” being more important than “similar”.

Why do all that?

Machine learning approaches (deep learning + classical ML) can take some problems that have been at < 50% solved for decades to 80% solved in days/weeks/months and to 95%+ solved in months/years, and frequently the best performance comes from deep learning models. This approach fundamentally improves the capabilities of computers.

That is not to say we can’t do better than deep learning, nor that deep learning techniques can tackle every problem. We almost certainly can and will do better in time. But deep learning is likely an important step in the journey.

XKCD 1425, Tasks: checking whether a photo is in a national park is easy, checking whether it is of a bird needs a research team and five years
XKCD#1425 (September 2014)