Mish: A Self Regularized Non-Monotonic Activation Function

Diganta Misra

Abstract

Mish is a novel, self-regularized non-monotonic activation function defined as $f(x) = x \tanh(\text{softplus}(x))$. Inspired by the self-gating property of Swish, Mish provides a smooth, $C^\infty$ continuous profile that avoids the "Dying ReLU" problem while maintaining an unbounded upper limit to prevent saturation. Empirical evaluations across various benchmarks, including ImageNet and MS-COCO, demonstrate that Mish consistently outperforms ReLU and Swish across diverse deep learning architectures.

Introduction

For years, the Rectified Linear Unit (ReLU) has been the standard activation function in deep learning due to its simplicity and computational efficiency. However, ReLU suffers from the "Dying ReLU" problem, where neurons can become permanently inactive if they fall into the negative regime, as the gradient becomes zero. While alternatives like Leaky ReLU and Swish have been proposed, they often lack the mathematical smoothness or specific properties required for optimizing complex, deep architectures.

This paper introduces Mish, a smooth, non-monotonic activation function designed to improve gradient flow and model expressivity by preserving small negative weights and providing a continuously differentiable landscape.

The Mish Activation Function

Mish is mathematically defined as: $$f(x) = x \tanh(\ln(1 + e^x))$$

The function combines several key technical characteristics:

  • Self-Gating: Similar to Swish, Mish utilizes a self-gating mechanism where the input is multiplied by a non-linear transformation of itself.
  • Non-Monotonicity: Mish allows for a small negative "dip," which helps preserve small negative weights that might otherwise be lost in ReLU-based networks.
  • Smoothness: As a $C^\infty$ continuous function, Mish avoids the sharp transitions of ReLU, leading to smoother gradients during backpropagation.
Comparison of Mish with other activation functions and their derivatives.

To address the computational overhead of transcendental functions ($\tanh$, $\exp$), the author developed Mish-CUDA, a specialized implementation that optimizes performance to be competitive with standard framework implementations of simpler functions.

Experimental Results

The effectiveness of Mish was validated across multiple standard benchmarks, including MNIST, CIFAR-10, ImageNet-1k, and MS-COCO.

Validation accuracy of Mish compared to Swish and other non-monotonic variants.

Key performance highlights include:

  • ImageNet Classification: On a ResNet-50 architecture, Mish achieved a ~1% improvement in Top-1 accuracy over ReLU.
  • Object Detection: Integrated into YOLOv4 with a CSP-DarkNet-53 backbone, Mish outperformed Leaky ReLU by 2.1% in average precision ($AP_{50}$) on the MS-COCO dataset.
  • Architecture Robustness: Across more than 10 different architectures on CIFAR-10, Mish consistently provided a 1% to 3% performance boost compared to ReLU.

Discussion and Insights

The superior performance of Mish can be attributed to several factors. Visualization of loss landscapes reveals that Mish produces smoother and wider minima than ReLU, which is strongly correlated with better generalization. Furthermore, the first derivative of Mish appears to act as a "preconditioner," helping optimizers navigate complex network geometries more effectively.

Mish also demonstrates significant depth robustness. In MNIST experiments, Mish maintained high accuracy as network depth increased beyond 15 layers, whereas the performance of ReLU and Swish declined sharply.

Conclusion

Mish represents a powerful alternative to ReLU and Swish, offering improved accuracy and stability across a wide range of tasks and architectures. While it carries a higher raw computational cost, optimized implementations like Mish-CUDA mitigate this drawback. Future work will focus on a deeper mathematical understanding of the preconditioning effects and further hyperparameter tuning specifically for Mish-based architectures.

Summary updated

BibTeX
@inproceedings{misra2020mish,
  author = {Diganta Misra},
  title = {{Mish: A Self Regularized Non-Monotonic Activation Function}},
  booktitle = {BMVC},
  year = {2020},
}
Figure