TL;DR
This paper introduces a novel, efficient gradient-based method (GRAFS) for automatically discovering custom activation functions tailored to specific deep learning tasks and architectures. By adapting neural architecture search techniques, GRAFS significantly outperforms previous methods in both efficiency and performance, finding specialized activations that generalize well to larger models and new datasets.
What Problem Does This Paper Address?
Activation functions are crucial components of neural networks, introducing non-linearity and significantly impacting performance. While the Rectified Linear Unit (ReLU) is ubiquitous due to its simplicity, manually designing optimal activations for specific tasks has proven challenging, often leading to suboptimal performance. Previous automated methods for finding activation functions were either computationally expensive, limited in their search space, or suffered from performance degradation during the search process. This paper aims to bridge this gap by providing an efficient and effective gradient-based approach to discover novel, high-performing activation functions.
Methods
The core of this work is the GRAFS (Gradient-based Activation Function Search) method. It builds upon recent advancements in gradient-based neural architecture search (NAS), specifically adapting techniques like DARTS and DrNAS.
Here's a breakdown of their approach:
- Search Space: They define a search space of activation functions by combining basic unary and binary mathematical operations. This allows for the exploration of novel, complex activation functions beyond standard ones.
- Gradient-Based Optimization: Instead of discrete search, they relax the discrete search space into a continuous one by assigning learnable weights to the operations. This enables gradient descent to optimize the activation function parameters.
- Bi-level Optimization: The process involves a bi-level optimization:
- Outer loop: Optimizes the activation function parameters.
- Inner loop: Trains the neural network weights using the current activation function.
- Key Innovations for Robustness and Efficiency:
- Constraining Unbounded Operations: To prevent exploding gradients from unbounded operations, they clip outputs exceeding a threshold.
- Warm-starting: The search is initiated with a warm-up phase where the network is trained with a standard activation function, ensuring a reasonable starting point for both network weights and activation parameters.
- Progressive Shrinking: To address the challenges of a large search space and performance drop at discretization, they progressively prune operations with the lowest activation parameters from the search cell over epochs. This speeds up the search and improves efficacy.
- Variance Reduction: For DrNAS, they employ independent sampling of activation cells within the network to reduce variance.
Datasets
The paper evaluates their approach on several standard datasets:
- Image Classification: CIFAR10, CIFAR100, SVHN.
- Language Modeling: TinyStories.
They do not introduce new benchmarks but rather demonstrate the effectiveness of their method on existing ones across different model architectures.
Key Insights and Ideas
- Custom Activations Outperform General Ones: The research strongly suggests that specialized activation functions, tailored to specific model architectures and tasks, can significantly outperform general-purpose activations like ReLU and GELU.
- Gradient-Based Search is Efficient: Adapting gradient-based NAS techniques to activation function search leads to a dramatic reduction in computational cost, making the process orders of magnitude more efficient than previous methods.
- Transferability is Key: Discovered activations are not just good for the specific model and dataset they were found on; they also show strong performance when transferred to larger models of the same type or applied to new datasets. This indicates a degree of generality and robustness in the learned functions.
- Progressive Shrinking is Crucial: The progressive shrinking of the search cell is a vital technique that helps manage the complexity of the search space and mitigate performance degradation issues common in NAS.
Key Results
- Performance Improvements: In all tested scenarios (ResNet, ViT, GPT), the discovered activations consistently improved performance over standard baselines like ReLU and GELU. For instance, on CIFAR10, one discovered activation surpassed all baselines, and all five discovered activations improved upon ReLU.
- Efficiency Gains: The search overheads are remarkably low, ranging from 0.25 to 4.85 times the evaluation time. This is a significant improvement compared to thousands of evaluations required by prior methods.
- Generalization: The paper demonstrates that activations found on smaller models (e.g., ViT-tiny) perform well on larger variants (e.g., ViT-small) and new datasets. Similarly, for language models, discovered activations showed improved test losses on larger GPT models.
Limitations and Future Work
- Not an Optimal Pipeline: The authors acknowledge that their work is a demonstration of the potential of gradient-based search for activations and not necessarily the final, optimal pipeline.
- Future Directions: They suggest several avenues for future research:
- Developing improved search spaces and methods for activation functions.
- Exploring methods for finding activations with robust performance across diverse workloads.
- Investigating strategies for scaling the search to even larger networks.
- Further research into the transferability and generalization capabilities of discovered activations.
Summary updated