Abstract: Activation functions play a pivotal role in determining the training dynamics and neural network performance. The widely adopted activation function ReLU, despite being simple and effective, has several disadvantages including the "Dying ReLU" problem. To tackle such issues, we propose a novel activation function called Serf (log-Softplus ERror activation Function), which is self-regularized and non-monotonic in nature. Like Mish, Serf belongs to the Swish family of functions. Based on extensive experiments across computer vision and natural language processing tasks, Serf vastly outperforms ReLU and other modern functions like Swish and Mish, particularly on deeper architectures. We further investigate the mathematical properties of Serf, showing how its first derivative provides a regularization effect that smooths gradients and accelerates optimization.
Introduction
In deep learning, the choice of activation function is critical for model convergence and performance. While the Rectified Linear Unit (ReLU) has been the industry standard for years due to its computational efficiency, it suffers from two primary flaws: the "Dying ReLU" problem, where neurons become inactive for negative inputs, and a lack of smoothness at zero, which can lead to jagged loss landscapes.
Recent alternatives like Swish and Mish have introduced non-monotonicity and smoothness to address these issues. This paper introduces Serf, a new contender that leverages the properties of the error function to provide superior regularization and performance across a wide array of state-of-the-art architectures.
The Serf Activation Function
Serf is a self-gated activation function where the input $x$ is multiplied by a non-linear transformation of itself. It is defined mathematically as:
$$f(x) = x \cdot \text{erf}(\ln(1 + e^x))$$
In this formulation, $\ln(1 + e^x)$ represents the Softplus function, and $\text{erf}$ is the Error Function.
Key Technical Features
- Non-monotonicity: Serf allows for small negative values (with a lower bound of approximately -0.3484), enabling the network to preserve small negative weights that ReLU would otherwise discard.
- Smoothness: As a $C^\infty$ smooth function, Serf avoids the sharp transitions of ReLU, facilitating a more stable optimization process.
- The Preconditioner Effect: The first derivative of Serf contains a "preconditioner" term that acts as an inherent regularizer. This mathematical property smooths out gradients, leading to faster and more reliable convergence.
Experimental Results
Serf was evaluated against ReLU, Swish, and Mish across diverse benchmarks, consistently achieving top-tier results:
- Image Classification: On CIFAR-10 using Inception-v3, Serf reached 92.89% accuracy, significantly higher than ReLU (90.93%) and Mish (91.55%). On CIFAR-100 with WideResNet-28-10, it achieved 77.54%.
- Object Detection: Implementing Serf in YOLOv3 for the Pascal VOC dataset resulted in a Mean Average Precision ([email protected]) of 0.766, surpassing the LeakyReLU baseline of 0.740.
- Natural Language Processing: In machine translation (Multi30k), Serf-based Transformers achieved a BLEU score of 36.06, outperforming ReLU, GELU, and Mish.
Analysis and Discussion
A key insight of this work is the impact of the activation function on the loss landscape. By visualizing the output landscapes of deep networks, we observe that Serf produces a significantly smoother "hill-and-valley" structure compared to the jagged transitions seen with ReLU.
Furthermore, ablation studies demonstrate that Serf is highly robust to variations in hyperparameters. It maintains superior performance even when subjected to high dropout rates, different weight initializers, or extreme network depths (up to 25 layers), validating its compatibility with complex modern training regimes.
Conclusion and Future Work
Serf represents a significant step forward in activation function design, offering a smoother and more regularized optimization path than existing standards. While computationally more intensive than ReLU, its performance gains on deep architectures are substantial. Future research will focus on developing a computationally efficient "Hard-Serf" variant for edge devices and exploring parameterized versions of the function to allow for dynamic shape tuning during training.
Summary updated