Empirical comparison of optimizers

The following figure shows an experimental analysis across multiple tasks and different neural network architectures.

In the majority of experiments, the optimizer that achieved the best average performance was Adam.

Key findings from experiments

From the experimental evidence it can be concluded that:

  • Adam is, on average, the optimizer that performs best;
  • However, in specific cases, optimizers such as NAG and RMSProp have outperformed Adam.

Core optimizers to always try

In the toolbox of anyone working with Deep Learning, when starting an experiment it is good practice to test at least a basic trio of optimizers:

  • Adam
  • SGD (with NAG)
  • RMSProp.

Fine-tuning caution

An empirical observation in the literature is the following.

Adam works extremely well when the network is “fresh”, i.e., when it has never been trained before and the weights are still random.
But when the network has already been trained and has reached a reasonably good configuration of its parameters, and the goal is only to refine small details, things can change.

The issue is that, by design, Adam tends to emphasize some neurons over others, precisely because of its adaptive nature.
As a result, if the network has already been trained, using Adam in later stages can make the model over-adapt to the new data, potentially causing it to forget useful information learned earlier.

This effect will be revisited later in the context of fine-tuning.

Warning

In letteratura si osserva la seguente regola empirica: Adam è un ottimizzatore che funziona molto bene quando la rete è “vergine”, ossia non è mai stata addestrata prima e i pesi sono ancora casuali.
Quando invece la rete è già stata addestrata, essa ha trovato una configurazione ottimale dei suoi parametri, e ciò che si desidera fare è semplicemente ritoccare piccoli dettagli.

Il problema è che, per come è formulato, Adam tende ad enfatizzare alcuni neuroni rispetto ad altri, proprio in virtù della sua natura adattiva.
Questo significa che, se la rete è già stata addestrata, usare Adam in una fase successiva può portare la rete ad adattarsi troppo ai nuovi dati, proprio a causa della sua natura adattiva, con il rischio di perdere alcune delle informazioni utili apprese in precedenza.
Tale effetto sarà ripreso più avanti nel contesto del fine-tuning.