Skip to main content
QUICK REVIEW

[Paper Review] Learning Activation Functions for Sparse Neural Networks

Mohammad Loni, Aditya Mohan|arXiv (Cornell University)|May 18, 2023
Advanced Neural Network ApplicationsComputer Science5 citations
TL;DR

This paper proposes SAFS, a novel two-stage AutoML framework that jointly optimizes activation functions and hyperparameters for sparse neural networks (SNNs), significantly improving accuracy at high sparsity levels. By learning layer-wise activation functions and fine-tuning hyperparameters separately, SAFS achieves up to 15.53% absolute accuracy gain over default training protocols on LeNet-5, VGG-16, and ResNet-18 across MNIST, CIFAR-10, and ImageNet-16 datasets.

ABSTRACT

Sparse Neural Networks (SNNs) can potentially demonstrate similar performance to their dense counterparts while saving significant energy and memory at inference. However, the accuracy drop incurred by SNNs, especially at high pruning ratios, can be an issue in critical deployment conditions. While recent works mitigate this issue through sophisticated pruning techniques, we shift our focus to an overlooked factor: hyperparameters and activation functions. Our analyses have shown that the accuracy drop can additionally be attributed to (i) Using ReLU as the default choice for activation functions unanimously, and (ii) Fine-tuning SNNs with the same hyperparameters as dense counterparts. Thus, we focus on learning a novel way to tune activation functions for sparse networks and combining these with a separate hyperparameter optimization (HPO) regime for sparse networks. By conducting experiments on popular DNN models (LeNet-5, VGG-16, ResNet-18, and EfficientNet-B0) trained on MNIST, CIFAR-10, and ImageNet-16 datasets, we show that the novel combination of these two approaches, dubbed Sparse Activation Function Search, short: SAFS, results in up to 15.53%, 8.88%, and 6.33% absolute improvement in the accuracy for LeNet-5, VGG-16, and ResNet-18 over the default training protocols, especially at high pruning ratios. Our code can be found at https://github.com/automl/SAFS

Motivation & Objective

  • Address the underexplored impact of activation functions and hyperparameters on the accuracy degradation of sparse neural networks (SNNs) at high pruning ratios.
  • Investigate why ReLU, the default activation function, may hinder SNN training due to gradient flow issues.
  • Develop an efficient, automated method to jointly optimize activation functions and hyperparameters for SNNs, distinct from dense network training protocols.
  • Demonstrate that SNN accuracy can be significantly improved by deviating from standard training practices, especially in high-sparsity regimes.
  • Propose a scalable, architecture-agnostic framework that can be applied to any SNN without modifying the pruning process.

Proposed method

  • Propose a two-stage optimization pipeline: first, learn the optimal unary activation function per layer using discrete search with a differentiable architecture search (DARTS)-inspired controller.
  • Second, perform stochastic hyperparameter optimization (HPO) using Bayesian optimization to fine-tune learning rate, weight decay, and other training hyperparameters specific to the sparse network.
  • Use a controller network to search over a predefined search space of activation functions, including ReLU, LeakyReLU, Swish, and HardSwish, with learnable parameters α and β.
  • Apply unstructured magnitude pruning to the dense model before applying SAFS, ensuring the method is independent of the pruning algorithm.
  • Train the SNN using the learned activation functions and optimized hyperparameters, with evaluation on standard benchmarks including MNIST, CIFAR-10, and ImageNet-16.
  • Integrate the search process with a multi-objective objective: maximize validation accuracy while minimizing computational cost of the search phase.
(a)
(a)

Experimental results

Research questions

  • RQ1To what extent does the choice of activation function, particularly ReLU, degrade the performance of sparse neural networks at high pruning ratios?
  • RQ2Can a joint optimization of activation functions and hyperparameters improve the accuracy of SNNs beyond standard training protocols?
  • RQ3How does layer-wise activation function search compare to using a single global activation function across all layers in SNNs?
  • RQ4Does the performance gain from SAFS scale across different architectures (e.g., LeNet-5, VGG-16, ResNet-18, EfficientNet-B0) and datasets (MNIST, CIFAR-10, ImageNet-16)?
  • RQ5Can the proposed method be applied independently of the pruning algorithm, enabling broad applicability to existing SNN pipelines?

Key findings

  • SAFS achieves a 15.53% absolute accuracy gain on LeNet-5 trained on MNIST at 99% pruning ratio compared to the default training protocol using ReLU.
  • On VGG-16 trained on CIFAR-10, SAFS improves accuracy by 8.88% at 99% pruning ratio, significantly outperforming standard training with ReLU.
  • For ResNet-18 on CIFAR-10, SAFS delivers a 6.33% absolute accuracy improvement at 99% sparsity, demonstrating effectiveness on deeper architectures.
  • The ablation study confirms that both stages of SAFS—activation function search and hyperparameter tuning—contribute independently to performance gains, with the full pipeline yielding the highest accuracy.
  • The method is robust across diverse architectures and datasets, with consistent improvements observed on EfficientNet-B0, achieving a 1.54% accuracy gain on ImageNet-16 at 99% pruning.
  • The results indicate that ReLU is suboptimal for SNNs, and that Swish and HardSwish are more effective, especially in middle and deeper layers, while ReLU performs better in early layers.
(b)
(b)

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.