dynActivation: A Trainable Activation Family for Adaptive Nonlinearity
Organizations: Ruprecht-Karls-Universität Heidelberg
Abstract
This paper proposes , a per-layer trainable activation defined as , where and are lightweight learned scalars that interpolate between the base nonlinearity and a linear path and resembles any ReLU-like function. The static and dynamic ReLU-like variants are then compared across multiple vision tasks, language modeling tasks, and ablation studies. The results suggest that dynActivation variants tend to linearize deep layers while maintaining high performance, which can improve training efficiency by up to over ReLU. On CIFAR-10, dynActivation(Mish) improves over static Mish by up to on AttentionCNN with an average improvment by , with a convergence-AUC reduction relative to Mish (2120 vs. 2785). In a 1-to-75-layer MNIST depth-scaling study, dynActivation never drops below test accuracy (--), while ReLU collapses below at 25 layers. Under FGSM at , dynActivation(Mish) incurs a accuracy drop versus for ReLU ( advantage). Transferred to language modeling, a new proposed dynActGLU-variant achieves a relative perplexity reduction over SwiGLU at 5620 steps (4.047 vs. 4.514), though the gap vanishes at 34300 steps.
Figures & tables
| Object | Definition / interpretation |
|---|---|
| Chosen base activation, e.g. Mish, GELU, Swish, or ReLU. | |
| Trainable per-layer coefficient scaling the base activation contribution. | |
| Trainable per-layer coefficient defining the explicit linear path. | |
| . | |
| Special case using Mish as base activation. |
| System | GPU (VRAM) | CPU | RAM | SSD |
|---|---|---|---|---|
| System 1 | RTX 2080 Ti (11 GB) | Ryzen 7 5700X CPU | 32 GB DDR4 | 1 TB |
| System 2 (Cloud) | RTX 5090 (32 GB) | AMD EPYC 7763 | 112.8 GB DDR4 | 16 GB |
| Setting | Value |
|---|---|
| Framework | PyTorch |
| Optimizer | Adam [ 12 ] |
| Learning rate | 0.001 |
| Weight decay | 5e-9 |
| Scheduler | StepLR(step_size=10, gamma=0.1) |
| Gradient clipping | clip_grad_norm(…, max_norm=1.0) |
| Activation | Mean Acc | Std Acc | Mean Loss | Std Loss |
|---|---|---|---|---|
| dynActivation(Mish) | 66.8571 | 0.5845 | 1.1781 | 0.0235 |
| dynActivation(GELU) | 66.6886 | 0.7935 | 1.1810 | 0.0312 |
| dynActivation(SiLU) | 65.6500 | 1.1292 | 1.2304 | 0.0365 |
| dynActivation(ReLU) | 60.9117 | 1.9969 | 1.4215 | 0.0998 |
| Dataset | Architecture | Best dynActivation | Mean Acc | Mean Loss |
|---|---|---|---|---|
| CIFAR10 | AttentionCNN | dynActivation(Mish) | 78.27 | 0.6390 |
| CIFAR10 | DenseNet | dynActivation(Mish) | 81.92 | 0.5466 |
| CIFAR10 | MobileNet | dynActivation(Mish) | 80.87 | 0.5743 |
| CIFAR10 | ResNet18 | dynActivation(GELU) | 84.11 | 0.5196 |
| CIFAR100 | AttentionCNN | dynActivation(GELU) | 45.70 | 2.0433 |
| CIFAR100 | DenseNet | dynActivation(Mish) | 52.42 | 1.7713 |
| Aktivierung | Mean Acc (%) | (Acc) | Mean Loss | (Loss) | Acc | Loss |
|---|---|---|---|---|---|---|
| CIFAR10 – AttentionCNN | ||||||
| ReLU | 73.64 | 1.4321 | 0.7605 | 0.0497 | -4.63 | +0.1215 |
| GELU | 69.83 | 1.7864 | 0.8624 | 0.0542 | -8.44 | +0.2234 |
| Mish | 64.25 | 1.6702 | 1.0001 | 0.0508 | -14.02 | +0.3611 |
| SiLU | 63.95 | 1.2492 | 1.0086 | 0.0323 | -14.32 | +0.3696 |
| dynActivation(Mish) | 78.27 | 0.8523 | 0.6390 | 0.0259 | +0.00 | +0.0000 |
| Activation | Accuracy (Mean Std) | Loss (Mean Std) | Trainable |
| Apa [ 24 ] | Yes | ||
| Trainable_swish [ 4 ] | Yes | ||
| Pdelu [ 25 ] | Yes | ||
| Melu [ 26 ] | Yes | ||
| Mish [ 1 ] | No | ||
| Prelu_scalar [ 6 ] | No |
| Activation | -Value | -Statistic | Significant vs. Best |
|---|---|---|---|
| Apa [ 24 ] | 0.2598 | -1.2026 | No |
| Trainable_swish [ 4 ] | 0.0581 | -2.1703 | No |
| Pdelu [ 25 ] | 0.1188 | -1.7238 | No |
| Melu [ 26 ] | 0.0017 | -4.4033 | Yes |
| Mish [ 1 ] | 0.0375 | -2.4373 | Yes |
| Prelu_scalar [ 6 ] | 0.0208 | -2.7976 | Yes |
| Activation | Loss | Perplexity |
|---|---|---|
| Baseline SwiGLU [ 13 ] | 1.5072 | 4.5142 |
| dynActGLU(Swish) | 1.3979 | 4.0467 |
| Activation | Loss | Perplexity |
|---|---|---|
| Baseline SwiGLU | 1.3374 | 3.8091 |
| dynActGLU(Swish) | 1.3364 | 3.8056 |
| Activation | AUC Loss | Steps to 1.0 | Steps to 0.5 | Conv. rate |
|---|---|---|---|---|
| relu | 2864.364252 | 277 | 781 | 0.000206 |
| mish | 2784.969175 | 204 | 835 | 0.000203 |
| swish | 2830.302696 | 293 | 835 | 0.000211 |
| gelu | 2605.357465 | 204 | 781 | 0.000209 |
| dynActivation(ReLU) | 2350.585219 | 257 | 781 | 0.000213 |
| dynActivation(Mish) | 2119.673199 | 226 | 781 | 0.000213 |
Neural Network Activation Functions
Neural network activation functions shape how models represent nonlinear patterns, learn, remain stable, and map efficiently to hardware.
See all 75 papers