A Model Is a Function You Can Tune

Timeline, 1822–2026
  1. 1822◆Babbage proposes the Difference Engine
  2. 1843◆Lovelace publishes the first program, for the Analytical Engine
  3. 1936◆Turing: a machine that can imitate any other
  4. 1937Shannon: relay circuits do Boolean logic
  5. 1941◆Zuse’s Z3, a programmable relay computer
  6. 1943McCulloch and Pitts: a neuron as a switch
  7. 1946ENIAC: 17,468 tubes, 150 kW
  8. 1947The transistor, Bell Labs
  9. 1958Rosenblatt’s perceptron
  10. 1959The MOSFET (Atalla and Kahng) and the planar chip
  11. 1965Moore’s observation
  12. 1969Minsky and Papert’s Perceptrons
  13. 1971◆Intel 4004, made for Busicom of Japan
  14. 1974Dennard’s scaling rules
  15. 1976Cray-1
  16. 1986Backpropagation popularised
  17. 1989LeCun’s convolutional network reads zip codes
  18. 1997◆LSTM (Hochreiter and Schmidhuber)
  19. ~2005Dennard scaling ends; clock speeds stall
  20. 2007CUDA lets GPUs run general code
  21. 2009ImageNet
  22. 2011◆K computer tops the TOP500
  23. 2012◆AlexNet, trained on two gaming GPUs
  24. 2017“Attention Is All You Need”
  25. 2020Scaling laws; GPT-3; Fugaku tops the TOP500
  26. 2022Chinchilla; H100; ChatGPT
  27. 2024100,000-GPU clusters; a 1,500 MW data-centre load drops off the Virginia grid
  28. 2025◆IEA: data centres used 415 TWh in 2024

In brief. What a model is: a function with knobs, from one neuron that draws a line to layers trained by passing the error backwards and rolling downhill.

The surprise. The random-batch method behind today’s training, stochastic gradient descent, goes back to a 1951 method of Herbert Robbins and Sutton Monro.

Start with a page of red and blue dots and a straight line you can drag across it. Each time a dot lands on the wrong side, nudge the line a little. That is the oldest idea in machine learning, and it is still what a neural network does: it is a function with knobs, and training is the search for knob settings that fit the examples.1

This page asks what that function is. The next page, Language, asks what it costs to run one that predicts the next word. Together they set the unit of the Act 1 meter: one answer, in operations.

  1. 1A neuron is a line
  2. 2The pattern one line cannot draw
  3. 3Passing the blame backwards
  4. 4Better ways downhill
  5. Final words

1A neuron is a line

In 1943 the neurophysiologist Warren McCulloch and the logician Walter Pitts described a brain cell as a switch: it adds up signals from other cells, some pushing it on and some holding it off, and fires if the total crosses a threshold.1 With the right connections a few such units could compute AND, OR or NOT, the same gates as the switches at the start of the essay. What they did not say was how the connections should be chosen.

Put that unit on a page and it becomes a line. Give it two inputs, say an x and a y position. It multiplies each by a weight, adds a third number, the bias, and asks whether the result is above zero. All the points where the sum is exactly zero form a straight line; on one side the unit fires, on the other it does not. Choosing the three numbers is choosing where the line goes.

Below are dots in four corner groups. Think of each corner as two inputs, each off or on. In the first dataset a dot is red only when both inputs are on, which is AND; otherwise it is blue. Drag the line to separate the colours, then try OR.

Model Dots scattered round the four corners of a square. Each corner stands for a pair of inputs that are off or on, coloured red by the rule you choose. “Let it learn” runs Rosenblatt’s perceptron rule from wherever your line is, for up to 80 nudges.

In 1958 Frank Rosenblatt, a psychologist at the Cornell Aeronautical Laboratory, gave this unit a way to learn. Take a dot it gets wrong and move the line a little towards putting that dot on the right side; repeat. In July that year the US Office of Naval Research showed his method running on an IBM 704: after 50 tries it had taught itself to tell punched cards marked on the left from cards marked on the right. “NEW NAVY DEVICE LEARNS BY DOING”, said the New York Times.2 For AND and OR, press “Let it learn” and the perceptron finds a line, usually within a handful of nudges. It always will, whenever such a line exists: the perceptron convergence theorem, proved in 1962 by Rosenblatt and by Albert Novikoff.

The maths: the perceptron rule

With weights w = (w₁, w₂), bias b and input x, the unit outputs 1 if w·x + b > 0 and 0 otherwise. For an example it gets wrong, with target t = 1 (red) or t = −1 (blue), the update is

w ← w + η t x, b ← b + η t,

which tilts and shifts the line towards classifying that point correctly. If some line separates the classes with a margin γ and every input lies within a radius r, the number of mistakes is at most (r/γ)²: the perceptron convergence theorem.

2The pattern one line cannot draw

Now switch the figure to XOR: red when exactly one input is on. The two red corners sit diagonally opposite each other, and so do the two blue ones. Try it by hand first. Every line you draw puts at least one corner on the wrong side. Press “Let it learn” and the perceptron nudges forever; it never settles, because there is nothing to settle on.

