1 of 65

Symbolic Discovery of�Optimization Algorithms

Xiangning Chen1 2 § Chen Liang1 § Da Huang1 Esteban Real1

Kaiyuan Wang1 Yao Liu1 † Hieu Pham1 Xuanyi Dong1 Thang Luong1

Cho-Jui Hsieh2 Yifeng Lu1 Quoc V. Le1

1 Google 2 UCLA

2 of 65

3 of 65

4 of 65

5 of 65

In summary, what’s Lion Optimizer?

  • Lion (EvoLved Sign Momentum)

​

  • More memory efficient than adam
    • Only keeps track of momentum

​

  • In contrast to adaptive optimizers,
    • Uniform update magnitudes across all dimensions
    • Calculated through the sign operation

6 of 65

  • (recap)

Gradient (full batch) Descent

Adam Optimizer

7 of 65

8 of 65

9 of 65

10 of 65

Contents

  1. How to Search for Optimizers ? 🤔
    • Intro
    • Design Choices
    • Symbolic Discovery

​

  • Discovering Lion Optimizer 🦁

​

  • How well does it perform 🤹🏻‍♂️
    • Properties
    • Pros
    • Cons

​

11 of 65

0. De facto standard optimizers

  • Adam with decoupled weight decay [1]
    • Referred to as AdamW

​

  • Adafactor with factorized second moments [2]

[1] - Loshchilov, I., & Hutter, F. - ICLR 2019.

[2] - Shazeer, N., & Stern, M. (2018). PMLR.

12 of 65

1.1 - How to Search for Optimizers

  • Learning to optimize (L2O)
    • Discover optimizers by training parameterized models (black box 📦)
    • Eg. Training neural networks to output the `updates`
    • Genearalizability
    • Typically trained on limited # of small tasks

​

  • Reinforcement learning / Monte Carlo Sampling methods
    • Search space is defined by trees
    • Size of the tree is often constrained (fixed operands -> momentum and gradient)
    • Less potential for new discovery

​

  • AutoML Zero
    • Attempts to search every part of the ML pipeline while evaluating on toy tasks.

 

13 of 65

AutoML-Zero Paper

  • “Evolutionary search can still discover two-layer neural networks trained by backpropagation.”

​

  • Discover ML algorithms by building blocks like basic mathematical operations

 

14 of 65

1.2 - Symbolic Discovery of Algorithms

15 of 65

Why is a symbolic formulation better?

  • Algorithm is not discovered numerically but symbolically.
    • Eg: in the form of an equation / computer program

​

​

  • Advantages:
    • Easy to analyze, comprehend, and transfer to new tasks (compared to NN)
    • Program length gives a heuristic on how complex the algo is

​

 

16 of 65

Program Space

Notion of Mutations 🧬 for the Program 🤨

Intuition about how big of a search space we are talking about

 

How to efficiently search in this space?

17 of 65

1.2 - Program Search Space

Flexible enough to discover

New stuff

Program should be easy to analyze

And incorporate into the ML workflow

Program should Focus on high-level design rather than low level complexities

 

18 of 65

 

Output :

  • Update to the weight

 

1.3 - Structure of the train function to learn

19 of 65

 

Pool of math functions = 45 common ones

20 of 65

21 of 65

Program Space

Notion of Mutations 🧬 for the Program 🤨

Intuition about how big of a search space we are talking about

 

How to efficiently search in this space?

22 of 65

Program Space

Notion of Mutations 🧬 for the Program 🤨

Intuition about how big of a search space we are talking about

 

How to efficiently search in this space?

23 of 65

1.4 – Mutations

  • 3 types of mutations

​

    • Inserting a new statement, ➕
      • at a random location with
      • randomly chosen functions and arguments

​

    • Deleting a randomly chosen statement ❌

​

    • Modifying a random statement
      • Randomly altering one of its function arguments
  • Replace with an existing variable
  • Newly generated constant (sampled from a normal distribution)
  • Mutate existing constant (by multiplying with a random factor 2a

24 of 65

1.5 – Infinite and sparse search space ? 🤯

  •  

Number of possible functions

Number of local variables

 

 

We could be essentially looking at very few workable solutions in an infinite search space

-> They do an experiment to check this point

25 of 65

Program Space

Notion of Mutations 🧬 for the Program 🤨

Intuition about how big of a search space we are talking about

 

How to efficiently search in this space?

26 of 65

Program Space

Notion of Mutations 🧬 for the Program 🤨

Intuition about how big of a search space we are talking about

 

How to efficiently search in this space?

27 of 65

1.6 – Search Techniques

  1. Evolution with warm-start and restart
    • Regularized (aging) evolution
      • Shown success in AutoML

​

  • Pruning though abstract execution
  • Proxy tasks and search cost

​

 

28 of 65

Ok, what’s regularized (aging) evolution ?

29 of 65

Img Source : AutoML Zero Paper

30 of 65

Img Source : AutoML Zero Paper

31 of 65

Img Source : AutoML Zero Paper

32 of 65

Img Source : AutoML Zero Paper

33 of 65

1.6.1 – Regularized evolution with warm-start and restart

  • No! let’s warm start 🔥
    • Initial population is AdamW

​

  • Evo algo Params
    • Tournament selection of size of 2
    • Population size : 1000

​

  • Types of Restarts
    1. Restarting from the initial program (keeping faith on randomness)
    2. Restarting from the best algo found

​

​

​

​

​

34 of 65

  • Displays the mean and standard error of five evolutionary search experiments

Only allowing constants to mutate in AdamW

35 of 65

1.6.2 – Pruning through abstract execution

  • There could be extra code chunks which are not needed 🥴
    1. Syntax/type/shape errors
    2. Functionally equavalent programs
    3. Redundent statements

​

  • So before executing, performs an abstract execution
    • Detect issues like 1), then keeps mutating until a valid child is generated
    • Computes a unique hash which uniquely identifies how outputs are computed from inputs
    • Identifies redundant statements

