In standard deep learning practice, activation functions like ReLU, sigmoid, or tanh are often treated as architectural heuristics—mathematical "knobs" chosen because they prevent gradient vanishing or are computationally efficient. However, a growing body of research suggests these nonlinearities are not arbitrary. Instead, they are the natural mathematical consequences of performing statistical inference within specific probabilistic models.
By viewing a neural network not as a deterministic function, but as a system for estimating latent variables, we can derive our favorite activation functions from first principles.
The Expectation of Latent Variables
The most intuitive way to bridge the gap between probability and neural networks is to view the output of a neuron as the expected value of a hidden random variable.
In Generative learning for deep networks, Alexander Shekhovtsov and Boris Flach demonstrate that the logistic sigmoid and hyperbolic tangent functions are not just convenient "S-curves." They are the exact mathematical results of calculating the expectations of binary random variables in a layered graphical model. When we pass a signal through a sigmoid, we are essentially performing a "soft" count of an underlying Bernoulli process.
This perspective extends to the most popular nonlinearity in modern AI: the Rectified Linear Unit (ReLU). Qinliang Su and Lawrence Carin show in Unsupervised Learning with Truncated Gaussian Graphical Models that the ReLU is a smooth approximation of the conditional expectation of a truncated Gaussian variable. If you assume your hidden features are normally distributed but restricted to be positive, the "math" of that assumption naturally produces a ReLU-like response.
Activations as Inverse Link Functions
If neurons are performing inference, then the choice of activation function should depend on the type of data the network is trying to model. This connects deep learning to the classical theory of Generalized Linear Models (GLMs).
In GLMs, a "link function" connects the linear predictor to the mean of a distribution. Bahareh Tolooshams and colleagues argue in Convolutional dictionary learning based auto-encoders for natural exponential-family distributions that we should choose activations based on the Natural Exponential Family.
For example:
- If you are modeling count data, a Poisson assumption leads to an exponential activation.
- If you are modeling binary events, a Bernoulli assumption leads to a sigmoid activation.
By aligning the activation function with the data's underlying statistical distribution, researchers can create "Deep Convolutional Exponential-family Auto-encoders" (DCEA) that are more parameter-efficient and statistically grounded than standard black-box models.
The Geometry of Hard and Soft Inference
Why do some networks use "hard" activations (like ReLU) while others use "soft" ones (like Sigmoid or Swish)? Randall Balestriero and Richard Baraniuk provide a unifying answer through the lens of Vector Quantization (VQ).
In From Hard to Soft: Understanding Deep Network Nonlinearities via Vector Quantization and Statistical Inference, they show that neural networks can be viewed as performing inference in a Gaussian Mixture Model (GMM). In this framework:
- Hard Inference: If the network makes a "winner-take-all" assignment (Maximum A Posteriori) to the nearest cluster, the resulting mapping is piecewise linear, exactly like a ReLU network.
- Soft Inference: If the network maintains a probability distribution over all possible clusters, the resulting mapping is smooth, recovering functions like Sigmoid or Softmax.
This suggests that the "menagerie" of nonlinearities used in deep learning are simply different ways of partitioning the input space into regions.
Unifying the Menagerie
The most powerful aspect of this research direction is its ability to unify disparate concepts. Qinliang Su and his co-authors demonstrate in A Probabilistic Framework for Nonlinearities in Stochastic Neural Networks that ReLU, sigmoid, and tanh can all be derived from a single doubly truncated Gaussian distribution. By simply changing the boundaries of where the Gaussian is cut off, the network can "learn" which nonlinearity is most appropriate for the task.
Similarly, Russell Tsuchida and Cheng Soon Ong show in Deep equilibrium models as estimators for continuous latent variables that activations emerge analytically from the log-partition functions of exponential families. This provides a "bottom-up" justification for deep learning: the architecture we use is often the only one that makes sense if we believe our data follows certain fundamental laws of probability.