Manuscript Offprint
arXiv:2610.29875Stochastic Nonlinearities Improve Uncertainty Estimation
Abstract
Reliable uncertainty estimation is important across visual recognition tasks, providing information about the confidence and reliability of model predictions. Many uncertainty estimation methods obtain predictive diversity through mechanisms that can suppress intermediate features, perturb the input, or require substantial additional computation. Stochastic activation functions, where network units randomly select between multiple nonlinearities during a forward pass, have previously been used to improve optimization behavior, mitigate limitations of fixed ReLU activations, and increase output diversity. In this work, we reframe stochastic activation switching as a lightweight mechanism for uncertainty estimation. The proposed method samples between nonlinear activation functions, inducing predictive diversity while keeping intermediate feature pathways active. This enables uncertainty estimation from a single trained model without the training cost of ensembles, task-specific uncertainty heads, or architectural redesign. We evaluate the proposed approach across classification, semantic segmentation, and out-of-distribution detection using convolutional and transformer-based architectures on diverse datasets. Across these settings, stochastic activation switching improves uncertainty quality while preserving competitive primary-task performance, showing that stochastic nonlinearities provide an effective and information-preserving source of predictive variation for visual recognition.
Introduction
Deep neural networks (DNNs) [☐] have driven major advances in computer vision, achieving state-of-the-art performance across image classification [☐], object detection [☐], semantic segmentation, and dense prediction tasks [☐, ☐]. Despite this progress, vision models frequently produce overconfident and poorly calibrated predictions [☐], even when confronted with ambiguous inputs, corrupted samples, or out-of-distribution data [☐]. This inability to reliably “know what it does not know” remains an obstacle to deploying deep learning systems in real-world visual recognition pipelines, where overconfident errors can lead to unreliable downstream decisions. Uncertainty estimation addresses this limitation by augmenting predictions with confidence measures that help identify unreliable outputs [☐].
© 2026. The copyright of this document resides with its authors. It may be distributed unchanged freely in print or electronic forms.

Figure 1: Uncertainty from stochastic nonlinearities. Stochastic forward passes are shown for a network trained to predict road maps. Clear roads produce similar outputs and low variance, while ambiguous roads and road-like buildings produce higher variance.
However, obtaining uncertainty estimates that are accurate, well-calibrated, computationally efficient, and compatible with modern architectures remains a challenging problem .
A common strategy for uncertainty estimation is to generate multiple predictions for the same input and measure their disagreement. Deep ensembles achieve this by training multiple independent models and are often considered a strong baseline for predictive uncertainty. However, training and storing multiple models is computationally expensive. Single-model alternatives such as Monte Carlo dropout reduce this cost by injecting stochasticity into the network during inference. Nevertheless, dropout-based methods obtain diversity by randomly suppressing features, which can disrupt information flow and degrade the intermediate representations required for accurate classification or dense prediction. This trade-off motivates the need for uncertainty estimation mechanisms that can induce predictive diversity without disrupting learned feature representations.
Stochastic activation functions have previously been explored as a means to improve gradient flow, introduce regularization, and increase predictive diversity in deep networks. Instead of using a fixed nonlinearity for each neuron or layer, stochastic activation methods allow activation units to randomly select from a predefined set of nonlinear functions during each forward pass. Prior work has used this randomness to improve robustness, alleviate the dead-unit problem, and encourage more diverse network behavior . However, these methods have primarily been studied from the perspective of optimization and regularization, rather than a mechanism for uncertainty estimation.
In this work, we reframe stochastic activation functions as a mechanism for uncertainty quantification. Our main observation is that stochastic switching of nonlinearities can introduce useful predictive variation while preserving the flow of information through the network. Rather than removing features, the method keeps intermediate representations available and perturbs the nonlinear transformation applied to them. As a result, a single trained model can produce multiple plausible outputs without discarding intermediate information.
(Fig. 1). This property is particularly relevant for image classification and semantic segmentation, where preserving semantic and spatial structure is important for reliable predictions.
We propose a simple framework for uncertainty estimation based on stochastic activation switching. The method does not require training multiple models or substantially redesigning the underlying architecture. In our experiments, we apply it to both convolutional networks and transformer-based vision models to evaluate its applicability across different model classes. At inference time, repeated stochastic forward passes produce a distribution of predictions from a single set of learned weights, enabling uncertainty to be estimated from predictive disagreement. Because the stochasticity is introduced through activation selection rather than feature removal, the proposed approach provides an efficient alternative to feature-masking methods while avoiding the computational burden of explicit ensembles.
We evaluate the framework on classification and segmentation across diverse datasets, modalities, scales, and in- and out-of-distribution settings. We compare against common uncertainty baselines and analyze task performance and uncertainty quality, with ablations on stochastic activation and inference settings. Results show competitive predictive performance and strong uncertainty estimates from a single trained model.
The main contributions of this work are as follows: (i) We propose stochastic nonlinearities as a computationally efficient and information-preserving approach for uncertainty estimation in image classification and semantic segmentation. (ii) We show that the proposed single-model approach achieves competitive uncertainty calibration and predictive performance compared with commonly used uncertainty estimation baselines, while avoiding the cost of training multiple models. (iii) We conduct extensive experiments and ablation across small, medium, and large-scale datasets, different visual modalities, convolutional and transformer-family architectures, and both in-distribution and out-of-distribution settings.
2.1 Uncertainty Estimation
Bayesian Neural Networks (BNNs) [4] model epistemic uncertainty through posterior distributions over network parameters, but approximate Bayesian inference is costly at scale. Laplace approximations [10] reduce this cost by approximating the posterior around a trained solution, though performance depends on the quality of the approximation and curvature estimate. Lightweight probabilistic networks [21] instead propagate activation uncertainty using assumed density filtering, offering a more efficient alternative but relying on approximate distributional assumptions.
Monte Carlo Dropout (MC Dropout) [19] estimates uncertainty by keeping dropout active during inference and aggregating stochastic predictions. Although simple, lightweight, and model-agnostic [69], it obtains diversity by randomly suppressing features, so each stochastic pass discards part of the learned representation rather than transforming the same information differently. Variants such as MC-DropConnect [15], which stochastically masks network weights, Concrete Dropout [20], which learns dropout rates, and R-drop [63], which uses auxiliary regularization, have also been proposed, but their uncertainty still comes from removing information rather than preserving and transforming it.
Deep Ensembles [64] estimate uncertainty from disagreement among multiple independently trained networks. While effective, their diversity comes at the cost of repeated training, storage, and inference, with the computational burden typically scaling with the number of ensemble members. Efficiency-driven alternatives reduce this overhead by using fixed partially overlapping masks as in Masksembles [☐], training checkpoints [☐], low-rank parameter sharing [☐], or multi-branch architectures [☐], but fully independent ensembles often remain stronger in calibration and reliability [☐].
Deterministic single-forward-pass methods provide an alternative that avoids repeated stochastic inference, including DUQ and SNGP . More recently, Deep Deterministic Uncertainty (DDU) combines a regularized feature representation with post-hoc density estimation to obtain uncertainty from a single deterministic forward pass. Although these methods offer low inference cost, their uncertainty depends on the learned feature geometry and the assumptions of the distance based estimator.
Other single-model methods estimate uncertainty through input or model perturbations at inference time. Test-time augmentation (TTA) uses transformed inputs, but requires manually chosen augmentations and repeated inference. Monte Carlo Batch Normalization samples stochastic batch-normalization statistics, while iterative methods use repeated refinement or convergence behavior. HCM provides a sampling-free alternative based on hyperspherical confidence, but depends on its geometric formulation and optimization. These methods reduce the need for independently trained ensembles, but rely on input transformations, normalization noise, iterative refinement, or geometric constraints.
2.2 Stochastic activations
Stochastic activations have traditionally been used for regularization, optimization, and, in recent work, generative diversity. Early forms, such as dropout , can be interpreted as stochastic activation mechanisms that prevent co-adaptation of features. For optimization, methods such as those proposed by address specific pathologies in ReLU networks, including the “dying ReLU” phenomenon , by injecting controlled randomness to preserve gradient flow in saturated regions and improve convergence stability.
Recent studies, including and others exploring noise injection and adaptive activations , explored stochastic activations primarily to enhance training dynamics, sparsity, and runtime adaptability. These methods switch between activation functions to improve optimization efficiency and occasionally preserve stochasticity during inference for improved generative behavior. In language and generative modeling, Lomeli et al. demonstrated that such test-time stochasticity can serve as an alternative to temperature sampling for increasing output diversity.
A related activation-based approach, Random Activation Functions (RAF) , uses activation-function diversity for uncertainty estimation through an ensemble of independently trained models, each assigned a randomly selected activation function that remains fixed within that model. Predictive uncertainty is estimated from disagreement across the ensemble members. In contrast, our method dynamically samples activation choices within a single model during both training and inference. Our work therefore leverages stochastic activations explicitly for uncertainty estimation. By maintaining activation stochasticity during inference, a single model can generate a functionally diverse set of predictions, providing a measure of combined predictive uncertainty without feature masking or architectural duplication. Similar to MC-Dropout, this uncertainty is derived from disagreement across repeated stochastic forward passes and is not explicitly decomposed into separate epistemic and aleatoric components. This reframes stochastic activations not only as a training mechanism, but also as an efficient, information-preserving path to reliable uncertainty estimation.
3 Method
3.1 Motivation
As discussed in the previous sections, existing uncertainty estimation methods often obtain predictive diversity by either suppressing features, training multiple models, perturbing the input, or introducing additional inference procedures. These choices can make uncertainty estimation less information-preserving, computationally expensive, or dependent on design choices that must be tuned for each architecture and dataset. Our goal is to obtain diverse predictions from a single trained model without removing intermediate features, duplicating the network, or introducing additional trainable parameters.
We achieve this by replacing deterministic activation functions with stochastic nonlinearities. Instead of assigning a fixed activation function to each unit, the network randomly switches between the backbone's original activation and an alternative nonlinearity during each forward pass. The model is trained with the same stochastic mechanism used at inference time, so the learned weights become robust to activation-level variation rather than treating it as a test-time perturbation only. At test time, the weights are kept fixed and multiple stochastic forward passes are performed through the same model. The resulting prediction variability is then used to estimate uncertainty.
This formulation introduces diversity through transformations rather than feature removal. Every activation pathway remains active, and stochasticity only changes how the intermediate signal is transformed. As illustrated in Fig. 2, this leads to more structured uncertainty than feature masking when stochasticity is increased at inference time. Therefore, the network can sample different functional behaviors while preserving the information carried by its features. The method does not require model-specific uncertainty heads, additional learnable parameters, or repeated model training, making it simple to apply across different classification and segmentation architectures.
3.2 Stochastic Activation Switching
Let denote a neural network with parameters . In a standard deterministic network, each pre-activation at unit in layer is passed through a fixed activation function chosen by the backbone architecture. We replace this fixed choice with a stochastic activation switch. During each stochastic forward pass , the unit applies either the original activation of the backbone, denoted by , or an alternative nonlinearity :
Equivalently, let denote the binary activation-switching variable. Then Eq. 1 can be written as
Here, controls the probability of switching away from the backbone activation. In our experiments, is the native activation used by the architecture, such as ReLU in convolutional networks or GELU in transformer-family models, while is chosen as an alternative
Prediction
Uncertainty Maps