In 1969 Marvin Minsky and Seymour Papert of MIT published Perceptrons, a careful mathematical book about what such single-layer machines could and could not compute, and XOR-like patterns were among the things they could not.3 The book is often blamed, too simply, for a long cooling of interest in neural networks, but research on them did slow for more than a decade.

The way out was known in principle: use more than one line. Below, two neurons each draw a dashed line, neuron 1 and neuron 2, and their outputs are fed to a third neuron that combines them. The two in the middle are called hidden neurons, because you never see their outputs directly, only the final answer. Fence the two red corners into a strip between the lines.

Model A network with two inputs, two hidden neurons and one output, working on XOR. Each dashed line is one hidden neuron, with an arrow pointing to the side where it is “on”. While you drag, the output neuron re-learns its own three weights (how to combine the two lines); “Let it learn” trains all nine weights together by gradient descent. The background is the network’s answer.

The output neuron is just a third line, but drawn in a different space: not the position on the page, but “how on is hidden neuron 1” against “how on is hidden neuron 2”. In that space the four corners are no longer arranged as XOR, and one line is enough. That is the whole trick of a layer: it moves the data into a new space where the next layer’s job is easier. Deep networks repeat it many times.

The maths: why one line fails, and two succeed

Suppose one unit computed XOR with inputs 0/1. It would need b ≤ 0 for (0,0), w₁ + b > 0 for (1,0), w₂ + b > 0 for (0,1) and w₁ + w₂ + b ≤ 0 for (1,1). Adding the middle two gives w₁ + w₂ + 2b > 0, so w₁ + w₂ + b > −b ≥ 0, contradicting the last. No such weights exist.

With hidden units h₁ = OR(x₁, x₂) and h₂ = AND(x₁, x₂), XOR is h₁ AND NOT h₂, which one more unit can compute: output = step(h₁ − h₂ − 0.5). The network in the figure uses smooth tanh units instead of hard steps, so that it can be trained by gradient descent.

3Passing the blame backwards

With one neuron it is obvious how to fix a mistake: move its line. With hidden neurons it is not. When the answer is wrong, which of the many weights is to blame, and by how much? A weight deep inside the network only affects the answer through everything that comes after it.

The answer is to ask each weight a precise question: if I nudged you up a tiny bit, how much would the error change? That number is the weight’s share of the blame, its gradient. It can be worked out for every weight at once by starting at the output, where the error is known, and passing it backwards one layer at a time. Each layer only needs what the layer after it reports back. Below is the smallest network where this matters, shown one example at a time. Blue connections are positive weights and orange ones negative; the violet numbers are the blame flowing back.

Model A network with two inputs, two hidden neurons (tanh) and one output (sigmoid), trained on a single example with inputs 1 and 0.5 and target 1; the error is half the squared difference. Line thickness is the size of each weight. The purple dots travelling from right to left, and the purple bar under each knob, show that weight’s gradient, computed by the backward pass. “Take one step downhill” moves all six weights against their gradients at once.

Drag a weight with a long violet bar and the error moves a lot; drag one with a short bar and it hardly moves. The bars are exactly that sensitivity: raise a weight by 0.1 and the error changes by about a tenth of its blame. The step button uses all six at once. The same idea scales unchanged: a model with a hundred billion weights does one forward pass to get its answers, one backward pass to get a hundred billion blame numbers, and nudges every weight.

The method was found several times. Seppo Linnainmaa described the general way to compute such derivatives backwards through a calculation in his 1970 master’s thesis in Helsinki; Paul Werbos sketched using it to train neural networks in his 1974 Harvard thesis and set it out for networks in full in 1982. It became widely known in 1986, when David Rumelhart, Geoffrey Hinton and Ronald Williams showed in Nature that networks trained this way learned useful internal features by themselves.4 They called it back-propagating errors, and the name stuck.

The maths: the chain rule, backwards

For the figure’s network, with hᵢ = tanh(zᵢ), output o = σ(v₁h₁ + v₂h₂) and error E = ½(o − t)², the chain rule gives

∂E/∂vᵢ = δₒ hᵢ, where δₒ = (o − t) o (1 − o),

∂E/∂aⱼᵢ = δᵢ xⱼ, where δᵢ = δₒ vᵢ (1 − hᵢ²).

Each δ is computed from the one after it: that is the backward pass. Its cost is about twice that of the forward pass, whatever the number of weights, which is why training costs roughly three times as much arithmetic as running the model once per example.

4Better ways downhill

Once every weight has a gradient, learning is the ball rolling downhill from the essay: step against the gradient, recompute, repeat. Two refinements made this practical for large networks, and both are visible in one valley.

