Self-Attention Mechanism
A core component of the Transformer architecture that computes relevance weights between positions in a sequence using three matrices: Query, Key, and Value. This enables the model to capture long-range dependencies within the input sequence.
Core Facts
The Transformer's core innovation is the self-attention mechanism, which allows models to attend to all positions in the input simultaneously rather than processing step-by-step like RNNs or LSTMs
The computational complexity of the self-attention mechanism grows approximately quadratically with sequence length, with the attention matrix computation being proportional to n² for a sequence of length n.
Set Transformer models interactions between row vectors based on the self-attention mechanism and maintains permutation invariance by removing positional encodings.
Timeline (last 90 days)
Local patch tokens directly read global [CLS] information via the self-attention mechanism (direct readout), and this phenomenon occurs before the emergence of high-norm tokens and attention sinks.
The computation of the self-attention mechanism in the denoising process of diffusion models grows quadratically with image resolution.
When the sequence length n increases from 128k to 1M, the number of elements in the attention matrix grows by about 64 times.
In standard self-attention, each query computes similarity with all keys, with a computational cost of O(n²d), where n is the sequence length and d is the head dimension.
The self-attention mechanism allows the model to directly attend to relevant information at any time step in the history, without needing to pass hidden states step by step as an RNN does.
Mainstream Transformers use the self-attention mechanism, and the computation and memory usage of the standard implementation grow quadratically with sequence length.
The causes of the lost-in-the-middle phenomenon are usually attributed to the decay effect of positional encoding, the fact that beginning and end content in training data is more often associated with answers, and the dilution of the attention softmax over long sequences.
The Transformer's encoder uses only self-attention, while the decoder alternates between self-attention and cross-attention.
In the standard self-attention mechanism, each token needs to compute relevance with all other tokens in the sequence, and the computational complexity is approximately the square of the sequence length (O(n²)).
The final output of self-attention is obtained by weighted summation of the Value vectors using the attention weights.
11 more timeline events
All Facts (20)
The Transformer's core innovation is the self-attention mechanism, which allows models to attend to all positions in the input simultaneously rather than processing step-by-step like RNNs or LSTMs
90%VerifiedThe computational complexity of the self-attention mechanism grows approximately quadratically with sequence length, with the attention matrix computation being proportional to n² for a sequence of length n.
90%VerifiedSet Transformer models interactions between row vectors based on the self-attention mechanism and maintains permutation invariance by removing positional encodings.
90%VerifiedThrough the self-attention mechanism, Transformer allows the model to dynamically attend to all other tokens in the sequence when processing each token, while enabling fully parallelized training.
90%VerifiedThe self-attention mechanism allows the model to simultaneously reference the contextual information of all other tokens in a sequence when processing each token, rather than processing sequentially as RNNs do
90%VerifiedThe key innovation of the Transformer is the self-attention mechanism, which allows the model to simultaneously attend to information from all other tokens in the input sequence when processing a single token.
90%VerifiedThe Transformer architecture was proposed in 2017 by the Google Brain team in the paper "Attention Is All You Need"
90%VerifiedThe core innovation of the Transformer is replacing RNN's sequential processing with a self-attention mechanism, enabling highly parallelized training, while abandoning the RNN's hidden-state cross-timestep propagation mechanism.
80%VerifiedEach Transformer layer contains two core sub-modules: multi-head self-attention and a feed-forward neural network.
80%VerifiedThe self-attention mechanism of the Transformer allows the model to directly compute dependencies between any two positions in a sequence, breaking through the parallelization bottleneck caused by the sequential computation of RNNs/LSTMs.
80%VerifiedThe Transformer's encoder uses only self-attention, while the decoder alternates between self-attention and cross-attention.
75%VerifiedWhen resolution doubles, the attention computation the model must handle often grows fourfold or more, causing elapsed time to increase non-linearly.
75%VerifiedThe Transformer architecture completely replaces recurrent structures with multi-head self-attention mechanisms, eliminating the sequential computation bottleneck and resolving the long-range dependency problem.
75%VerifiedLarge model output generation uses an autoregressive approach to produce tokens one by one, requiring recalculation of attention over all preceding context with each token generated.
70%VerifiedIn the standard attention mechanism, the Query matrix and Key matrix perform matrix multiplication to obtain an n×n attention score matrix, with a computational complexity of O(n²·d).
70%VerifiedMainstream Transformers use the self-attention mechanism, and the computation and memory usage of the standard implementation grow quadratically with sequence length.
65%VerifiedTransformers process text sequences in parallel through self-attention mechanisms and can capture long-range dependencies, unlike traditional RNNs.
65%VerifiedThe self-attention mechanism linearly transforms the input sequence into three matrices—Query, Key, and Value—with attention weights obtained by multiplying Q by the transpose of K, normalizing via Softmax, and then multiplying by V to produce the output.
65%VerifiedThe self-attention mechanism determines which other positions in the sequence each position should attend to by computing the dot-product similarity between the Query and all Keys.
65%UnverifiedThe final output of self-attention is obtained by weighted summation of the Value vectors using the attention weights.
70%