TL;DR
Successive halving is a way to find the best of many candidate settings when each one is expensive to test. It trains every candidate a little, keeps the better half, gives the survivors more training, and repeats until one candidate is left. It matters because a weak candidate often shows its weakness early, so the training budget goes to the promising candidates instead of being spread evenly over all of them.
Builds on: Hyperparameter Optimization · Leads to: Hyperband
Where it's used
-
Tuning a neural network on a fixed compute budget. Suppose you can afford only so many full training runs, but you want to compare many learning rates and batch sizes. Successive halving trains all of them briefly, drops the weak ones, and sends the remaining time to the strongest. Hyperband, a method by Li and colleagues introduced in 2016, runs this procedure several times with different trade-offs. In its paper it was tested on tuning a small convolutional network (LeNet) on the MNIST handwritten-digit data.
-
Screening design choices in research. A lab with many candidate architectures or data-augmentation recipes can give each one a short run, often a few epochs, and keep only the ones whose curves look promising. Full training then happens for a handful of survivors instead of for everything.
-
Choosing a budget other than epochs. The Hyperband paper notes that the budget can be wall-clock training time, or the size of a random subset of the training data. A cheap small run can then stand in for an expensive full one, as long as the ranking of the candidates on the small run resembles their ranking on the full run.
How it works
The candidates are configurations: complete choices of the settings you fix before training, such as the learning rate. The unit of budget here is one epoch, one full pass over the training data. We start with four configurations, P, Q, R and S, with a maximum budget of 4 epochs. Each round, the survivors train further, and the better half, judged by validation loss (lower is better), moves on. The losses in this walkthrough and in the worked examples are made-up numbers chosen to show the mechanics, not results from a real run.
- Round 0. Train all four for 1 epoch and measure the validation loss: P 0.50, Q 0.35, R 0.72, S 0.41. Cost so far: 4 epochs. Check: 4 configurations times 1 epoch is 4.
- Keep the better half. The two lowest losses are Q (0.35) and S (0.41). P and R are dropped for good, and no more budget is spent on them. Check: 2 kept, 2 dropped.
- Round 1. Q and S train until each has had 2 epochs in total. If training can resume from saved weights, each one only needs its extra epoch. Their losses are now Q 0.28 and S 0.33. Cost of this round: 2 epochs. Check: 2 configurations times 1 extra epoch is 2.
- Keep the better half again. Q (0.28) beats S (0.33), so S is dropped. Q is the only survivor.
- Final round. Q alone trains from 2 epochs to the maximum of 4, which costs 2 more epochs. Its score at the full budget is the one we trust, so the winner is measured on the same footing as a fully trained model.
- Count the cost. The total is 4 + 2 + 2 = 8 epochs. Training all four configurations to 4 epochs would have cost 4 times 4 = 16. Check: the halving run used half the compute.
flowchart LR A[4 configurations] --> B[Each trains 1 epoch] B --> C[Keep the best 2] C --> D[Each trains to 2 epochs] D --> E[Keep the best 1] E --> F[Last survivor trains to 4 epochs]
The procedure is called successive halving for its two words. It is successive because it repeats the same step with more training each time. It is halving because each round keeps about half of the candidates. The budget per candidate grows, the number of candidates shrinks, and most of the compute ends up on the few that were strong from the start.
The math
Let n be the number of configurations at the start, r the budget of the first round (in epochs), and eta (η) a whole number of at least 2 that sets the cut: each round keeps one configuration in every eta. Round k, for k = 0, 1, 2, …, K, uses
where n_k configurations are still alive and each has had r_k epochs in total. The number of rounds is K = log base η of n, so that the last round has one configuration left, and that configuration is trained up to the maximum budget R = r η^K.
The formulas assume n is a power of η, so that every division comes out whole. The 4-configuration walkthrough above is the case n = 4, η = 2, r = 1, which gives n_0 = 4, n_1 = 2, n_2 = 1 and r_0 = 1, r_1 = 2, r_2 = 4.
Steps 1 to 4 in symbols
In round k, every alive configuration trains from its previous budget r_{k-1} up to r_k. So the new work in round k is only the difference. Set r_{-1} = 0 so that round 0 fits the same formula. After round k, the best n_{k+1} configurations, which is n_k divided by η, move on. This is what "keep the better half" means when η = 2.
Step 5 in symbols: the cost
The number of epochs spent in round k is
Total cost is the sum of these for k from 0 to K. Since n_k r_k = n r is the same in every round, rounds from 1 on each cost n r (1 − 1/η), and the total simplifies to
Training every configuration to the maximum budget costs n R = n r η^K. The ratio of the two is the speed-up from halving, and it grows quickly with K. For the walkthrough, n = 4, r = 1, η = 2, K = 2 gives 4 (1 + 2 · 1/2) = 8, which matches the count in step 6.
Worked examples
Setup: n = 2, η = 2, r = 1, so the maximum budget is R = 2 epochs.
- Train configuration A for 1 epoch. Its validation loss is 0.40. Cost: 1 epoch.
- Train configuration B for 1 epoch. Its validation loss is 0.52. Cost: 1 epoch. Running total: 2 epochs.
- Keep the better half. With one kept out of two, A (0.40) is the survivor and B is dropped.
- Train A from 1 epoch to 2 epochs, the maximum. Cost: 1 epoch. Running total: 3 epochs.
- Interpret: A's score at 2 epochs is what we report. The uniform alternative, training both to 2 epochs, would cost 4 epochs.
Setup: n = 8, η = 2, r = 1, so R = 8 epochs and K = 3 rounds after the start. The losses are made up for illustration.
- Round 0: all eight configurations train for 1 epoch. Their losses are A 0.92, B 0.61, C 0.88, D 0.55, E 0.97, F 0.66, G 0.70, H 0.58. Cost: 8 times 1 = 8 epochs.
- Keep the four lowest: D 0.55, H 0.58, B 0.61, F 0.66. A, C, E and G are dropped.
- Round 1: the four survivors train from 1 to 2 epochs. Losses: D 0.40, H 0.44, B 0.47, F 0.36. Cost: 4 times 1 = 4 epochs.
- Keep the two lowest: F 0.36 and D 0.40. H and B are dropped even though H was second after round 0.
- Round 2: F and D train from 2 to 4 epochs. Losses: F 0.30, D 0.33. Cost: 2 times 2 = 4 epochs.
- Keep F (0.30). D is dropped.
- Round 3: F trains from 4 to 8 epochs. Its loss at 8 epochs is 0.24. Cost: 1 times 4 = 4 epochs.
- Interpret: the total is 8 + 4 + 4 + 4 = 20 epochs. Uniform training of all eight to 8 epochs would cost 64. Notice that the ranking at 1 epoch was not the final ranking. H was second early and lost by round 1.
The Hyperband paper trains a LeNet convolutional network on MNIST with a maximum of R = 81 epochs and η = 3. Its Table 1 lists the most aggressive bracket, s = 4, as 81 configurations at 1 epoch, 27 at 3 epochs, 9 at 9 epochs, 3 at 27 epochs and 1 at 81 epochs. The steps below use those values.
- Round 0: 81 configurations train for 1 epoch. Cost: 81 epochs.
- Keep the best 27. Round 1: they train from 1 to 3 epochs, which is 2 more each. Cost: 27 times 2 = 54 epochs.
- Keep the best 9. Round 2: they train from 3 to 9 epochs, which is 6 more each. Cost: 9 times 6 = 54 epochs.
- Keep the best 3. Round 3: they train from 9 to 27 epochs, which is 18 more each. Cost: 3 times 18 = 54 epochs.
- Keep the best 1. Round 4: it trains from 27 to 81 epochs, which is 54 more. Cost: 54 epochs.
- Total: 81 + 54 + 54 + 54 + 54 = 297 epochs. Training all 81 configurations to 81 epochs would cost 81 times 81 = 6561 epochs, about 22 times as much.
- Interpret: the bracket gives the search many configurations at a small cost each, and spends most of its budget on the last few. The paper runs five brackets with different starting numbers and combines them, because it is not known in advance how many configurations to start with.
Try it: a bracket with n = 9, η = 3, r = 1 and R = 9 epochs. How many epochs does the bracket cost in total, and how many would training all 9 to 9 epochs cost?
Answer: round 0 is 9 configurations at 1 epoch, cost 9. Keep 3 and train them from 1 to 3 epochs, cost 3 times 2 = 6. Keep 1 and train it from 3 to 9 epochs, cost 1 times 6 = 6. Total: 9 + 6 + 6 = 21 epochs. Uniform training costs 9 times 9 = 81 epochs.
Common mistakes and tradeoffs
It is tempting to think that the ranking after round 0 is the final ranking. In fact some configurations learn slowly and look poor early before they pull ahead. The Hyperband paper makes this point: when a configuration needs more resources before it separates from the others, cutting early can discard the best one. Example 2 shows the effect at small scale. A better rule is to make the first round large enough for the early signal to be useful on your problem, and to check on held-out data that early and late rankings agree.
It is tempting to think that each round costs the full budget again. In fact a survivor's new epochs are only the difference between its old and new budgets, as the cost formula shows. (This assumes training can resume from saved weights; if it cannot, the cost of each round is the full budget again.) Counting the full budget each round overstates the cost and makes halving look worse than it is.
It is tempting to compare configurations that have had different budgets. In fact you should only compare scores taken at the same budget, which is why every survivor in a round trains to the same point before the cut.
It is tempting to think that the right number of starting configurations can be read off from the budget alone. In fact there is a trade-off between many configurations with little training each and few configurations with long training, and successive halving fixes the first choice in advance. Running several brackets with different starting numbers, as Hyperband does, avoids guessing.
Use successive halving when training cost grows with the budget, the early loss is a reasonable guide to the final loss, and you have many candidates. Do not use it when there is no held-out data to rank by (see Cross-Validation for ways to get a held-out estimate when data is scarce), when the learning rate schedule depends on the total length of training so that a short run is not a fair test of a configuration, or when there are only a few candidates, where training them all fully is simpler. Alternatives include random search with full training, model-based search such as Bayesian Optimization, architecture search methods, and per-run Early Stopping, which stops a single run instead of comparing several.
History
In 2013, Karnin, Koren and Somekh proposed a halving-style algorithm for finding the best option in the stochastic multi-armed bandit problem, where each option gives noisy rewards.
In 2015, Jamieson and Talwalkar analysed a similar halving algorithm in the non-stochastic setting, where no assumption about the shape of the losses is made. They gave theoretical guarantees and encouraging empirical results, and the Hyperband paper later cited this work as the starting point for its own analysis.
In 2016, Li and colleagues introduced Hyperband. Its main idea was to run successive halving several times with different starting numbers of configurations, which removed the need to choose that number in advance. It caught on because it needs only two inputs, the maximum budget R and the cut factor η, and it does not require knowing in advance how fast each configuration's loss falls during training.
Recap
- A configuration is one choice of settings, and its score comes from validation loss at some budget.
- Round by round, every survivor trains further, and the better half moves on.
- Each round costs only the new epochs for each survivor, so the total cost is much lower than training every candidate fully.
- The ranking after an early round can be wrong, so the first round should be long enough to be informative.
- The number of starting configurations is a trade-off that Hyperband removes by running several brackets.
Next, read about Hyperband, which combines several runs of this procedure.
Check yourself
QuestionWhat does the word 'halving' refer to in successive halving?Show answer
Each round keeps about half of the configurations still in play. The better half, measured by validation loss at the current budget, moves on, and the rest are dropped for good.
QuestionFour configurations with η = 2 and r = 1 have round 0 losses A 0.60, B 0.30, C 0.90 and D 0.50. Which two are kept, and how many epochs does round 0 cost?Show answer
The two lowest losses are B (0.30) and D (0.50), so B and D are kept. Round 0 trains all four for 1 epoch, so it costs 4 epochs.
QuestionWhy can a configuration that looks poor after round 0 turn out to be the best one?Show answer
Some configurations learn slowly, and their validation loss is high early in training even when their final loss is low. The early ranking therefore is a noisy guide to the final ranking, and cutting on it can discard a configuration that would have won with more training.
QuestionA search starts with 27 configurations, η = 3 and R = 27 epochs, so r = 1. Using the cost formula, how many epochs does the bracket cost in total? How does that compare with training all 27 to 27 epochs?Show answer
The rounds are 27 configurations at 1 epoch (cost 27), 9 at 3 epochs (cost 9 times 2 = 18), 3 at 9 epochs (cost 3 times 6 = 18), and 1 at 27 epochs (cost 1 times 18 = 18). The total is 27 + 18 + 18 + 18 = 81 epochs. Training all 27 to 27 epochs would cost 27 times 27 = 729 epochs, about 9 times as much.
Sources
- Li, Jamieson, DeSalvo, Rostamizadeh and Talwalkar (2016), Hyperband: A Novel Bandit-Based Approach to Hyperparameter Optimization, arXiv 1603.06560: https://arxiv.org/abs/1603.06560
- Jamieson and Talwalkar (2015), Non-stochastic Best Arm Identification and Hyperparameter Optimization, arXiv 1502.07943: https://arxiv.org/abs/1502.07943
- Hyperparameter optimization (Wikipedia): https://en.wikipedia.org/wiki/Hyperparameter_optimization