Mining Generalizable Activation Functions

Alex Vitvitskyi, Michael Boratko, Matej Grcic, Razvan Pascanu, Deep Shah, Petar Veličković · DOI

Abstract

The choice of activation function is an active area of research, with different proposals aimed at improving optimization while maintaining expressivity. Additionally, the activation function can significantly alter the implicit inductive bias of the architecture, controlling its non-linear behavior. In this paper, in line with previous work, we argue that evolutionary search provides a useful framework for finding new activation functions, while we also make two novel observations. The first is that modern pipelines, such as AlphaEvolve, which relies on frontier LLMs as a mutator operator, allow for a much wider and flexible search space—e.g., over all possible Python functions within a certain FLOP budget—eliminating the need for manually constructed search spaces. In addition, these pipelines will be biased towards meaningful activation functions, given their ability to represent common knowledge, leading to a potentially more efficient search of the space. The second observation is that, through this framework, one can target not only performance improvements but also activation functions that encode particular inductive biases. This can be done by using performance on out-of-distribution data as a fitness function, reflecting the degree to which the architecture respects the inherent structure in the data in a manner independent of distribution shifts. We carry an empirical exploration of this proposal and show that relatively small-scale synthetic datasets can be sufficient for AlphaEvolve to discover meaningful activations.

Introduction

Activation functions (AFs) are the non-linear "engines" of neural networks. While the field has moved from Sigmoid to ReLU and GELU, most AFs are designed primarily to improve optimization (making gradients behave) rather than generalization (helping the model work on unseen data). Furthermore, previous attempts to automate the search for new AFs were restricted to a narrow "Lego set" of human-predefined mathematical operations.

This paper addresses two main gaps in the current landscape: shifting the search goal from training data fit to out-of-distribution (OOD) structural respect, and moving beyond fixed search spaces to allow for any valid Python function. By leveraging Large Language Models (LLMs) as creative mutators, we can discover functions that generalize better than industry standards.

Methodology: The AlphaEvolve Framework

The authors utilize AlphaEvolve, an evolutionary framework where frontier LLMs act as the "mutator." Instead of randomly swapping math operators, the LLM suggests entire Python functions based on the performance of previous iterations. This allows the search to inject "common knowledge" into the process; models often provide code comments explaining the rationale behind a proposed function, such as adding sinusoidal components to aid periodic exploration.

The AlphaEvolve framework utilizes an LLM ensemble to mutate activation functions, which are then evaluated in a training loop using synthetic datasets.

The Small-Scale Lab

The core of the approach is a tiered search phase using synthetic regression tasks. The evolutionary loop trains tiny Multi-Layer Perceptrons (MLPs) where the fitness function is determined by performance on out-of-distribution (OOD) data. For example, if the model is trained on data in the range $[0, 0.5]$, it is tested on $[0.5, 1.0]$.

Synthetic tasks used in the search phase, showing In-Distribution (ID) training regions and Out-of-Distribution (OOD) test regions for various function types.

To ensure the discovered functions are practical, the framework imposes a strict "FLOP budget," preventing the evolution of overly complex, computationally expensive functions. The search phase utilizes polynomials with random coefficients, harmonic functions, and physics-inspired equations from the Feynman Symbolic Regression Dataset.

Key Insights and Results

The search yielded several high-performing novel activation functions that outperformed ReLU and GELU on complex benchmarks without sacrificing accuracy on standard vision tasks.

The Power of Periodicity

Many of the top-performing discovered functions, such as GELU-Sinc-Perturbation, combine a standard GELU base with a small periodic "wiggle" (sine or sinc functions). The authors hypothesize this helps the network extrapolate beyond its training range by preventing the model from becoming too "confident" in linear extrapolations.

Transferability and Performance

To prove the discovered AFs aren't just overfit to the synthetic lab, they were validated on real-world datasets:

  • Algorithmic Reasoning: On the CLRS-30 benchmark, GELU-Sinc-Perturbation achieved a score of 0.887, significantly higher than ReLU (0.862) and GELU (0.874).
  • Molecular Graphs: The new functions showed the best overall performance on the ogbg-molhiv task, which specifically tests for structural distribution shifts.
  • Vision: Crucially, these functions achieved OOD gains while remaining competitive on ImageNet-1K, proving that generalization does not require a trade-off with standard performance.

Limitations and Future Work

Despite these successes, a "lab gap" exists: some functions that were highly effective in the small-scale synthetic lab failed when moved to large-scale real-world data. Identifying the "sweet spot" where synthetic performance accurately predicts real-world success remains an open challenge. Furthermore, while empirical results for periodic perturbations are strong, a rigorous mathematical theory explaining why these specific shapes aid OOD generalization is still missing. Future work may involve evolving activation functions specifically for Transformers or evolving entire layer structures alongside the activation function.

Summary updated

Abstract

The choice of activation function is an active area of research, with different proposals aimed at improving optimization, while maintaining expressivity. Additionally, the activation function can significantly alter the implicit inductive bias of the architecture, controlling its non-linear behavior. In this paper, in line with previous work, we argue that evolutionary search provides a useful framework for finding new activation functions, while we also make two novel observations. The first is that modern pipelines, such as AlphaEvolve, which relies on frontier LLMs as a mutator operator, allows for a much wider and flexible search space; e.g., over all possible python functions within a certain FLOP budget, eliminating the need for manually constructed search spaces. In addition, these pipelines will be biased towards meaningful activation functions, given their ability to represent common knowledge, leading to a potentially more efficient search of the space. The second observation is that, through this framework, one can target not only performance improvements but also activation functions that encode particular inductive biases. This can be done by using performance on out-of-distribution data as a fitness function, reflecting the degree to which the architecture respects the inherent structure in the data in a manner independent of distribution shifts. We carry an empirical exploration of this proposal and show that relatively small scale synthetic datasets can be sufficient for AlphaEvolve to discover meaningful activations.
BibTeX
@misc{vitvitskyi2026mining,
  author = {Alex Vitvitskyi and Michael Boratko and Matej Grcic and Razvan Pascanu and Deep Shah and Petar Veličković},
  title = {{Mining Generalizable Activation Functions}},
  year = {2026},
  eprint = {2602.05688},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.05688},
}
Figure