Gradient Descent Playground

I reduce loss functions for a living. Here's one you can reduce yourself.

Take everything else away from deep learning and this is what's left. You have a loss function (the curve), a parameter (the ball's position), and one rule that repeats forever: measure the slope where you stand, then step downhill by an amount proportional to the slope times the learning rate.

Click anywhere on the curve to drop the ball, then press run. At a small learning rate it settles politely into the nearest valley, even when that's the shallow local one on the left that isn't the best answer available. The page isn't broken when that happens; getting stuck there is a fundamental limitation of gradient descent. Now raise the learning rate. The ball starts overshooting the valley floor and ringing back and forth. Push further and each step lands higher than the last one started, until the whole thing leaves the visible universe. Every practitioner has produced that exact NaN in a training log, usually by accident. Here you can do it on purpose.

Click the curve to place the ball.

In production the same game is played with millions of parameters and a GPU bill, under the same rules. Some stories from playing it for real: One Encoder, Three Jobs →