Stochastic Activation
MC-Dropout
Figure 2: Uncertainty quality under test-time stress. The left panel shows the input, prediction, ground truth, and errors; the right panels compare uncertainty maps from stochastic activation switching and MC Dropout, with brighter values indicating higher uncertainty. We increase stochasticity only at inference time to examine its effect on uncertainty. MC Dropout removes intermediate features, causing uncertainty to spread broadly, whereas stochastic activation switching keeps feature pathways active and concentrates uncertainty near boundaries and prediction errors. This supports our motivation that activation-level stochasticity can induce predictive diversity without disrupting intermediate representations.
differentiable nonlinearity. Unless otherwise stated, we use p = 0.5, corresponding to uniform switching between the two nonlinearities. This choice maximizes the entropy of the Bernoulli activation selection, giving both activation pathways equal probability and avoiding a systematic preference for either nonlinearity.
The sampling operation can be applied at different levels of granularity, leading to different forms of functional diversity:
• Node-level: The most granular approach, where a unique activation is sampled for each individual activation unit j in layer l.
• Channel-level: A strategy primarily for convolutional networks, where a single activation is sampled for each channel c in layer l and shared across all spatial locations within that channel.
• Layer-level: The coarsest strategy, where one activation is sampled for the entire layer l and applied to all units in that layer.
Regardless of the sampling granularity, each stochastic forward pass defines a different activation pathway through the same trained weights. For an input x, the t-th pass produces:
where denotes the sampled activation configuration used during that pass. Over T stochastic passes, the model generates a sequence of predictions

Figure 3: Toy regression under heteroscedastic noise. A 3-layer MLP is trained on noisy sinusoidal samples, and stochastic activation switching is compared with MC-Dropout under the same setup. Both methods use repeated stochastic passes. Our method shows clearer combined predictive uncertainty, remaining more certain in well-supported regions while uncertainty increases with stronger noise and outside the observed range.
all produced by the same parameters but different activation pathways. We refer to this sequence as a stochastic activation trajectory.
Figure 3 provides an intuitive example of this behavior in a toy regression setting with heteroscedastic noise. Compared with MC-Dropout, our stochastic activation trajectories remain more stable where the data are well supported, while their variation increases in noisier regions and outside the training range.
3.3 Training and Uncertainty Estimation
Training follows the standard supervised learning procedure for the target task. Given an input–label pair , the model performs a stochastic forward pass using activation choices sampled according to Eq. 1. The network parameters are optimized using the task loss:
where denotes the sampled activation configuration for forward pass t. No additional uncertainty objective, auxiliary head, or architecture-specific parameter is introduced. The same stochastic activation mechanism is used during training and inference, but the weights are updated only during training.
At inference time, the learned weights are fixed. For an input , we perform stochastic forward passes by repeatedly sampling activation configurations. Each pass produces a probability prediction , where denotes class probabilities for classification or pixel-wise class probabilities for segmentation. At inference time, the final prediction and uncertainty are computed as
Here, is used as the final prediction, and denotes the empirical variance across stochastic predictions. For classification, this variance is computed over class probabilities. For segmentation, it is computed at each pixel, producing a spatial uncertainty map. High uncertainty indicates that different stochastic activation configurations lead to inconsistent predictions, while low uncertainty indicates stable predictions across activation choices.
To analyze whether the stochastic mechanism preserves information more effectively than feature-masking approaches, we introduce Information Destruction Rate (IDR) as a diagnostic measure. IDR is not used as a training objective; it is used only to compare the effect of inference-time stochasticity on feature representations. Let denote the estimated mutual information [6] between the input and output of layer l under the deterministic forward pass. For stochastic pass t, let be the corresponding mutual-information estimate under stochastic inference. We define
Lower IDR indicates that stochastic inference preserves more of the deterministic layer-wise input–output information. We use this analysis to compare stochastic activation switching with feature-masking baselines such as MC Dropout [19], where uncertainty is induced by removing activations rather than transforming them.
4 Experiments
4.1 Experimental Setup
We evaluate the proposed stochastic activation switching framework across image segmentation and image classification tasks. The experiments are designed to test whether the method provides reliable uncertainty estimates while maintaining competitive task performance across different domains, architectures, and distribution shifts. For fair comparison, all methods are trained and evaluated using the same dataset splits, input resolution, batch size, preprocessing, augmentation pipeline, backbone architecture, and optimization schedule within each task, unless a baseline requires its standard uncertainty-specific modification.
Baselines. We compare against MC Dropout [19], DDU [17], TTA [60], Laplace Redux [10], Masksembles [13], Deep Ensembles [64], and, for segmentation, an Iterative Network baseline. MC Dropout, TTA, Masksembles, and our method are single-model multi-pass methods, while Laplace Redux applies a post-hoc posterior approximation to a trained model and DDU applies post-hoc density estimation to learned features. Deep Ensembles require five independently trained models, Masksembles uses five fixed masks, and the Iterative baseline uses three refinement iterations [14]. Unless otherwise stated, our method and MC Dropout use five stochastic forward passes, TTA uses five augmented inference samples. For Laplace Redux, we follow the sampling configuration appropriate to each dataset and backbone. We report relative training and inference cost where appropriate.
Datasets. For segmentation, we use Massachusetts Roads [4], DRIVE [5], CREMI [6], and LiTS [8], with RoadTracer [9], CHASE-DB1 [10], and ISBI 2012 [6] used for cross-dataset OOD evaluation. For classification, we use CIFAR-10 [11], MiniImageNet [12], BloodMNIST, and PathMNIST [13, 14], with SVHN [15] and CIFAR-100 [16] used as OOD datasets for CIFAR-10 and MiniImageNet, respectively. , and BloodMNIST and PathMNIST used as cross-domain OOD sets for each other.

