Swish function explained

The swish function is a family of mathematical function defined as follows:

\operatorname{swish}\beta(x)=x\operatorname{sigmoid}(\betax)=

x
1+e-\beta

.

where

\beta

can be constant (usually set to 1) or trainable.

The swish family was designed to smoothly interpolate between a linear function and the ReLU function.

When considering positive values, Swish is a particular case of doubly parameterized sigmoid shrinkage function defined in [1] . Variants of the swish function include Mish.[2]

Special values

For β = 0, the function is linear: f(x) = x/2.

For β = 1, the function is the Sigmoid Linear Unit (SiLU).

With β → ∞, the function converges to ReLU.

Thus, the swish family smoothly interpolates between a linear function and the ReLU function.

Since

\operatorname{swish}\beta(x)=\operatorname{swish}1(\betax)/\beta

, all instances of swish have the same shape as the default

\operatorname{swish}1

, zoomed by

\beta

. One usually sets

\beta>0

. When

\beta

is trainable, this constraint can be enforced by

\beta=eb

, where

b

is trainable.

\operatorname_1(x) = \frac x2 + \frac-\frac+\frac+O\left(x^8\right)

\begin\operatorname_1(x) &= \frac \tanh \left(\frac\right) + \frac\\\operatorname_1(x) + \operatorname_(x) &= x \tanh \left(\frac\right) \\\operatorname_1(x) - \operatorname_(x) &= x\end

Derivatives

Because

\operatorname{swish}\beta(x)=\operatorname{swish}1(\betax)/\beta

, it suffices to calculate its derivatives for the default case.\operatorname_1'(x) = \frac + \frac 12 so

\operatorname{swish}1'(x)-

12
is odd.\operatorname_1(x) = \frac so

\operatorname{swish}1''(x)

is even.

History

SiLU was first proposed alongside the GELU in 2016, then again proposed in 2017 as the Sigmoid-weighted Linear Unit (SiL) in reinforcement learning. The SiLU/SiL was then again proposed as the SWISH over a year after its initial discovery, originally proposed without the learnable parameter β, so that β implicitly equaled 1. The swish paper was then updated to propose the activation with the learnable parameter β.

In 2017, after performing analysis on ImageNet data, researchers from Google indicated that using this function as an activation function in artificial neural networks improves the performance, compared to ReLU and sigmoid functions. It is believed that one reason for the improvement is that the swish function helps alleviate the vanishing gradient problem during backpropagation.

Notes and References

  1. Book: Atto . Abdourrahmane M. . Pastor . Dominique . Mercier . Gregoire . 2008 IEEE International Conference on Acoustics, Speech and Signal Processing . Smooth sigmoid wavelet shrinkage for non-parametric estimation . March 2008 . https://ieeexplore.ieee.org/document/4518347 . 3265–3268 . 10.1109/ICASSP.2008.4518347. 978-1-4244-1483-3 . 9959057 .
  2. 1908.08681 . cs.LG . Diganta . Misra . Mish: A Self Regularized Non-Monotonic Neural Activation Function . 2019.