Skip to main content
QUICK REVIEW

[Paper Review] Is it Time to Swish? Comparing Deep Learning Activation Functions Across NLP tasks

Steffen Eger, Paul Youssef|arXiv (Cornell University)|Jan 9, 2019
Adversarial Robustness in Machine LearningComputer Science5 citations
TL;DR

This paper conducts the first large-scale empirical comparison of 21 activation functions across eight NLP tasks using MLPs, CNNs, and RNNs. It finds that the penalized tanh function outperforms others in stability and generalization, achieving a 2 percentage point improvement over standard activations when replacing sigmoid/tanh gates in LSTM cells on a challenging sequence tagging task.

ABSTRACT

Activation functions play a crucial role in neural networks because they are the nonlinearities which have been attributed to the success story of deep learning. One of the currently most popular activation functions is ReLU, but several competitors have recently been proposed or 'discovered', including LReLU functions and swish. While most works compare newly proposed activation functions on few tasks (usually from image classification) and against few competitors (usually ReLU), we perform the first large-scale comparison of 21 activation functions across eight different NLP tasks. We find that a largely unknown activation function performs most stably across all tasks, the so-called penalized tanh function. We also show that it can successfully replace the sigmoid and tanh gates in LSTM cells, leading to a 2 percentage point (pp) improvement over the standard choices on a challenging NLP task.

Motivation & Objective

  • To address the lack of large-scale empirical evaluation of activation functions across diverse NLP tasks and architectures.
  • To investigate whether recently proposed activation functions like swish generalize well beyond image classification to NLP.
  • To identify activation functions that perform stably across multiple NLP tasks and hyperparameter settings.
  • To evaluate whether saturating functions like penalized tanh can successfully replace sigmoid and tanh in LSTM gating mechanisms.
  • To assess the impact of hyperparameters such as depth and dropout on activation function performance.

Proposed method

  • Evaluated 21 activation functions across 8 NLP tasks spanning sentence classification, document classification, and sequence tagging.
  • Used three standard NLP architectures: multilayer perceptrons (MLPs), convolutional neural networks (CNNs), and recurrent neural networks (RNNs).
  • Compared performance using both top accuracy and average performance across hyperparameter settings to assess stability.
  • Conducted regression analysis to model the influence of hyperparameters (e.g., number of layers, dropout rate) on activation function performance.
  • Replaced standard sigmoid and tanh gates in LSTM cells with penalized tanh and evaluated on a challenging sequence tagging benchmark.
  • Employed automatic search-based functions from Ramachandran et al. (2017), including swish, and compared them to standard and novel alternatives.

Experimental results

Research questions

  • RQ1Which activation function performs most stably across diverse NLP tasks and architectures?
  • RQ2Do activation functions discovered via automatic search in image classification (e.g., swish) generalize well to NLP tasks?
  • RQ3Can saturating activation functions like penalized tanh successfully replace sigmoid and tanh in LSTM gating mechanisms?
  • RQ4How do hyperparameters such as network depth and dropout affect the relative performance of different activation functions?
  • RQ5Is there a trade-off between top performance and stability across hyperparameter settings in NLP models?

Key findings

  • The penalized tanh function achieved the most stable performance across all eight NLP tasks, outperforming other functions in consistency.
  • Penalized tanh improved LSTM performance by 2 percentage points on a challenging sequence tagging task when replacing standard sigmoid and tanh gates.
  • While swish performed well on several tasks, it was less stable than penalized tanh and did not consistently rank in the top performers.
  • Most activation functions discovered via automatic search in Ramachandran et al. (2017) failed to generalize to NLP tasks, with the exception of swish.
  • Saturating functions with finite ranges, such as penalized tanh, demonstrated superior stability across hyperparameter settings, while non-saturating functions often yielded higher peak performance but with less consistency.
  • The performance of activation functions was not predictable a priori, and hyperparameter sensitivity varied significantly across functions, with penalized tanh and swish showing greater robustness to depth and dropout.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.