Figure 4: Visualization of our stochastic activation based uncertainty estimation. From left to right: input image, ground-truth mask, model prediction, and the uncertainty map computed from the variance across 5 stochastic activation trajectories.
Backbones. For segmentation, we use U-Net-based architectures [☐] for Massachusetts Roads, DRIVE, and LiTS, and SwinTransformer V2 [☐, ☐] for CREMI. For classification, we use ResNet-style convolutional backbones for CIFAR-10, and MiniImageNet. For high-resolution MedMNIST classification, we use SwinTransformer V2 [☐, ☐]. In all cases, our method keeps the same backbone as the corresponding baseline and only replaces deterministic activations with stochastic activation switching. Unless otherwise stated, stochasticity is applied at the node level, as this provides the best overall trade-off in our granularity ablation, as shown in Section 5. For segmentation experiments, we switch between the backbone's native activation and Tanh, while for classification experiments we use the backbone's native activation and SiLU [☐], following the activation-choice ablation.
Metrics. For segmentation, we report F1 and structural overlap metrics: Correctness, Completeness, and Quality (CCQ) [☐], together with Pearson correlation between uncertainty and prediction error, expected calibration error (ECE) [☐], and Brier score [☐]. Segmentation OOD detection uses ROC-AUC and PR-AUC. For classification, we report accuracy, ECE, Brier score, and OOD metrics AUC, AUPR, and FPR95 [☐]. Classification directly yields one image-level uncertainty score, while for segmentation we spatially average the pixel-wise uncertainty map to obtain one score per image. OOD metrics are computed from these image-level scores. For segmentation and CIFAR-10 classification, we report mean ± standard deviation over three random seeds.
4.2 Results
Segmentation Tables 1 and 2 show that stochastic activation switching achieves best or second-best results in most task and uncertainty metrics while retaining the original architecture and single-model training setup. Table 1 shows strong segmentation performance on both thin structures such as roads and vessels and more complex biomedical settings.
This indicates that activation-level stochasticity can support uncertainty estimation while retaining strong spatial representations for dense prediction. Table 2 shows that the resulting uncertainty aligns well with prediction errors, with strong calibration and Brier scores.
| Dataset | Method | Correct. (↑) | Complete. (↑) | Qual. (↑) | F1 (↑) |
|---|---|---|---|---|---|
| Massachusetts | MC Dropout | 91.00 | 87.20 | 81.90 | 78.62 |
| DDU | 91.44 | 86.10 | 80.52 | 79.23 | |
| TTA | 91.46 | 86.73 | 81.19 | 79.43 | |
| Masksembles | 81.63 | 87.67 | 81.94 | 80.02 | |
| Deep Ensemble | 92.37 | 88.11 | 82.67 | 80.54 | |
| Laplace Redux | 91.45 | 86.11 | 80.52 | 79.23 | |
| Iterative | 90.07 | 84.97 | 78.39 | 78.58 | |
| Ours | 91.88±0.43 | 88.24±0.38 | 82.11±0.65 | 79.71±0.16 | |
| DRIVE | MC Dropout | 96.18 | 85.13 | 82.53 | 79.41 |
| DDU | 96.13 | 85.83 | 82.86 | 80.81 | |
| TTA | 95.45 | 84.41 | 82.29 | 79.98 | |
| Masksembles | 96.82 | 85.11 | 82.69 | 81.02 | |
| Deep Ensemble | 97.28 | 85.84 | 83.72 | 81.84 | |
| Laplace Redux | 96.21 | 84.54 | 82.81 | 77.56 | |
| Iterative | 96.86 | 82.61 | 81.87 | 80.30 | |
| Ours | 98.38±0.84 | 85.61±0.48 | 82.91±0.53 | 81.00±0.28 | |
| LiTS | MC Dropout | 87.09 | 71.06 | 65.82 | 96.41 |
| DDU | 87.45 | 78.82 | 69.73 | 97.02 | |
| TTA | 72.04 | 64.01 | 58.73 | 93.87 | |
| Masksembles | 88.27 | 77.83 | 70.75 | 98.01 | |
| Deep Ensemble | 87.59 | 81.38 | 72.84 | 98.25 | |
| Laplace Redux | 87.27 | 80.40 | 71.43 | 97.51 | |
| Iterative | 87.98 | 74.55 | 70.26 | 97.39 | |
| Ours | 89.39±0.44 | 79.57±0.35 | 72.93±0.59 | 98.11±0.10 | |
| CREMI | MC Dropout | 97.40 | 94.45 | 92.68 | 78.58 |
| DDU | 96.41 | 94.76 | 93.16 | 79.48 | |
| TTA | 97.04 | 94.65 | 92.63 | 76.23 | |
| Masksembles | 96.90 | 95.01 | 93.56 | 81.76 | |
| Deep Ensemble | 97.24 | 95.83 | 93.93 | 79.92 | |
| Laplace Redux | 97.26 | 95.62 | 93.76 | 79.58 | |
| Iterative | 96.02 | 87.90 | 87.19 | 65.73 | |
| Ours | 98.47±0.55 | 96.61±0.43 | 94.76±0.71 | 81.94±0.11 |
Table 1: Segmentation performance across aerial and medical benchmarks.
Together with Table 1, these results show improved uncertainty quality without sacrificing segmentation performance or introducing task-specific uncertainty modules.
For OOD evaluation, models trained on Massachusetts, DRIVE, and CREMI are tested on RoadTracer, CHASE-DB1, and ISBI 2012, respectively. Table 3 shows that disagreement between stochastic activation trajectories remains informative under distribution shift.
Classification. We evaluate classification uncertainty on natural and medical benchmarks. Table 4 reports classification performance and OOD detection. The results show
| Dataset | Method | Corr. (↑) | ECE (↓) | Brier (↓) | Train | Infer |
|---|---|---|---|---|---|---|
| Massachusetts | MC Dropout | 79.73 | 0.026 | 0.033 | ×1 | ×5 |
| DDU | 75.64 | 0.027 | 0.031 | ×1 | - | |
| TTA | 79.90 | 0.025 | 0.029 | ×1 | ×5 | |
| Masksembles | 79.62 | 0.024 | 0.031 | ×1 | ×5 | |
| Deep Ensemble | 80.03 | 0.024 | 0.027 | ×5 | ×5 | |
| Laplace Redux | 77.51 | 0.034 | 0.034 | ×1 | - | |
| Iterative | 77.28 | 0.028 | 0.030 | ×3 | ×3 | |
| Ours | 80.38±1.08 | 0.020±0.002 | 0.025±0.006 | ×1 | ×5 | |
| DRIVE | MC Dropout | 80.58 | 0.032 | 0.040 | ×1 | ×5 |
| DDU | 80.45 | 0.031 | 0.034 | ×1 | - | |
| TTA | 83.00 | 0.058 | 0.031 | ×1 | ×5 | |
| Masksembles | 81.06 | 0.029 | 0.035 | ×1 | ×5 | |
| Deep Ensemble | 81.72 | 0.017 | 0.031 | ×5 | ×5 | |
| Laplace Redux | 79.56 | 0.086 | 0.043 | ×1 | - | |
| Iterative | 79.91 | 0.024 | 0.035 | ×3 | ×3 | |
| Ours | 81.80±1.43 | 0.015±0.001 | 0.029±0.007 | ×1 | ×5 | |
| LiTS | MC Dropout | 52.28 | 0.004 | 0.003 | ×1 | ×5 |
| DDU | 52.55 | 0.004 | 0.003 | ×1 | - | |
| TTA | 52.41 | 0.004 | 0.003 | ×1 | ×5 | |
| Masksembles | 52.80 | 0.001 | 0.003 | ×1 | ×5 | |
| Deep Ensemble | 53.30 | 0.001 | 0.001 | ×5 | ×5 | |
| Laplace Redux | 52.35 | 0.003 | 0.003 | ×1 | - | |
| Iterative | 53.34 | 0.002 | 0.002 | ×3 | ×3 | |
| Ours | 54.22±0.64 | 0.001±0.000 | 0.002±0.000 | ×1 | ×5 | |
| CREMI | MC Dropout | 37.23 | 0.035 | 0.017 | ×1 | ×5 |
| DDU | 34.12 | 0.016 | 0.018 | ×1 | - | |
| TTA | 38.70 | 0.011 | 0.016 | ×1 | ×5 | |
| Masksembles | 36.97 | 0.014 | 0.017 | ×1 | ×5 | |
| Deep Ensemble | 38.49 | 0.009 | 0.014 | ×5 | ×5 | |
| Laplace Redux | 35.47 | 0.011 | 0.015 | ×1 | - | |
| Iterative | 39.48 | 0.050 | 0.023 | ×3 | ×3 | |
| Ours | 42.58±1.80 | 0.004±0.002 | 0.009±0.004 | ×1 | ×5 |
Table 2: Segmentation uncertainty, calibration, and relative computational cost.
that stochastic activation switching improves uncertainty behavior while maintaining strong classification performance. On the natural-image benchmarks, the method achieves strong calibration and OOD detection; on MiniImageNet, however, its classification accuracy is lower than Deep Ensembles (66.90 vs. 70.50), despite better calibration and OOD detection metrics. On high-resolution medical benchmarks, method transfers to Swin Transformer V2, maintaining high in-distribution accuracy while improving cross-domain OOD separation.
| Method | Mass. → RoadTracer | DRIVE → CHASE | CREMI → ISBI | |||
|---|---|---|---|---|---|---|
| AUROC (↑) | AUPR (↑) | AUROC (↑) | AUPR (↑) | AUROC (↑) | AUPR (↑) | |
| MC Dropout | 53.07 | 48.51 | 82.21 | 53.07 | 87.34 | 94.64 |
| DDU | 54.63 | 52.54 | 85.99 | 61.77 | 88.79 | 94.82 |
| TTA | 55.05 | 56.62 | 89.94 | 67.31 | 93.10 | 94.88 |
| Masksembles | 54.00 | 51.91 | 86.35 | 64.51 | 87.72 | 94.14 |
| Deep Ensemble | 57.32 | 57.85 | 89.56 | 66.33 | 85.73 | 94.69 |
| Laplace Redux | 52.82 | 52.04 | 86.46 | 57.90 | 88.68 | 94.77 |
| Iterative | 57.04 | 49.68 | 83.23 | 57.32 | 88.46 | 94.53 |
| Ours | 56.74±0.71 | 56.00±1.36 | 90.52±0.47 | 66.31±0.19 | 95.43±0.24 | 95.68±0.30 |
Table 3: Cross-dataset segmentation OOD detection.
| Dataset | Method | Acc (↑) | ECE (↓) | Brier (↓) | AUC (↑) | AUPR (↑) | FPR95 (↓) |
|---|---|---|---|---|---|---|---|
| CIFAR-10 | MC Dropout | 93.54 | 0.011 | 0.094 | 84.22 | 87.36 | 27.10 |
| DDU | 94.12 | 0.018 | 0.090 | 85.20 | 89.26 | 24.11 | |
| TTA | 94.23 | 0.011 | 0.083 | 93.64 | 97.29 | 17.97 | |
| Masksembles | 94.61 | 0.011 | 0.080 | 91.69 | 92.88 | 18.47 | |
| Deep Ensemble | 94.94 | 0.009 | 0.074 | 91.92 | 93.15 | 14.70 | |
| Laplace Redux | 93.83 | 0.090 | 0.103 | 92.60 | 94.98 | 18.83 | |
| Ours | 94.59±0.31 | 0.009±0.001 | 0.083±0.005 | 95.14±0.22 | 97.54±0.35 | 16.36±0.29 | |
| MiniImageNet | MC Dropout | 64.70 | 0.067 | 0.212 | 81.57 | 86.96 | 53.94 |
| DDU | 65.83 | 0.050 | 0.191 | 84.21 | 88.49 | 49.85 | |
| TTA | 68.52 | 0.044 | 0.171 | 79.10 | 84.41 | 54.28 | |
| Masksembles | 66.24 | 0.048 | 0.194 | 83.52 | 88.06 | 48.35 | |
| Deep Ensemble | 70.50 | 0.039 | 0.187 | 84.13 | 89.20 | 47.98 | |
| Laplace Redux | 64.48 | 0.052 | 0.215 | 80.39 | 86.14 | 54.55 | |
| Ours | 66.90 | 0.031 | 0.178 | 86.42 | 90.66 | 45.24 | |
| BloodMNIST | MC Dropout | 98.42 | 0.008 | 0.027 | 93.81 | 96.12 | 22.36 |
| DDU | 98.52 | 0.009 | 0.023 | 98.42 | 98.86 | 9.38 | |
| TTA | 98.60 | 0.010 | 0.030 | 98.43 | 99.09 | 6.40 | |
| Masksembles | 98.40 | 0.010 | 0.025 | 98.74 | 99.11 | 7.61 | |
| Deep Ensemble | 98.45 | 0.010 | 0.020 | 99.06 | 99.50 | 5.11 | |
| Laplace Redux | 80.35 | 0.011 | 0.029 | 94.23 | 97.16 | 7.61 | |
| Ours | 98.72 | 0.008 | 0.023 | 98.98 | 99.53 | 4.50 | |
| PathMNIST | MC Dropout | 94.14 | 0.034 | 0.096 | 89.43 | 68.70 | 25.15 |
| DDU | 94.53 | 0.041 | 0.094 | 88.39 | 55.97 | 24.52 | |
| TTA | 94.00 | 0.041 | 0.098 | 85.72 | 56.60 | 20.98 | |
| Masksembles | 94.74 | 0.037 | 0.098 | 85.36 | 57.25 | 23.38 | |
| Deep Ensemble | 95.01 | 0.018 | 0.076 | 86.04 | 58.20 | 22.09 | |
| Laplace Redux | 93.77 | 0.045 | 0.111 | 44.68 | 27.51 | 92.09 | |
| Ours | 95.40 | 0.037 | 0.088 | 94.87 | 80.58 | 11.60 |
Table 4: Classification accuracy and OOD detection on natural and medical benchmarks.
Overall. Stochastic activations improves uncertainty quality while maintaining competitive task performance across most settings, with MiniImageNet the main exception in. The method performs well across visual domains and architectures, including U-Net, ResNet-style classifiers, and Swin Transformer V2. These results support the main claim that useful predictive diversity can be obtained from a single trained model without changing the input, adding an uncertainty head, redesigning the architecture, or training multiple models.
5 Ablation Study
We analyze how the main design choices of stochastic activation switching affect model behavior. All ablations are conducted on CIFAR-10 with the same ResNet-style backbone and training protocol. We study four aspects: stochasticity granularity, the activation pair, information preservation, and inference-pass count. These analyses explain not only whether the method works, but also why local activation-level stochasticity provides predictive diversity without substantially disrupting the learned representation.
Granularity of Stochasticity. We compare layer-level, channel-level, and node-level stochastic activation sampling. Layer-level sampling shares one activation choice across an entire layer, channel-level sampling shares one choice within each feature channel, and node-level sampling independently samples the activation at each unit. As shown in Table 5, although layer-level stochasticity gives the lowest ECE, node-level sampling provides the strongest overall trade-off across predictive performance and uncertainty quality, improving accuracy, NLL [4], and Brier score. This indicates that injecting stochasticity at the most local scale creates richer functional diversity inside the network. This micro-level variation improves predictive uncertainty estimation while reducing local activation co-adaptation.
| Granularity | Acc. (↑) | NLL (↓) | ECE (↓) | Brier (↓) |
|---|---|---|---|---|
| Layer-level | 93.04 | 0.204 | 0.005 | 0.101 |
| Channel-level | 93.66 | 0.200 | 0.009 | 0.094 |
| Node-level | 94.68 | 0.162 | 0.009 | 0.088 |
Table 5: Ablation on stochastic activation granularity.
Choice of Stochastic Activation. We pair the backbone's native activation with one alternative and ablate this choice in Table 6. ReLU+SiLU gives the best accuracy and NLL, whereas ReLU+Tanh gives the best ECE and Brier, indicating that smoother alternatives favor task performance while stronger nonlinear changes improve calibration. Using more than two candidate activations was less stable, likely due to excessive feature-distribution variation, so we use two-activation switching. We do not tune activations per dataset: SiLU is fixed for classification and Tanh for segmentation across datasets, modalities, and architectures. Other pairs remain competitive, suggesting that per-dataset tuning is unnecessary.
| Activation Pair | Acc. (↑) | NLL (↓) | ECE (↓) | Brier (↓) |
|---|---|---|---|---|
| ReLU + Tanh [5] | 94.43 | 0.176 | 0.008 | 0.085 |
| ReLU + SiLU [7] | 94.68 | 0.162 | 0.009 | 0.088 |
| ReLU + GELU [7] | 94.12 | 0.184 | 0.012 | 0.095 |
| ReLU + Mish [4] | 93.98 | 0.192 | 0.014 | 0.101 |
| ReLU + ELU [8] | 93.67 | 0.206 | 0.018 | 0.109 |
Table 6: Effect of the activation pair used for stochastic switching.
Information Destruction Analysis. Unlike masking-based uncertainty methods, stochastic activation switching perturbs the nonlinear transformation while keeping feature pathways active. As shown in Fig. 5, our method gives lower IDR than MC Dropout across datasets, indicating that stochastic activation switching preserves intermediate representations under stochastic inference. This supports our motivation that predictive diversity can be induced through activation transformations without removing feature information.

