Transformers use dense self-attention, allowing flexible all-to-all connectivity between input elements. This provides great expressive power but also quadratic computational cost. Over multiple layers, the number of possible connectivity patterns grows exponentially. However, we hypothesize that only a small subset of sparsely connected sub-networks within the transformer, called information pathways, are essential for good performance. In our paper, we provide a new perspective on transformers based on these information pathways and show how to leverage inherent sparsity for efficiency, especially during training.
We put forward the "information pathways hypothesis" - the idea that transformers inherently contain many sparsely connected sub-networks or pathways. The full model can be seen as an ensemble of subsets of these pathways.
Based on this viewpoint, we develop a technique called Stochastically Subsampled Self-Attention (SSA) to sample pathways during training for efficiency (in terms of both memory and compute) and regularization. Surprisingly, we show that performing SSA during inference further boosts performance by forming model self-ensembles.
The key innovations we propose are:
We demonstrate the effectiveness of our proposals through extensive experiments on language modeling, image classification and graph regression tasks. Our results exhibit 4-8x reduced self-attention cost and improved generalization with SSA. Self-ensembling can further improve generalization during inference.
Our paper provides a new perspective on viewing transformers as dynamic ensembles of information pathways. This viewpoint has important theoretical and practical implications:
@article{hussain2022information,
title={The Information Pathways Hypothesis: Transformers are Dynamic Self-Ensembles},
author={Hussain, Md Shamim and Zaki, Mohammed J and Subramanian, Dharmashankar},
journal={arXiv preprint arXiv:2306.01705},
year={2023}
}
This work was supported by the Rensselaer-IBM AI Research Collaboration, part of the IBM AI Horizons Network.