What is the core job of the self-attention mechanism in a Transformer?
- It compresses the whole sequence into one fixed-length context vector before the feed-forward layers
- It lets each token gather information from other tokens, weighted by learned relevance
- It applies a fixed convolution kernel across each token and its immediate neighbours
- It carries a recurrent hidden state forward from the first token to the last
Why
Self-attention lets every position attend to every other and form a context-weighted mixture, so meaning depends on the whole sequence. It is not a single bottleneck vector (that was seq2seq), not a fixed convolution (weights are content-dependent), and not recurrent (positions run in parallel).