Learn, Freeze, and Transfer an Activation Function Across Architectures
Organizations: Nilekani Centre at AI4Bharat, Indian Institute of Technology Madras
Abstract
Transfer learning typically reuses knowledge acquired by a source network through its learned weights. We investigate whether a learned activation function can also be transferred and remain useful in networks trained from scratch. We study this complementary form of transfer through a learn-freeze-transfer protocol, in which the activation is optimized jointly with a source network in a single training run, and is then frozen and reused in target networks trained from scratch. A pointwise activation with globally shared parameters is independent of layer dimensions and can therefore be incorporated into networks of different architectures trained from scratch. We instantiate this protocol with FAct, a five-parameter activation represented by a two-harmonic truncated Fourier series, initialized from a Fourier approximation of GELU and learned in a Vision Transformer (ViT) on ImageNet-1K. When reused in a ViT of the same architecture trained from scratch on ImageNet-1K, the frozen activation (Frozen FAct) improves top-1 accuracy by 1.46 percentage points over GELU. Across four smaller target architectures (standard ViT, Swin Transformer, linear-attention ViT, and MLP-Mixer) and four image-classification datasets, it achieves the highest mean accuracy among eleven activation functions in 15 of 16 settings under a common training configuration, with improvements of up to 1.71 percentage points over the best conventional activation. When the learning rate and weight decay are tuned separately for each activation under the same search budget, Frozen FAct still ranks first in 11 of the 16 settings, second in four, and fourth in one. These results provide empirical evidence that a learned activation function can retain its usefulness when transferred across vision architectures, independently of the weights with which it was learned.
Figures & tables
| Activation | Top-1 accuracy (%) | vs GELU ( ) |
|---|---|---|
| GELU | 62.45 0.13 | — |
| Frozen FAct | 63.91 0.15 |
| Activation | Fashion-MNIST | CIFAR-10 | CIFAR-100 | Food-101 |
|---|---|---|---|---|
| Frozen FAct | 90.94 0.10 | 75.56 0.35 | 47.67 0.48 | 35.83 0.36 |
| ReLU | 90.40 0.46 | 74.50 0.46 | 46.95 0.63 | 34.07 0.22 |
| LeakyReLU | 90.27 0.27 | 74.51 0.26 | 46.80 0.21 | 34.12 0.21 |
| GELU | 89.09 0.24 | 72.46 0.29 | 46.30 0.24 | 34.10 0.39 |
| SiLU | 87.96 0.57 | 70.47 0.39 | 44.60 0.34 | 32.51 0.54 |
| Mish | 87.91 0.35 | 70.62 0.49 | 44.85 0.31 | 32.69 0.32 |
| Activation | Fashion-MNIST | CIFAR-10 | CIFAR-100 | Food-101 |
|---|---|---|---|---|
| Frozen FAct | 89.33 0.11 | 69.47 0.31 | 38.34 0.34 | 41.32 0.26 |
| ReLU | 88.28 0.28 | 67.31 0.33 | 36.87 0.44 | 39.20 0.55 |
| LeakyReLU | 88.27 0.15 | 67.56 0.41 | 36.85 0.31 | 39.20 0.37 |
| GELU | 88.29 0.22 | 67.82 0.31 | 37.25 0.27 | 40.43 0.38 |
| SiLU | 87.69 0.18 | 66.21 0.35 | 36.48 0.44 | 39.01 0.54 |
| Mish | 87.60 0.09 | 66.44 0.32 | 36.97 0.68 | 39.34 0.32 |
| Activation | Fashion-MNIST | CIFAR-10 | CIFAR-100 | Food-101 |
|---|---|---|---|---|
| Frozen FAct | 90.67 0.24 | 75.15 0.38 | 48.05 0.19 | 36.12 0.34 |
| ReLU | 90.29 0.16 | 73.94 0.48 | 46.57 0.36 | 34.40 0.27 |
| LeakyReLU | 90.18 0.23 | 73.89 0.30 | 46.35 0.29 | 34.50 0.29 |
| GELU | 89.07 0.22 | 72.13 0.31 | 45.47 0.32 | 33.88 0.63 |
| SiLU | 87.89 0.52 | 70.05 0.31 | 43.29 0.46 | 32.49 0.13 |
| Mish | 88.06 0.25 | 70.23 0.28 | 43.66 0.63 | 32.70 0.17 |
| Target | Dataset | Frozen FAct | Best-performing conventional activation | ( ) |
|---|---|---|---|---|
| ViT-d2 | Fashion-MNIST | 90.94 | ReLU (90.40) | |
| CIFAR-10 | 75.56 | LeakyReLU (74.51) | ||
| CIFAR-100 | 47.67 | ReLU (46.95) | ||
| Food-101 | 35.83 | LeakyReLU (34.12) | ||
| Swin-d2 | Fashion-MNIST | 89.33 | GELU (88.29) | |
| CIFAR-10 | 69.47 | GELU (67.82) |
| Activation | Fashion-MNIST | CIFAR-10 | CIFAR-100 | Food-101 |
|---|---|---|---|---|
| Frozen FAct | 91.42 0.18 | 75.99 0.16 | 47.49 0.38 | 35.09 0.22 |
| ReLU | 90.80 0.22 | 75.47 0.35 | 47.08 0.46 | 34.92 0.35 |
| LeakyReLU | 90.64 0.39 | 75.51 0.13 | 47.20 0.48 | 34.94 0.40 |
| GELU | 89.84 0.13 | 75.32 0.48 | 45.99 0.60 | 36.15 0.47 |
| SiLU | 88.90 0.29 | 73.75 0.30 | 45.07 0.83 | 35.15 0.30 |
| Mish | 88.94 0.25 | 74.03 0.30 | 45.17 0.58 | 35.25 0.25 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Source | Targets | ||||
|---|---|---|---|---|---|
| ViT-d6 | ViT-d2 | Swin-d2 | LinViT-d2 | MLP-Mixer | |
| Token mixing | global softmax | global softmax | shifted window (4) | linear, | MLP |
| Depth / width / heads | 6 / 192 / 6 | 2 / 64 / 4 | 2 / 64 / 4 | 2 / 64 / 4 | 2 / 76 / – |
| MLP hidden width | 768 | 256 | 256 | 256 | 38 token / 304 channel |
| Patch size | 16 | 4 (Food-101: 8) | 4 | 4 (Food-101: 8) | 4 (Food-101: 8) |
| Parameters | 3,048,232 | 105,098–123,237 | 102,354–110,317 | 105,098–123,237 | 103,620–126,313 |
| Best-performing conventional | |||||
|---|---|---|---|---|---|
| Target | Dataset | Frozen FAct | Activation | Accuracy | ( ) |
| ViT-d2 | Fashion-MNIST | 91.17 0.17 | LeakyReLU | 90.69 0.31 | |
| CIFAR-10 | 76.34 0.69 | GELU | 74.91 0.13 | ||
| CIFAR-100 | 48.33 0.48 | GELU | 47.06 0.30 | ||
| Food-101 | 39.15 0.49 | GELU | 37.13 0.41 | ||
| Swin-d2 | Fashion-MNIST | 90.51 0.23 | GELU | 90.13 0.17 | |
| Dataset | Depth | GELU | Frozen GELU-init | Frozen FAct |
|---|---|---|---|---|
| Fashion-MNIST | 1 | 83.93 0.35 | 84.10 0.32 | 85.03 0.30 |
| 2 | 88.28 0.18 | 88.41 0.20 | 89.30 0.06 | |
| 3 | 89.65 0.26 | 90.07 0.24 | 90.71 0.13 | |
| 4 | 90.06 0.06 | 90.49 0.18 | 90.98 0.26 | |
| 5 | 90.71 0.24 | 91.11 0.07 | 91.83 0.23 | |
| 6 | 90.66 0.33 | 91.15 0.13 | 91.92 0.13 |
| Dataset | Learnable FAct | Frozen FAct | (pp) |
|---|---|---|---|
| Fashion-MNIST | |||
| CIFAR-10 | |||
| CIFAR-100 | |||
| Food-101 |
Neural Network Activation Functions
Neural network activation functions shape how models represent nonlinear patterns, learn, remain stable, and map efficiently to hardware.
See all 86 papers