attention mechanism
The process by which transformers let word vectors incorporate information from each other (pay attention) through matrix operations, contextualizing them across layers.
As defined in 336 | Anil Ananthaswamy on the Mathematics of Neural Nets and AI
Other definitions
A neural network component that computes weighted combinations of input elements, allowing the model to focus on the most relevant parts of the input and learn which elements are important for the task
Harvard Presents NEW Knowledge-Graph AGENT (MedAI)In Transformers, the mechanism allowing the model to compare and weight the importance of different words to each other when processing sequences, enabling context-sensitive understanding
AI: Grappling with a New Kind of Intelligence | World Science Festival
Where it comes up · 8
- Illustrated Guide to Transformers Neural Network: A step by step explanation4 claims
- 248 | Yejin Choi on AI and Common Sense3 claims
- 10 years of NLP history explained in 50 concepts | From Word2Vec, RNNs to GPT3 claims
- Jeff Dean & Noam Shazeer — 25 years at Google: from PageRank to AGI2 claims
- Is RAG Still Needed? Choosing the Best Approach for LLMs2 claims
- Why a Forefather of AI Fears the Future | World Science Festival1 claim
- 336 | Anil Ananthaswamy on the Mathematics of Neural Nets and AI1 claim
- Demis Hassabis — Scaling, superhuman AIs, AlphaZero atop LLMs, AlphaFold1 claim
Most important claims · 10 of 17Search all claims for “attention mechanism” →
- In a transformer, input words are turned into high-dimensional vectors (embeddings) that flow through the network; the attention mechanism repeatedly massages these vectors layer by layer so each word's vector incorporates contextual information from the others, so that by the final layer the last vector carries enough context to predict the next word correctly (e.g., 'homework' after 'the dog ate my').336 | Anil Ananthaswamy on the Mathematics of Neural Nets and AI
- There is an intuitive assumption that if data is in the context window, the model will use it, but research suggests otherwise: as context windows grow to 500,000 tokens, the model's attention mechanism becomes diluted, and the model often fails to retrieve or hallucinates details from text that is buried in the middle of very large documents.Is RAG Still Needed? Choosing the Best Approach for LLMs
- Information memorized in model parameters is memory-efficient (roughly one fact per parameter) but squishy, leading to hallucination and confused facts because trillions of tokens are churned together; information in the context window is sharp and clear thanks to the attention mechanism, but each token costs far more memory (kilobytes to a megabyte of keys and values per token across layers), creating a fundamental trade-off.Jeff Dean & Noam Shazeer — 25 years at Google: from PageRank to AGI
- RNNs suffer from short-term memory because they have a shorter window to reference from compared to GRUs and LSTMs, which have greater capacity to achieve longer-term memory with a longer reference window.Illustrated Guide to Transformers Neural Network: A step by step explanation
- The attention mechanism in theory has an infinite window to reference from given enough compute resources, allowing it to use the entire context of a sequence while generating text, unlike RNNs which cannot access words generated earlier.Illustrated Guide to Transformers Neural Network: A step by step explanation
- GPT-2, a transformer model developed by OpenAI, demonstrated the attention mechanism's ability to generate coherent long-form text (a sci-fi novel continuation) by learning to attend to relevant previous words during generation.Illustrated Guide to Transformers Neural Network: A step by step explanation
- Transformers leverage the power of the attention mechanism to make better predictions compared to recurrent neural networks which suffer from short-term memory, particularly for encoding or generating longer sequences.Illustrated Guide to Transformers Neural Network: A step by step explanation
- Neuroscience has provided directional inspiration for key AI breakthroughs including reinforcement learning, attention mechanisms, and the general principle that general intelligence is possible, even though the specific implementations in AI systems don't map one-to-one to brain mechanisms.Demis Hassabis — Scaling, superhuman AIs, AlphaZero atop LLMs, AlphaFold
- The naive attention algorithm is quadratic, so it can barely be made to work for millions of tokens even on substantial hardware and has no hope of naively scaling to trillions of tokens; reaching trillion-token context (the entire internet, all a user's personal data, all of Google's source code) will require interesting algorithmic approximations that let the model conceptually attend to vastly more tokens.Jeff Dean & Noam Shazeer — 25 years at Google: from PageRank to AGI
- The seminal 2017 paper 'Attention is All You Need' introduced Transformers, which replaced RNNs entirely with attention mechanisms as encoder-decoder architectures, with the ripple effects of this innovation still felt today.10 years of NLP history explained in 50 concepts | From Word2Vec, RNNs to GPT