Definition
Transformer
A Transformer is a neural network architecture built from attention, feed-forward layers, and residual connections. It uses position information to represent the order of inputs. The original design has an encoder and decoder, while many language models use the decoder alone. Dense self-attention considers a number of position pairs that grows quadratically with sequence length.
Estimate how the number of attention pairs grows
An unmasked attention head over 256 positions makes a score for each of 65,536 query–key pairs. At 512 positions, there are 262,144 pairs, four times as many. This calculation describes dense attention scores for one head. Memory use and measured runtime also depend on masking, kernel implementation, hardware and the rest of the model.
Transformer architecture and attention complexity
Intelligence at Scale by Shashank Agarwal

Explained in
Chapter 3: Attention Is All You Need FreeThe paper behind every major AI model today. Google invented it. Then watched someone else ship it.
Related terms