Long-Short Transformer (Transformer-LS)
This repository hosts the code and models for the paper:
Long-Short Transformer: Efficient Transformers for Language and Vision
Updates
- July 23, 2021: Release the code and models for ImageNet classification and Long-Range Arena
Architecture
Long-short Transformer substitutes the full self attention of the original Transformer models with an efficient attention that considers both long-range and short-term correlations. Each query attends to tokens from the segment-wise sliding window to capture short-term correlations, and the dynamically projected features to capture long-range correlations. To align the norms of the original and projected feature vectors and improve the efficacy of the aggregation, we normalize the original and project feature vectors with two sets of Layer Normalizations.