Sub-Linear Memory: How to Make Performers SLiM
arXiv:2012.11346
Abstract
The Transformer architecture has revolutionized deep learning on sequential data, becoming ubiquitous in state-of-the-art solutions for a wide variety of applications. Yet vanilla Transformers are notoriously resource-expensive, requiring in serial time and memory as functions of input length . Recent works proposed various linear self-attention mechanisms, scaling only as for serial computation. We perform a thorough analysis of recent Transformer mechanisms with linear self-attention, Performers, in terms of overall computational complexity. We observe a remarkable computational flexibility: forward and backward propagation can be performed with no approximations using sublinear memory as a function of (in addition to negligible storage for the input sequence), at a cost of greater time complexity in the parallel setting. In the extreme case, a Performer consumes only memory during training, and still requires time. This discovered time-memory tradeoff can be used for training or, due to complete backward-compatibility, for fine-tuning on a low-memory device, e.g. a smartphone or an earlier-generation GPU, thus contributing towards decentralized and democratized deep learning.
References in corpus (6)
- Generating Long Sequences with Sparse Transformers
- Reformer: The Efficient Transformer
- fairseq: A Fast, Extensible Toolkit for Sequence Modeling
- Stabilizing Transformers for Reinforcement Learning
- Lite Transformer with Long-Short Range Attention
- Linear Attention Mechanism: An Efficient Attention for Semantic Segmentation