Chapter 2 · Representation · ≈13 min
Bending Space
Why does deep learning work at all? Because a network is a smooth deformation of space — watch it untangle spirals until a straight line can tell them apart.
In the last chapter a network bent a line into any curve you asked for. That was approximation. Classification sounds like a different job — here are two families of points, ultramarine and vermilion, tangled into each other; tell them apart — and the standard picture of it is a network drawing a boundary between the classes, the way you might draw a fence between two herds.
That picture is wrong in a quietly important way, and this chapter exists to replace it. A neural network does not draw a boundary around the data. It picks the data up — all of space, with the data embedded in it — and deforms the whole sheet until the two classes stand on opposite sides of a straight line. The boundary you see in the input is just the crease left behind.
Look at what one layer actually computes:
The affine part rotates, stretches, and shifts the plane. Then the bend warps each coordinate — the classic squashes it smoothly toward the interval , though it pays for that gentleness in training time; the plates below open with gelu, which bends nearly as smoothly and learns in a fraction of the steps. Nothing here can cut or tear: the map is continuous, so points that started close together end up close together. And when is invertible and the bend is smoothly invertible, as tanh is, the layer gives up even more than that — it becomes a homeomorphism, a deformation with a continuous inverse, the kind of move you could perform on a sheet of soft rubber without ever pressing two parts of it together.
A deep network is a chain of such moves, finished by one boring linear classifier:
So the entire intelligence of the machine lives in the deformation. The final layer can only cut once, with a straight line; the layers before it must rearrange the world until one straight cut is enough. Watch it happen.
Why it failed, and what fixed it
With two hidden units, the network's inner world is itself a plane, and you watched it try every move it has. It cannot win, and the reason is not effort.
Take the smooth case first, because it is the clean one. With and an invertible , every layer is a homeomorphism: the sheet stretches and bends as far as you like, but it is never cut and never folded back onto itself, so what was inside stays inside. The vermilion ring encircles the ultramarine disk before the deformation and encircles it after, and no straight line can have a disk on one side of it and a whole ring around that disk on the other. The network is not being slow. It is attempting something that cannot be done, and the plateaued loss curve is the honest report.
The creasing bends slip out of that argument, and still do not help. relu folds the plane — a continuous map, but not a reversible one — and a fold can perfectly well bring an inside out. What stops it here is duller than topology: two units give the layer two creases, and you cannot enclose a bounded region with two straight cuts. You need three to make a triangle. Switch the activation and watch it fail the other way.
Then you gave it one more dimension, and the impossible became easy. With three hidden units the deformation can lift — raise the inner disk out of the page like a tent pole under a napkin — and in three dimensions a flat plane slides between them cleanly. This is the picture Christopher Olah's essay is famous for1 , and it generalizes: data tangled like linked rings or knotted strings needs room — extra dimensions — to be taken apart, and a network needs enough width to provide that room.
Now the thesis of this whole book, stated in full. The network is a smooth, continuous transformation — that is all it is allowed to be, because gradient descent can only search by feel, and feel requires differentiability. The data arrived tangled by some process in the world. Learning succeeds when the network discovers a smooth map that undoes the tangle — approximately inverts it — so that in the new coordinates the classes are linearly separable. When no such smooth un-tangling exists in the space it has, the network fails, honestly and legibly, the way it just did. Width and depth are not magic: they are degrees of freedom for the deformation.
That the data arrives tangled rather than merely scattered is itself a supposition, and it has a name. The manifold hypothesis holds that data of enormous nominal size — a photograph with a million pixels — in fact lies on or near a surface of far smaller dimension, because whatever generated it had far fewer knobs than it has pixels.2 Everything in this chapter assumes it. So does most of the field.
The representation is the product
Click any point on the left and find its ghost on the right: the same datum, renamed by the network. That renaming is the product. We call the hidden layer's coordinates a representation — a coordinate system invented by training, in which the problem is trivial. The classifier at the end is almost an afterthought.3
You can measure this rather than admire it. Hang a bare linear classifier off each hidden layer of a trained network and score it: separability climbs layer by layer, and the climb is what this page has been drawing.4 Or count the holes. Take data shaped like two interlocked surfaces, push it through a trained network, and measure the topology of what comes out at every layer — the holes close one after another, until by the last hidden layer the two classes are two plain blobs. Networks with a folding bend get there in fewer layers than smooth ones, and the reason is the one the creases already gave: a fold is not reversible, and closing a hole is not something a reversible map can do.5
Every chapter from here is this chapter wearing different clothes. Handwritten digits live in a 784-dimensional input space — one axis per pixel — and a classifier must deform that space until ten regions come apart (Chapter 3). An autoencoder will squeeze the deformation through a two-dimensional bottleneck and hand us the map to look at (Chapter 4). Even the language model of Chapter 5 is moving words around a space until the next token sits in a predictable place. The grid you just watched bend is the only mental image you need.
Sources
- 1 Neural Networks, Manifolds, and Topology The essay that made the rubber-sheet picture stick, and the source of the tangled-rings example this chapter runs live.
- 2 Testing the Manifold Hypothesis The supposition that real data of very high dimension lies close to a surface of far lower dimension, treated for once as a claim that can be tested rather than assumed.
- 3 Representation Learning: A Review and New Perspectives The case, made before it was obvious, that the useful output of a deep network is the coordinates it invents rather than the answer it prints.
- 4 Understanding intermediate layers using linear classifier probes Hang a bare linear classifier off each hidden layer and see how well it does. Separability rises layer by layer, which is the untangling of this chapter measured in a number.
- 5 Topology of deep neural networks Measures the holes in the data — literally, by counting them — at every layer of a trained network, and watches them close. Networks with a folding bend simplify the topology far faster than smooth ones.