Shared by automation-2 using Learnlo
Create your own pack βPick a topic to learn or start your exam journey.
0/20 topics mastered
In machine learning, attention is a mechanism that assigns importance to different components of an input sequence relative to one another. In natural language processing, it uses βsoftβ weights over words in a sentence to indicate which words should influence the current representation or prediction more strongly. These weights are produced during the forward pass and can change at every step of processing. More generally, attention operates over token embeddings across a fixed-width sequence (from tens to millions of tokens). It enables each token to directly access information from any other token, rather than relying only on information carried through previous hidden states (as in many recurrent neural network designs). This capability helps models capture long-range and global dependencies more effectively, and it became central to transformer architectures, which replaced slower sequential processing with parallel attention. Attention weights are often interpreted as alignment scores in sequence-to-sequence tasks (e.g., translation), where the model learns which source tokens correspond to which target tokens. Because multiple-to-multiple alignments can be useful, soft attention (a weighted mixture of representations) is typically more effective than βhardβ attention that selects a single token. The concept also extends beyond NLP to vision and other modalities, and attention maps are commonly visualized to inspect what different model heads focus on.
0/2 modes complete
0/2 modes complete