​

36 of 65

37 of 65

38 of 65

1.6.3 – Proxy tasks and search cost

  • Measures to reduce search cost
    • Smaller models
    • Number of training examples

​

​

  • Evaluation on the proxy tasks takes 20min on a TPU V2 chip
  • Each search experiment uses 100 TPU V2 chips -> runs for 72 hours
    • Total of 200-300K programs generated

​

  • Because of caching, 20-30K programs are actually evaluated

39 of 65

1.6.3 – Proxy tasks and search cost (contd.)

Vision Task

  • Train a ViT with three layers, 96 hidden units, and three heads
    • 10% ImageNet for 30K steps with batch size 64
  • Image size = 64x64
    • Patch size 16

​

​

Language Task

  • Transformer with 2 layers, 128 hidden units and two heads
    • LM1B dataset

​

​

40 of 65

2. Discovering Optimizers

  • Discovers existing and new (🦁) optimizers.

​

  • Existing
    • Varients of AdamW
    • AdaGrad
    • Ada Belief

​

41 of 65

42 of 65

43 of 65

44 of 65

45 of 65

3. Properties of the Lion Optimizer

  • Lion (EvoLved Sign Momentum)

​

  • Sign update and regularization
    • Uniform magnitude across all dimensions rather than adaptive scaling
      • Goes against the principles of adaptive optimizers 🤷🏻‍♂️

​

    • This adds noise to the updates; (regularization)
      • Helps with generalization

​

  • Less number of hyperparameters
  • The update is an element-wise binary ±1

​

46 of 65

3.1.1 – Sign update as a form of regularization

  • Lion has higher training error compared to AdamW,
  • but with 2% higher accuracy on the validation

47 of 65

48 of 65

Memory Benefits

  • AdamW needs at least 16 TPU V4 chips

(to train a ViT-B/16 with image resolution 224 and batch size 4,096)

​

  • While Lion only needs 8 (both with bfloat16 momentum).

49 of 65

50 of 65

51 of 65

52 of 65

3 - Properties of Lion

  • Uniform update calculate through the sign function usually results in a larger norm compared to SGD and adaptive methods
    • Thus, requires a smaller learning rate lr

​

  • If we are using strong augmentiations or small batch sizes (<64) during training,
    • The improvement of Lion is much smaller

53 of 65

3.2 - Limitations

  • Search is bit biased towards the first order methods already discovered
  • When there’s strong data augmentation lion’s improvement is low

​

54 of 65

3. Summary

  • Elegant design choices to explore an infinite search space
    • Caching through hashing
    • Abstract execution to quickly eliminate erroneous ones

​

​

  • Shows us that defacto Adam can be simplified more!
    • Human choices wouldn’t have tried functions like sign which seems intuitive

​

  • Yet to see how this optimizer performs in different tasks

​

55 of 65

Thanks!

56 of 65

2.2 – Search Techniques

  • Evolution with warm-start and restart
    • Regularized Evolution

​

Keep a Population of Algorithms

Select algorithms at Random

Select best performer as parent

Parent is copied & mutated to produce a Child algorithm

Add the child to population remove oldest algo

 

57 of 65

Keep a Population of Algorithms

Select algorithms at Random

Select best performer as parent

Parent is copied & mutated to produce a Child algorithm

Add the child to population remove oldest algo

Warm-start the initial population as AdamW to accelerate the search.

58 of 65

Restarts?

  1. Restart from the initial program
      • Leads to different local optima due to the randomness in evolution
      • Synonymous with running multiple searches in parallel �
  2. Restarting from the best algorithm found thus far
      • This encourages exploitation

​

59 of 65

60 of 65

61 of 65

1.2 - Program Search Space

  • Ok, so what can a program have?

​

​

 

Functions operating over

n-dimensional arrays

 

Similar pseudo code of optimization algorithms

62 of 65

63 of 65

1.2 - Challenges when searching

  1. How to find good algos in the infinite and sparse program space

​

  • How to filter out algorithms that can generalize from the small proxy tasks to real world tasks

Evolutionary search with warm-start and restart

Abstract execution

Funnel Selection

Program Simplification

 

64 of 65

Formulating algorithm discovery as program search

 

65 of 65