Lottery Ticket Lab
Interactive lesson · Frankle & Carbin, 2018

Lottery Ticket Lab

Inside a big randomly initialized network there is a much smaller one that can learn the task on its own. Here you will find it.

The idea

In 2018 Jonathan Frankle and Michael Carbin trained a network, deleted most of its weights, and noticed something odd. If they took the weights that survived, reset them to the exact random values they started with, and trained again, the small network learned about as well as the big one. Give those same connections fresh random values and it often learned worse.

They called the surviving subnetwork a winning ticket: a lucky combination of connections and starting values. Training a large network is like buying a huge number of lottery tickets at once. The more tickets you hold, the more likely one of them wins. The Algorithmic Simplicity video uses this idea to explain why bigger networks end up generalizing better instead of overfitting.

The search they used is called iterative magnitude pruning:

  1. Initialize a dense network with random weights θ₀ and save a copy.
  2. Train it.
  3. Delete a fixed share of the surviving weights, the ones with the smallest magnitude.
  4. Reset every surviving weight to its value in θ₀. This is the rewind.
  5. Go back to step 2. Stop when the network can no longer learn the task.

The lab

The network takes two numbers a and b between −1 and 1, passes them through two hidden layers of tanh units, and learns the chosen operation from 256 random examples. Blue lines are positive weights, red are negative, and thickness shows magnitude. Press Find the winning ticket and watch the network shrink.

Operation
TicketNo. 0042a × b · 2-16-16-1
Training the dense network…
positive weight negative weight dead end (no path from input to output)
Error after training vs. share of weights kept

Error is normalized mean squared error on a 33×33 grid of test inputs: 1 means no better than guessing the average, below 0.01 counts as solved.

Is it the mask or the start?

A winning ticket is two things: which connections survive (the mask) and the starting values those connections had. The experiment that made the paper famous separates them. For every round of your search, it trains two controls with the same number of weights per layer:

  • Same mask, new start. Keep the ticket’s connections, draw fresh random values.
  • Random mask, original start. Keep θ₀, but pick which connections survive at random.
Uses the rounds from the lab above. If you have not searched yet, it runs the search first.
winning ticket same mask, new start random mask, original start

At this tiny scale the mask carries most of the effect. A mask found by pruning keeps working far below the point where a random mask breaks, often because the random one cuts an input off completely. The benefit of the original starting values is smaller and changes from seed to seed: sometimes the ticket clearly wins, sometimes a fresh start does almost as well. That matches later research. Frankle and colleagues found that in larger networks you usually need to rewind to an early point in training rather than all the way back to θ₀, and other groups found cases where fresh starts work just as well.

Bigger draws, more winners

Your ticket proves that a network with a few dozen weights can compute the operation. So why not just train a small network from the start? Train small dense networks from 8 different random seeds and count how often they solve it.

Hidden widths 2 to 16, 8 seeds each, same task and training as the lab.

Small networks can represent the answer but usually fail to find it, because they start with only a handful of candidate paths and most of them begin in a bad place. A wide network contains an enormous number of overlapping small subnetworks, so gradient descent almost always has a good one to amplify. This is the video’s argument in miniature: extra size is not wasted capacity that invites overfitting. It is more lottery tickets, and with them better odds of a simple solution that generalizes.

Fine print

Everything runs in your browser with no libraries. Networks are 2-H-H-1 with tanh hidden units, LeCun-normal initialization and zero biases. Training is 500 full-batch Adam steps with a cosine learning rate from 0.01 down to 0.00025. Pruning is per layer by magnitude: the middle layer loses the chosen share each round, the input and output layers lose half that share, as in the original paper. Biases are never pruned. The pruning step never cuts the last connection from an input; random-mask controls get no such protection. This is a toy: real tickets are found in convolutional networks and transformers with millions of weights, where results are noisier and rewinding matters more.

  1. Frankle & Carbin, The Lottery Ticket Hypothesis (2018)
  2. Frankle, Dziugaite, Roy & Carbin, Stabilizing the Lottery Ticket Hypothesis (2019)
  3. Liu et al., Rethinking the Value of Network Pruning (2018)
  4. Belkin et al., Reconciling modern machine learning practice and the bias-variance trade-off (2018)
  5. Algorithmic Simplicity, “THIS is why large language models can understand the world” (2025)