Figure 5: IDR comparison across datasets. Lower is better.
Number of inference passes. Finally, we study the effect of the number of stochastic forward passes used at inference time. Increasing makes the predictive mean and uncertainty estimate more stable, but also increases inference time approximately linearly. Table 7 shows that uncertainty metrics improve as more passes are used, while accuracy saturates after a small number of samples. We therefore use in the main experiments, as it provides a practical balance between uncertainty quality and computational cost.
| Passes T | Accuracy (↑) | NLL (↓) | ECE (↓) | Brier (↓) | Time (s) |
|---|---|---|---|---|---|
| 1 | 93.81 | 0.223 | 0.026 | 0.096 | 3.11 |
| 3 | 94.26 | 0.186 | 0.013 | 0.085 | 7.06 |
| 5 | 94.68 | 0.162 | 0.009 | 0.088 | 11.06 |
| 10 | 94.37 | 0.176 | 0.007 | 0.082 | 20.99 |
Table 7: Effect of the number of inference passes on acc, uncertainty quality, and runtime.
6 Conclusion
We reframe stochastic activation switching as an uncertainty estimation mechanism. Instead of relying on feature masking, input perturbations, or explicit ensembles, the method induces predictive diversity by sampling between nonlinear activation functions while keeping intermediate feature pathways active. Across classification, segmentation, and out-of-distribution detection experiments, the proposed approach improves uncertainty quality without degrading the main task performance, and remains effective across different visual domains and architectures. The results show that stochastic nonlinearities can provide a lightweight and information-preserving source of predictive variation from a single trained model, without requiring separate uncertainty heads or task-specific architectural redesign. A limitation is that the activation pair influences the trade-off between predictive performance and calibration, while repeated stochastic passes introduce additional inference cost. Future work can explore adaptive activation selection and more efficient sampling strategies to reduce inference overhead while preserving uncertainty estimation quality.
References
[1] Moloud Abdar, Farhad Pourpanah, Sadiq Hussain, Dana Rezazadegan, Li Liu, Mohammad Ghavamzadeh, Paul Fieguth, Xiaochun Cao, Abbas Khosravi, U Rajendra Acharya, et al. A review of uncertainty quantification in deep learning: Techniques, applications and challenges. Information Fusion, 76:243–297, 2021.
[2] Favyen Bastani, Songtao He, Sofiane Abbar, Mohammad Alizadeh, Hari Balakrishnan, Sanjay Chawla, Sam Madden, and David DeWitt. RoadTracer: Automatic Extraction of Road Networks from Aerial Images. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2018.
[3] Patrick Bilic, Patrick Christ, Hongwei Bran Li, Eugene Vorontsov, Avi Ben-Cohen, Georgios Kaissis, Adi Szeskin, Colin Jacobs, Gabriel Efrain Humpire Mamani, Gabriel Chartrand, et al. The liver tumor segmentation benchmark (lits). Medical Image Analysis, 84:102680, 2023.
[4] Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural network. In International Conference on Machine Learning, 2015.
[5] Glenn W. Brier. Verification of forecasts expressed in terms of probability. Monthly Weather Review, 78(1):1–3, 1950.
[6] Albert Cardona, Stephan Saalfeld, Stephan Preibisch, Benjamin Schmid, Albert Cheng, John Pulokas, Pavel Tomancak, and Volker Hartenstein. An integrated micro- and macroarchitectural analysis of the drosophila brain by computer-assisted serial section electron microscopy. PLoS Biology, 8(10):e1000502, 2010.
[7] Eunseo Choi, Ho-Yeon Kim, Jaewon Lee, Taeyong jo, Myungjun lee, and Heejin Ahn. Uncertainty estimation via hyperspherical confidence mapping. In International Conference on Learning Representations, 2026.
[8] Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). International Conference on Learning Representations, 2016.
[9] Marcos V. Conde, Ui-Jin Choi, Maxime Burchi, and Radu Timofte. Swin2sr: Swinv2 transformer for compressed image super-resolution and restoration. In European Conference on Computer Vision, 2022.
[10] Erik Daxberger, Agustinus Kristiadi, Alexander Immer, Runa Eschenhagen, Matthias Bauer, and Philipp Hennig. Laplace redux-effortless bayesian deep learning. Advances in Neural Information Processing Systems, 2021.
[11] Kingma Diederik. Adam: A method for stochastic optimization. (No Title), 2014.
[12] Fabing Duan, François Chapeau-Blondeau, and Derek Abbott. Optimized injection of noise in activation functions to improve generalization of neural networks. Chaos, Solitons & Fractals, 178:114363, 2024.
[13] Nikita Durasov, Timur Bagautdinov, Pierre Baque, and Pascal Fua. Masksembles for uncertainty estimation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
[14] Nikita Durasov, Doruk Oner, Jonathan Donier, Hieu Le, and Pascal Fua. Enabling uncertainty estimation in iterative neural networks. In International Conference on Machine Learning, 2024.
[15] Stefan Elfwing, Eiji Uchibe, and Kenji Doya. Sigmoid-weighted linear units for neural network function approximation in reinforcement learning. Neural Networks, 107:3–11, 2018.
[16] Durmus Ersoy and Burcu Erkmen. A stochastic computing method for generating activation functions in multilayer feedforward neural networks. Electrica, 21(3):376–387, 2021.
[17] Muhammad Moazam Fraz, Paolo Remagnino, Andreas Hoppe, Bunyarit Uyyanonvara, Alicja R Rudnicka, Christopher G Owen, and Sarah A Barman. An ensemble classification-based approach applied to retinal blood vessel segmentation. IEEE Transactions on Biomedical Engineering, 59(9):2538–2548, 2012.
[18] Jan Funke, Fabian Tschopp, William Grisaitis, Arlo Sheridan, Chandan Singh, Stephan Saalfeld, and Srinivas C Turaga. Large scale image segmentation with structured loss based deep learning for connectome reconstruction. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(7):1669–1680, 2018.
[19] Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In International Conference on Machine Learning, 2016.
[20] Yarin Gal, Jiri Hron, and Alex Kendall. Concrete dropout. Advances in Neural Information Processing Systems, 2017.
[21] Jochen Gast and Stefan Roth. Lightweight probabilistic deep networks. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2018.
[22] Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. The MIT Press, 2016.
[23] Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International Conference on Machine Learning, 2016.
[24] Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks. In International Conference on Machine Learning, 2017.
[25] MM Hammad. Deep learning activation functions: fixed-shape, parametric, adaptive, stochastic, miscellaneous, non-standard, ensemble. arXiv preprint arXiv:2407.11090, 2024.
[26] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
[27] D Hendrycks. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
[28] Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R. Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors, 2012.
[29] Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In International Conference on Learning Representations, 2020.
[30] Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E. Hopcroft, and Kilian Q. Weinberger. Snapshot ensembles: Train 1, get m for free. In International Conference on Learning Representations, 2017.
[31] Alex Kendall and Yarin Gal. What uncertainties do we need in bayesian deep learning for computer vision? In Advances in Neural Information Processing Systems, 2017.
[32] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
[33] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in Neural Information Processing Systems, 25, 2012.
[34] Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in Neural Information Processing Systems, 2017.
[35] Yann LeCun, Léon Bottou, Genevieve B Orr, and Klaus-Robert Müller. Efficient backprop. In Neural Networks: Tricks of the Trade, pages 9–50. Springer, 2002.
[36] Jeremiah Liu, Zi Lin, Shreyas Padhy, Dustin Tran, Tania Bedrax Weiss, and Balaji Lakshminarayanan. Simple and principled uncertainty estimation with deterministic deep learning via distance awareness. In Advances in Neural Information Processing Systems, 2020.
[37] Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, et al. Swin transformer v2: Scaling up capacity and resolution. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022.
[38] Maria Lomeli, Matthijs Douze, Gergely Szilvasy, Loic Cabannes, Jade Copet, Sainbayar Sukhbaatar, Jason Weston, Gabriel Synnaeve, Pierre-Emmanuel Mazaré, and Hervé Jégou. Stochastic activations. arXiv preprint arXiv:2509.22358, 2025.
[39] Antonio Loquercio, Mattia Segu, and Davide Scaramuzza. A general framework for uncertainty estimation in deep learning. IEEE Robotics and Automation Letters, 5(2): 3153–3160, 2020.
[40] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
[41] Andrey Malinin and Mark Gales. Predictive uncertainty estimation via prior networks. In Advances in Neural Information Processing Systems, 2018.
[42] Shervin Minaee, Yuri Boykov, Fatih Porikli, Antonio Plaza, Nasser Kehtarnavaz, and Demetri Terzopoulos. Image segmentation using deep learning: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 44(7):3523–3542, 2021.
[43] Diganta Misra. Mish: A self regularized non-monotonic activation function. In British Machine Vision Conference, 2020.
[44] Volodymyr Mnih. Machine Learning for Aerial Image Labeling. PhD thesis, University of Toronto, 2013.
[45] Aryan Mobiny, Pengyu Yuan, Supratik K Moulik, Naveen Garg, Carol C Wu, and Hien Van Nguyen. Dropconnect is effective in modeling uncertainty of bayesian deep networks. Scientific Reports, 11(1):5458, 2021.
[46] Jishnu Mukhoti, Puneet K. Dokania, Philip Torr, and Yarin Gal. On batch normalisation for approximate bayesian inference. In Third Symposium on Advances in Approximate Bayesian Inference, 2021.
[47] Jishnu Mukhoti, Andreas Kirsch, Joost Van Amersfoort, Philip HS Torr, and Yarin Gal. Deep deterministic uncertainty: A new simple baseline. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023.
[48] Mahdi Pakdaman Naeini, Gregory Cooper, and Milos Hauskrecht. Obtaining well calibrated probabilities using bayesian binning. In AAAI conference on artificial intelligence, 2015.
[49] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Baolin Wu, Andrew Y Ng, et al. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, volume 5, page 7. Granada, 2011.
[50] Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model's uncertainty? evaluating predictive uncertainty under dataset shift. Advances in Neural Information Processing Systems, 2019.
[51] Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. You only look once: Unified, real-time object detection. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2016.
[52] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems, 2015.
[53] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In Medical Image Computing and Computer-Assisted Intervention, 2015.
[54] Joes Staal, Michael D Abràmoff, Meindert Niemeijer, Max A Viergever, and Bram Van Ginneken. Ridge-based vessel segmentation in color images of the retina. IEEE Transactions on Medical Imaging, 23(4):501–509, 2004.
[55] Yana Stoyanova, Soroush Ghandi, and Maryam Tavakol. Toward robust uncertainty estimation with random activation functions. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pages 15152–15160, 2023.
[56] Surat Teerapittayanon, Bradley McDanel, and Hsiang-Tsung Kung. Branchynet: Fast inference via early exiting from deep neural networks. In International Conference on Pattern Recognition, 2016.
[57] Joost Van Amersfoort, Lewis Smith, Yee Whye Teh, and Yarin Gal. Uncertainty estimation using a single deep deterministic neural network. In International Conference on Machine Learning, 2020.
[58] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in Neural Information Processing Systems, 2017.
[59] Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. Advances in Neural Information Processing Systems, 2016.
[60] Guotai Wang, Wenqi Li, Michael Aertsen, Jan Deprest, Sébastien Ourselin, and Tom Vercauteren. Aleatoric uncertainty estimation with test-time augmentation for medical image segmentation with convolutional neural networks. Neurocomputing, 338:34–45, 2019.
[61] Yeming Wen, Dustin Tran, and Jimmy Ba. Batchensemble: an alternative approach to efficient ensemble and lifelong learning. In International Conference on Learning Representations, 2020.
[62] Christian Wiedemann, Christian Heipke, Helmut Mayer, and Olivier Jamet. Empirical evaluation of automatically extracted road axes. Empirical evaluation techniques in computer vision, 12:172–187, 1998.
[63] Lijun Wu, Juntao Li, Yue Wang, Qi Meng, Tao Qin, Wei Chen, Min Zhang, Tie-Yan Liu, et al. R-drop: Regularized dropout for neural networks. Advances in Neural Information Processing Systems, 2021.
[64] Bing Xu, Naiyan Wang, Tianqi Chen, and Mu Li. Empirical evaluation of rectified activations in convolutional network. arXiv preprint arXiv:1505.00853, 2015.
[65] Jiancheng Yang, Rui Shi, and Bingbing Ni. Medmnist classification decathlon: A lightweight automl benchmark for medical image analysis. In IEEE 18th International Symposium on Biomedical Imaging, 2021.
[66] Jiancheng Yang, Rui Shi, Donglai Wei, Zequan Liu, Lin Zhao, Bilian Ke, Hanspeter Pfister, and Bingbing Ni. Medmnist v2-a large-scale lightweight benchmark for 2d and 3d biomedical image classification. Scientific Data, 10(1):41, 2023.
[67] Tal Zeevi, Ravid Shwartz-Ziv, Yann LeCun, Lawrence H Staib, and John A Onofrey. Rate-in: Information-driven adaptive dropout rates for improved inference-time uncertainty estimation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 20757–20766, 2025.
Supplementary Material
A Approach Overview
Stochastic Activation Switching replaces each deterministic activation in the backbone during training and inference with a per-unit Bernoulli switch between the backbone's native activation and a fixed alternative . During training, a fresh activation configuration is sampled at every forward pass, and the network is optimized with the standard task loss, so that the learned weights become robust to activation-level variation rather than to a single fixed nonlinearity. At inference time, the trained weights are kept fixed and T stochastic forward passes are drawn from the same input; the empirical mean of the resulting predictions is used as the point estimate, and the empirical variance across passes is used as the uncertainty estimate. Because every activation pathway remains active in all passes, stochasticity changes only the shape of the nonlinearity applied at each unit, without removing features from the intermediate representation. This perturbation-without-removal property is the qualitative distinction from dropout-style mechanisms [19] and the basis for the uncertainty estimator analyzed in Section C.
B Implementation Details
Activation pair. For classification, we retain the backbone’s native activation as and use . For segmentation, we likewise retain the native activation and use . These fixed task-level choices are used across datasets and architectures, following the activation-choice ablation in Table 6 of the main paper.
Granularity and sampling rate. We use node-level granularity with an independent mask per activation unit and p = 0.5; both choices follow the granularity ablation in Table 5 of the main paper. The choice p = 0.5 maximizes the entropy of the Bernoulli switch, giving both activations equal probability and avoiding a systematic preference for either nonlinearity. Channel- and layer-level variants share a single mask across a channel or an entire layer and are not used in the main results.
Training. Training follows the standard supervised pipeline of the corresponding deterministic baseline for each dataset. The optimizer, learning rate schedule, batch size, augmentation, and number of epochs are kept identical to those of the deterministic backbone. The only modification is that each activation block performs Bernoulli switching at every forward pass during both training and inference.
Inference. At inference time, the trained weights are kept fixed and T = 5 stochastic forward passes are drawn per input, following the inference-pass ablation in Table 7 of the main paper. The empirical mean is used as the prediction, and the empirical variance across the T passes is used as the uncertainty estimate, as defined in Equations (7)–(8) of the main paper.
Backbones. For segmentation, we use a U-Net architecture [5] on Massachusetts [4], DRIVE [64], and LiTS [8], and Swin Transformer V2 [67] on CREMI [6]. For natural-image classification, we use a ResNet-style [26] convolutional backbone on CIFAR-10 [62] and MiniImageNet [59]. For high-resolution medical classification, we use Swin Transformer V2 on BloodMNIST and PathMNIST [66]. In all cases, the backbone matches the corresponding deterministic baseline, and only the activation block is replaced by the stochastic switch.
Datasets and splits. For segmentation, Massachusetts Roads is used with the official train-validation-test split, and RoadTracer [☐] serves as the held-out cross-dataset OOD evaluation set. DRIVE is used with the standard train/test split, and CHASE-DB1 [☐] is used for cross-dataset OOD evaluation. LiTS axial slices are used as 2D inputs. CREMI is used with its published volume split, and ISBI 2012 [☐] is used for cross-dataset OOD evaluation. For classification, CIFAR-10 uses the canonical 50,000/10,000 train/test split, with SVHN [☐] serving as the OOD set. MiniImageNet is split following the standard 600 images per class across 100 classes, with CIFAR-100 used as the OOD set. BloodMNIST and PathMNIST follow the MedMNIST v2 official splits at resolution and are treated as a cross-domain OOD pair for each other.
Augmentation. For segmentation training, inputs are augmented with random crops, random horizontal and vertical flips, and rotations; no augmentation is applied at test time. For natural-image classification, we apply random crops with 4-pixel padding and random horizontal flips. For high-resolution medical classification, we apply random resized crops and horizontal flips. All inputs are channel-normalized using dataset-specific means and standard deviations.
Training hyperparameters. Table 8 summarizes the optimizer, learning rate, batch size, and number of epochs used for each backbone. All models are trained from scratch with the standard supervised cross-entropy loss for classification and a combined soft-Dice plus binary cross-entropy loss for segmentation. The optimizer and schedule are identical for the deterministic baseline and for Stochastic Activation Switching; only the activation block differs.
| Backbone | Dataset | Optimizer | Batch | LR / schedule | Epochs |
|---|---|---|---|---|---|
| U-Net | Massachusetts | Adam [1] | 32 | , cosine | 200 |
| U-Net | DRIVE | Adam | 8 | , cosine | 200 |
| U-Net | LiTS | Adam | 64 | , cosine | 200 |
| Swin-V2 | CREMI | AdamW [10] | 32 | 200 | |
| ResNet-18 | CIFAR-10 | SGD (m=0.9) | 256 | 0.1, cosine | 200 |
| ResNet-50 | MiniImageNet | SGD (m=0.9) | 128 | 0.1, cosine | 200 |
| Swin-V2 | BloodMNIST | AdamW | 128 | 200 | |
| Swin-V2 | PathMNIST | AdamW | 256 | 200 |
Table 8: Per-dataset training hyperparameters used for all methods. Weight decay is for SGD and for AdamW.
Baseline configurations. MC Dropout [1] uses a dropout rate of inserted after each activation block and kept active at inference with stochastic forward passes. DDU [2] applies post-hoc density estimation to features from the trained deterministic backbone. Masksembles [3] uses five fixed partially overlapping masks, producing five predictions at inference. Deep Deep Ensembles [4] are formed from five independently trained models with different random seeds; the prediction is the per-class probability average over members and the uncertainty is the empirical variance across members. Laplace Redux [5] applies a last-layer Laplace approximation to the trained backbone with a diagonal covariance and prior precision tuned on the validation split. Test-Time Augmentation [6] samples five augmented versions of each test input (random crops and horizontal flips for classification; the segmentation augmentation pipeline above for dense prediction) and averages the predictions. The iterative segmentation baseline uses three refinement iterations following the configuration of its released reference implementation.
Compute. All experiments were run with PyTorch on a single NVIDIA H100 GPU. Inference with T = 5 stochastic forward passes increases the per-input inference cost by approximately a factor of five over the deterministic backbone, as reported in Table 7 of the main paper. All results in this work are reported from a single random seed per method, except for the five-member Deep Ensemble baseline.
C Mathematical Analysis of Stochastic Activation Switching
We provide a mathematical characterization of stochastic activation switching. We show that the method defines a well-posed stochastic predictor, derive closed-form conditional moments for a single stochastic activation unit, bound the induced per-unit variance under a bounded activation gap, and analyze the convergence of the empirical Monte Carlo estimators used at inference time.
C.1 Notation and Setup
Fix a neural network with parameters , whose nonlinear blocks contain activation units indexed by layer and unit . Let denote the pre-activation of unit in layer during stochastic forward pass . Let be the original and alternative scalar activation functions. At pass and unit , draw an independent Bernoulli mask
and define the stochastic activation output as
This is the same Bernoulli activation-switching rule used in the main paper. Unless stated otherwise, we analyze the node-level case, where each unit samples its own mask. For channel-level or layer-level sampling, the same mask is shared across a channel or across an entire layer.
In the following derivations, expectations are taken with the current pre-activation fixed. This is important because, in deeper layers, is itself affected by random activation choices made in previous layers. Thus, we first analyze the local randomness caused by the current mask, and full-network expectations can then be obtained by averaging over the upstream randomness as well. For readability, we omit layer and pass indices when the meaning is clear.
C.2 The Stochastic Predictor and Empirical Estimators
Let
denote the collection of all activation-switching masks sampled during stochastic forward pass t. With the trained weights fixed, the output of the network for input x is
Thus, each stochastic pass produces a random prediction only through the sampled activation configuration. If the original and alternative activations differ for at least one unit that affects the output, then different mask samples can produce different predictions. If the two activations are identical, the stochastic predictor reduces to the deterministic network.
Over T stochastic forward passes, the prediction trajectory is
Following the main paper, we estimate the predictive mean and uncertainty by
Here, is the Monte Carlo estimate of the expected prediction, and is the empirical variance across stochastic predictions. Their population counterparts are
which correspond to the ideal mean and variance under infinitely many stochastic activation samples.
C.3 Per-Unit Moments and Bounded Activation Gap
We first analyze the stochasticity introduced at a single activation unit. Conditioned on a fixed pre-activation value z, the only source of randomness is the Bernoulli switching variable m. Thus, the unit output is a two-point random variable: it takes the original activation value with probability 1 - p, and the alternative activation value with probability p.
Lemma C.1 (Unit-wise moments). For any fixed , the stochastic activation output in Equation (8) satisfies
and
Therefore, the per-unit variance is zero whenever the two activation functions produce the same value at z. In other words, stochastic activation switching creates local uncertainty only where the activation pair disagrees.
Proof. Since , we have . Taking expectation in Equation (8) directly gives Equation (12). For the second moment, because , we have . Thus,
Subtracting gives Equation (13).
Lemma C.1 shows that the amount of stochasticity introduced by one unit is controlled by two quantities: the switching probability p, and the gap between the two activation functions at the current pre-activation value. If this activation gap is bounded, then the induced per-unit variance is also bounded.
Theorem C.1 (Bounded noise envelope). Let
If , then for every ,
The upper bound is tight at .
Proof. From Lemma C.1,
By definition of ,
Also, for , we have , with equality at . Combining these two facts proves the result.
Remark C.1 (Per-unit bound only). The bound in Theorem C.1 applies to a single activation unit. It does not directly imply a bound on the full network prediction variance, because per-unit perturbations can be amplified, damped, or combined as they propagate through later layers.
For activation pairs with unbounded global gap, such as ReLU–Tanh, the same argument gives a bound on any bounded pre-activation range. In particular, if , one may replace in Equation (14) by
which is finite whenever the activation functions are finite on the interval.
For some activation pairs, the global gap can be computed explicitly. The following corollary gives this value for the ReLU–SiLU pair, which is used in our classification experiments.
Corollary C.1 (ReLU–SiLU activation-gap constant). Let
Define the gap function
Then
The function is non-positive and even, meaning . Moreover,
(18) where is the unique positive solution of
equivalently,
Proof. For , we have
For , , so
For any a > 0,
so . Thus, the gap is symmetric around zero.
It remains to find the maximum magnitude. For ,
Differentiating gives
Since sigmoid , the stationary point satisfies
This is equivalent to
Solving this equation gives , and therefore
By symmetry, the negative side has the same maximum magnitude.
Corollary C.2 (Numerical bound at ). For ReLU-SiLU switching with ,
C.4 Convergence of the Empirical Estimators
We now analyze the Monte Carlo estimators used at inference time. For a fixed input x, each stochastic forward pass produces a random prediction . Throughout this subsection, we assume that masks are resampled independently across stochastic forward passes, so that are i.i.d. draws from the stochastic predictor for the fixed input x. The empirical mean estimates the expected prediction, while the empirical variance estimates the predictive variance induced by stochastic activation switching.
Theorem C.2 (Unbiasedness and concentration of ). The empirical mean is an unbiased estimator of the population mean:
Assume the scalar output of interest is bounded almost surely, so that
This assumption holds for post-softmax class probabilities, pixel-wise probabilities in semantic segmentation, and sigmoid-bounded scalar outputs, but not for unbounded logits without additional assumptions. Then, for any ,
For a K-dimensional bounded output, applying Equation (22) coordinate-wise and using a union bound replaces the leading constant 2 by 2K. For pixel-wise outputs, the same argument applies coordinate-wise to each pixel and class probability.
Proof. Unbiasedness follows from linearity of expectation:
The concentration bound in Equation (22) is Hoeffding's inequality applied to the i.i.d. bounded sequence . The K-dimensional version follows by applying the same bound to each coordinate and taking a union bound.
The empirical variance is computed with normalization 1/T, as in the main paper. As with the usual sample variance, this estimator is slightly biased for finite T, but the bias vanishes as T increases.
Lemma C.2 (Bias of ). The empirical uncertainty estimator satisfies
Therefore, the Bessel-corrected estimator
is unbiased.
Proof. Let denote a generic draw from the same distribution as each . Using the sample-variance identity,
Taking expectations gives
and
Dividing by T yields
Theorem C.3 (Convergence of ). Under the bounded-output assumption of Theorem C.2, the empirical variance converges to the population predictive variance:
Moreover, its root-mean-squared error is of order .
Proof. We decompose the mean-squared error into squared bias and variance:
By Lemma C.2, the bias is
Since the output is bounded in , Popoviciu's inequality gives
Therefore, the squared bias is bounded by
For the variance term, the Bessel-corrected estimator can be written as the degree-2 U-statistic
Its kernel is
Because , the kernel is bounded:
The standard variance bound for bounded U-statistics gives
Since
the same rate holds for .
Combining the squared-bias term with the variance term gives
Taking the square root gives root-mean-squared error , proving convergence.
The constants in the above concentration and U-statistic bounds are conservative. In practice, the number of inference passes should be chosen by balancing uncertainty stability and computational cost, as studied in the inference-pass ablation of the main paper.
D Computational Cost and Timing Analysis
We analyze the computational cost of stochastic activation switching in terms of both training and inference time. The analysis separates the overhead introduced by the stochastic activation mechanism itself from the cost of performing multiple stochastic forward passes.
Measurement protocol. All timings are measured on a single NVIDIA H100 GPU. For CIFAR-10, training time corresponds to one training epoch and inference time corresponds to evaluation over the complete test set. All methods use the same backbone and input setting. Our method and MC Dropout use T = 5 stochastic forward passes, while Deep Ensembles use five independently trained models. The reported times therefore capture the complete end-to-end cost of each uncertainty-estimation procedure rather than only the deterministic backbone execution.
Sampling overhead. To isolate the sampling overhead under the same architecture and input setting, we compare the deterministic model, MC Dropout, Deep Ensembles, and our method on CIFAR-10. The deterministic model requires 40.05 s for one training epoch and 2.83 s for full test-set inference. MC Dropout requires 40.97 s and 13.66 s, respectively, while our method requires s for training and s for inference. Thus, our method has training and inference costs close to MC Dropout under the same T = 5 sampling setting, with only a small additional overhead from stochastic activation switching. A five-member Deep Ensemble requires 164.52 s for training and 13.27 s for inference. Therefore, our method has a similar multi-pass inference cost to Deep Ensembles while requiring substantially less training and model storage, since only a single trained network is retained instead of five independently trained models.
Tables 9 and 10 compare the wall-clock computational cost across classification and segmentation. Training time corresponds to one complete epoch over the training set; for Deep Ensembles, the reported value includes one epoch for each of the five independently trained members. Inference time corresponds to processing the complete test set using the full inference procedure of each method.
Across both tasks, stochastic activation switching retains a single-model training profile and has training cost close to other single-model approaches, while avoiding the repeated
| Method | Training Time (s) ↓ | Inference Time (s) ↓ |
|---|---|---|
| Deterministic | 40.05 | 2.83 |
| MC Dropout | 40.97 | 13.66 |
| DDU | 49.93 | 2.86 |
| TTA | 40.05 | 18.43 |
| Masksembles | 43.30 | 3.16 |
| Deep Ensemble | 194.52 | 13.27 |
| Laplace Redux | 57.05 | 3.07 |
| Ours | 42.73 ± 0.36 | 14.21 ± 0.18 |
Table 9: Training and inference time on CIFAR-10.
| Method | Massachusetts | DRIVE | LiTS | CREMI | ||||
|---|---|---|---|---|---|---|---|---|
| Train | Infer. | Train | Infer. | Train | Infer. | Train | Infer. | |
| Deterministic | 54.41 | 1.52 | 37.30 | 24.30 | 28.27 | 10.98 | 36.98 | 9.22 |
| MC Dropout | 54.54 | 4.46 | 38.28 | 140.43 | 32.92 | 55.78 | 39.27 | 52.90 |
| DDU | 74.41 | 3.01 | 51.70 | 26.40 | 48.38 | 11.09 | 52.45 | 9.36 |
| Masksembles | 57.91 | 1.90 | 39.40 | 29.60 | 33.73 | 12.51 | 37.64 | 12.51 |
| Deep Ensemble | 261.79 | 4.25 | 214.74 | 135.11 | 103.84 | 54.47 | 189.48 | 49.42 |
| Ours | 58.46±3.44 | 4.89±0.62 | 38.80±2.70 | 145.50±2.10 | 32.10±0.77 | 59.69±0.58 | 38.03±2.36 | 62.57±1.33 |
Table 10: Training and inference time on the segmentation benchmarks. All times are reported in seconds.
optimization and model storage required by Deep Ensembles. Its main computational overhead occurs at inference because uncertainty estimation requires multiple stochastic forward passes. Accordingly, its inference cost is generally comparable to other multi-evaluation approaches, including MC Dropout and Deep Ensembles, while TTA similarly incurs additional cost from repeated augmented evaluations. In contrast, deterministic inference, DDU, Laplace Redux, and Masksembles generally provide lower wall-clock inference latency.
These results clarify that the main computational advantage of stochastic activation switching lies in single-model training and storage rather than minimum inference latency. The additional inference computation provides the predictive diversity used for uncertainty estimation and accompanies the calibration and OOD-detection improvements reported in the main paper.
E Corruption Robustness
We evaluate classification uncertainty under input corruption using CIFAR-10-C with Gaussian noise at severities 1, 3, and 5. This setting tests whether uncertainty estimates remain meaningful as the input distribution becomes degraded. Table 11 reports the full uncertainty and calibration results, while Figure 6 visualizes the accuracy degradation.
Under mild corruption, our method preserves strong predictive accuracy and obtains the best Brier score, indicating that stochastic activation trajectories provide useful uncertainty without strongly affecting the main prediction. At moderate and severe corruption, MC Dropout achieves the highest accuracy, suggesting that stronger feature removal can act as a noise-robust regularizer under heavy corruption. However, this robustness comes from explicitly masking activations and therefore removing part of the intermediate representation. In contrast, our method introduces micro-level stochasticity through activation switching, which keeps the information flow mostly intact while still producing diverse predictions for uncertainty estimation. As a result, our method remains close to MC Dropout in accu-

