Computational Complexity and Parallelization
Self-attention layers exhibit a per-layer computational complexity of and execute in sequential operations. In contrast, standard recurrent layers require operations per layer and sequential operations, because hidden states must be computed sequentially from .
In machine translation and natural language processing tasks using word-piece or byte-pair representations, the sequence length is typically smaller than the representation dimensionality . Consequently, self-attention layers are computationally faster than recurrent layers in practice, while fully enabling parallel computation across all positions within a training example.
To improve computational efficiency for tasks involving very long sequences where is large, self-attention can be restricted to attend only to a neighborhood of size centered around the respective output position. This restricted self-attention reduces the per-layer complexity to while keeping sequential operations at .
0
1
Tags
Prep Sessions
Foundational Deep Learning Architectures: Transformers and Residual Networks @ University of Michigan - Ann Arbor
Ch.2 Transformer Training and Evaluation - Foundational Deep Learning Architectures: Transformers and Residual Networks @ University of Michigan - Ann Arbor
Complexity and Path Lengths in Self-Attention - Foundational Deep Learning Architectures: Transformers and Residual Networks @ University of Michigan - Ann Arbor
Learn After
In natural language processing tasks using word-piece or byte-pair representations, why are self-attention layers typically computationally faster than recurrent layers?
In self-attention layers, computing representations requires waiting for earlier sequence positions to complete before later positions can be processed.
Why do standard recurrent layers require sequential operations to process a sequence of length ?
Explain the motivation, mechanism, and resulting computational profile (both per-layer complexity and sequential operations) of restricted self-attention for long sequences.