The first is momentum. A plain step only looks at the slope where the ball is now. In a long, narrow valley the walls are steep and the floor almost flat, so a step small enough not to overshoot the walls only crawls along the floor. Momentum lets the ball keep some of its previous velocity, like a real ball. Along the floor, where the slope keeps pointing the same way, the velocity builds up to about ten times a plain step. Across the valley the ball now overshoots and swings from wall to wall, but those pushes change sign and largely cancel, and the swings die away. Boris Polyak analysed this “heavy ball” method in Moscow in 1964.5 In the valley below, from where the balls start, plain steps need 212 steps to reach the floor and stay there; momentum, with the same step size, flies through the floor far sooner, swings out again and still settles long before the plain ball; the readout counts both.

The second is noise. Computing the exact gradient means running every training example through the network before taking a single step. With millions of examples that is far too slow. Instead each step uses a small random batch, which gives a rough, wobbling estimate of the slope: stochastic gradient descent, after a 1951 method of Herbert Robbins and Sutton Monro.6 Add noise below and watch both balls still find the floor, just less tidily.

Model The same two-knob error landscape as in the essay: position is the two knobs, height is the error. Both balls start where you drop them and use the same step size. The yellow one carries 90% of its previous velocity into each step (momentum). A ball counts as on the floor once its error stays below 0.01 for ten steps in a row, so a momentum ball that only passes through does not count. The noise slider adds random error to every measured slope, as when each step sees only a small batch of the data. The error formula is made up for the picture: L = 0.12(x − 1.2)² + 1.5(y − 0.35 sin 1.7x)², a long curved valley. Height is drawn as ln(1 + L), so the shallow floor stays visible; colour bands mark equal heights. Without WebGL the same figure appears as a flat map seen from above.

Noisy steps sound like a compromise, but they are cheap enough to take millions of them, and a little noise helps the ball shake out of shallow dips. Most large models today are trained with Adam, a 2014 method by Diederik Kingma and Jimmy Ba that combines momentum with a separate, automatically tuned step size for every weight.7

The maths: momentum and mini-batches

Plain gradient descent: w ← w − η ∇L(w). With momentum β (here 0.9):

v ← β v − η ∇L(w), w ← w + v.

Along a direction where the gradient keeps the same sign, the velocity builds up to about η/(1 − β) times the gradient, ten times a plain step for β = 0.9; across the valley, where the sign flips every step, it largely cancels. Stochastic gradient descent replaces ∇L, an average over all N examples, with the average over a random batch of B ≪ N, an unbiased estimate whose noise shrinks roughly as 1/√B.

Final words

A model is a function you can tune. One line draws half-planes; two layers draw XOR; backpropagation says which knob to turn; gradient descent turns them. Nothing so far has said what the function is for when the input is language, or how many operations an answer takes. That is the next page.

For the short version of the same story, with a 3D loss surface you can tilt, see the essay §§7–9. On the long-run meter (the Verdict), this page sets the unit of work: a model evaluation.

Notes and sources

  1. W. S. McCulloch and W. Pitts, “A logical calculus of the ideas immanent in nervous activity”, Bulletin of Mathematical Biophysics 5, 115–133 (1943).
  2. F. Rosenblatt, “The perceptron: a probabilistic model for information storage and organization in the brain”, Psychological Review 65(6), 386–408 (1958). The July 1958 IBM 704 demonstration, the 50 trials and the New York Times headline are from M. Lefkowitz, “Professor’s perceptron paved the way for AI – 60 years too soon”, Cornell Chronicle, 25 September 2019. Convergence theorem: A. B. J. Novikoff, “On convergence proofs for perceptrons”, Symposium on the Mathematical Theory of Automata (1962).
  3. M. Minsky and S. Papert, Perceptrons: An Introduction to Computational Geometry, MIT Press (1969).
  4. S. Linnainmaa, master’s thesis, University of Helsinki (1970), on the reverse accumulation of rounding errors; P. J. Werbos, Beyond Regression, PhD thesis, Harvard University (1974); P. J. Werbos, “Applications of advances in nonlinear sensitivity analysis”, in R. Drenick and F. Kozin (eds.), System Modeling and Optimization, Springer (1982); on the history, J. Schmidhuber, “Who invented backpropagation?”; D. E. Rumelhart, G. E. Hinton and R. J. Williams, “Learning representations by back-propagating errors”, Nature 323, 533–536 (1986).
  5. B. T. Polyak, “Some methods of speeding up the convergence of iteration methods”, USSR Computational Mathematics and Mathematical Physics 4(5), 1–17 (1964). G. Goh, “Why Momentum Really Works”, Distill (2017): with momentum the ball can overshoot and oscillate across a narrow valley while it speeds up along the floor; how fast it settles depends on the step size, β and the ratio of the valley’s curvatures.
  6. H. Robbins and S. Monro, “A stochastic approximation method”, Annals of Mathematical Statistics 22(3), 400–407 (1951).
  7. D. P. Kingma and J. Ba, “Adam: A Method for Stochastic Optimization” (2014; ICLR 2015).

Figures marked Data use the cited sources; Data + model combine them with the series’ own arithmetic. Figures marked Model are simplified models built to show a mechanism; their assumptions are listed under ⓘ data.