A brain-inspired algorithm for training highly sparse neural networks

Zahra Atashgahi, Joost Pieterse, Shiwei Liu, Decebal Constantin Mocanu, Raymond N. J. Veldhuis, Mykola Pechenizkiy

Abstract

Training deep learning models is increasingly resource-intensive, often requiring massive dense models to be trained before pruning them for efficiency. This paper introduces CTRE (Cosine similarity-based and random Topology Exploration), a brain-inspired algorithm designed to train highly sparse neural networks from scratch. By leveraging the Hebbian "fire together, wire together" principle through cosine similarity, CTRE achieves state-of-the-art accuracy in extremely sparse regimes without the computational burden of dense pre-training.

Introduction

As deep learning models scale, their energy consumption and hardware requirements pose significant barriers to deployment on edge devices. Sparse neural networks—where the majority of weights are zero—offer a path forward. However, traditional "dense-to-sparse" methods require training a full model first, while existing "sparse-to-sparse" methods often rely on computationally expensive dense gradients or inefficient random growth strategies. CTRE addresses these challenges by evolving network topology based on neuron activation patterns.

Methodology: The CTRE Algorithm

CTRE evolves the network structure during the training process by alternating between weight removal and growth. The core innovation lies in how new connections are selected.

The CTRE training cycle: after standard back-propagation, weights are pruned based on magnitude, and new connections are grown based on computed cosine similarities between neuron activations.

1. Cosine Similarity-Based Growth

Inspired by Hebbian theory, CTRE identifies neurons in adjacent layers that exhibit similar activation patterns. If two neurons "fire" together—measured by the cosine similarity of their activation vectors over a training batch—a connection is established between them. Unlike standard Hebbian rules, cosine similarity is magnitude-insensitive, making the process robust to noise and preventing bias toward high-magnitude neurons.

2. Random Topology Exploration

To avoid local minima where the model might repeatedly add ineffective connections, CTRE incorporates random search. The paper proposes two variants:

  • CTRE_seq: Alternates between similarity-based growth and random search upon performance plateaus.
  • CTRE_sim: Dynamically allocates a budget for both similarity-based and random growth within every epoch.

3. Pruning and Efficiency

Weight removal is handled via standard magnitude-based pruning. Crucially, CTRE adds weights without ever calculating "dense gradients" (gradients for non-existent connections), maintaining a low memory footprint throughout training.

Experimental Evaluation

The authors evaluated CTRE across eight benchmarks spanning tabular, image, and text data, including MNIST, CIFAR-10/100, and the noisy Madelon dataset.

Key Results

  • Extreme Sparsity: In scenarios with less than 0.3% density, CTRE significantly outperformed state-of-the-art methods like RigL and SET.
  • Robustness to Noise: On the Madelon dataset, where 96% of features are noise, CTRE achieved 78.8% accuracy at 0.3% density, compared to 61.9% for the next best sparse method.
  • Efficiency: CTRE reached performance comparable to dense networks while utilizing 100 times fewer connections, demonstrating its potential for "Green AI."

Discussion and Insights

The research highlights that while weight magnitude is an effective metric for pruning, activation similarity is superior for connection growth. By normalizing vectors through cosine similarity, the algorithm focuses on the functional relationships between neurons rather than signal volume.

Limitations

Currently, CTRE is optimized for Multi-Layer Perceptrons (MLPs). Adapting the algorithm for Convolutional Neural Networks (CNNs) remains a challenge due to the "weight sharing" nature of CNNs, which lacks a direct biological parallel in the current CTRE framework. Additionally, while similarity calculations can be optimized using sub-sampling, they still introduce some computational overhead compared to purely random growth.

Conclusion

CTRE represents a significant step toward efficient, biologically-plausible training of sparse networks. By evolving topology based on functional neuron correlations, it enables the training of high-performing models with a fraction of the memory and energy required by traditional dense training.

Summary updated

BibTeX
@article{atashgahi2022brain,
  author = {Zahra Atashgahi and Joost Pieterse and Shiwei Liu and Decebal Constantin Mocanu and Raymond N. J. Veldhuis and Mykola Pechenizkiy},
  title = {{A brain-inspired algorithm for training highly sparse neural networks}},
  journal = {Machine Learning},
  year = {2022},
  doi = {10.1007/s10994-022-06266-w},
}
Figure