Figure 6: Accuracy under CIFAR-10-C Gaussian noise corruption at severities 1, 3, and 5. MC Dropout gives slightly higher accuracy under heavier corruption, likely because feature masking acts as a stronger noise-robust regularizer. Our method remains close in accuracy while preserving information flow through activation switching instead of feature removal.
| Severity | Method | Acc. (↑) | NLL (↓) | ECE (↓) | Brier (↓) |
|---|---|---|---|---|---|
| 1 | MC Dropout | 82.95 | 0.517 | 0.015 | 0.243 |
| Deep Ensemble | 84.96 | 0.486 | 0.042 | 0.220 | |
| TTA | 29.20 | 3.030 | 0.401 | 1.019 | |
| Laplace Redux | 28.29 | 2.315 | 0.213 | 0.872 | |
| Ours | 83.96 | 0.521 | 0.040 | 0.217 | |
| 3 | MC Dropout | 43.89 | 1.889 | 0.184 | 0.756 |
| Deep Ensemble | 43.03 | 2.212 | 0.276 | 0.808 | |
| TTA | 12.08 | 4.118 | 0.429 | 1.152 | |
| Laplace Redux | 12.39 | 3.043 | 0.222 | 0.993 | |
| Ours | 43.11 | 2.165 | 0.202 | 0.767 | |
| 5 | MC Dropout | 17.22 | 3.548 | 0.263 | 1.012 |
| Deep Ensemble | 15.87 | 4.012 | 0.266 | 1.045 | |
| TTA | 11.51 | 4.011 | 0.353 | 1.089 | |
| Laplace Redux | 11.44 | 3.863 | 0.288 | 0.970 | |
| Ours | 16.98 | 2.980 | 0.162 | 1.085 |
Table 11: CIFAR-10-C Gaussian noise corruption results at severities 1, 3, and 5.
racy while obtaining competitive uncertainty metrics. At the highest corruption severity, our method achieves the best NLL [2] and ECE [8], while Laplace Redux obtains the best Brier score but with substantially lower accuracy.
F OOD Uncertainty Distributions
To further inspect the OOD behavior of stochastic activation switching, we visualize the distribution of uncertainty scores for ID and OOD samples. Figure 7 shows that ID samples usually form compact low-uncertainty distributions, while OOD samples shift toward larger and more dispersed uncertainty values. This indicates that the model remains confident on familiar inputs and becomes less certain when the input distribution changes. The separation is especially clear for DRIVE→CHASE-DB1, CIFAR-10→SVHN, and CREMI→ISBI, where OOD samples occupy a broader high-uncertainty range. For Massachusetts→RoadTracer, the two distributions overlap more strongly because both datasets contain aerial road imagery with similar visual structure; nevertheless, the OOD distribution still shows a wider uncertainty spread. This supports the quantitative OOD results and shows that stochastic activation trajectories provide an interpretable signal for detecting distribution shift.
DRIVE ID vs CHASE-DB1 / DB-H OOD

Massachusetts ID vs RoadTracer OOD
CIFAR-10 ID vs SVHN OOD

CREMI ID vs ISBI OOD

Figure 7: Uncertainty comparison of ID and OOD samples. ID scores are concentrated at lower uncertainty, while OOD scores are dispersed and shifted toward higher uncertainty.
Qualitative OOD segmentation examples are shown in Fig. 8, where a model trained on CREMI is evaluated on ISBI 2012. Each row shows the original image, ground-truth mask, prediction, and variance-based uncertainty map. The uncertainty maps are concentrated around ambiguous membranes, boundary regions, and structures where the stochastic forward passes disagree. This provides spatial evidence that the model does not only assign a global OOD score, but also localizes where the cross-dataset shift creates uncertainty in the segmentation output.

Original #101
Mask
Prediction
Variance
Original #75
Mask
Prediction
Variance
Original #116
Mask
Prediction
Variance
Original #50
Mask
Prediction
Variance
Original #10
Mask
Prediction
Variance
Original #88
Mask
Prediction
Variance
Mask
Prediction
Variance
Figure 8: Qualitative OOD segmentation examples on ISBI 2012 using a model trained on CREMI. Each row shows the original image, ground-truth mask, prediction, and variance-based uncertainty map.