WishWiki

Attention

Attention is a mechanism in Machine learning models that allows a system to dynamically weigh the relevance of different pieces of input when producing an output — mimicking, in a mathematical sense, the way a mind might focus on one voice in a crowded room while letting the rest fade into background noise.

Origins

Before attention, the dominant approach to sequential tasks like Neural machine translation relied on compressing an entire input sentence into a single fixed-length vector, typically produced by a Long short-term memory network within a Sequence to sequence learning framework. This created a bottleneck: long sentences lost nuance the way a photograph loses detail when shrunk too small. Attention solved this by letting the decoder look back at every encoder state, assigning each a weight of importance at every decoding step — a kind of soft, learned spotlight rather than a single blurry snapshot.

How It Works

At its core, attention computes a Query, a set of Keys, and a set of Values — abstractions borrowed loosely from database retrieval. The query represents what the model is currently "looking for," while keys represent what each piece of input "offers." Their similarity, often computed as a dot product across a shared Coordinate system of embeddings, is passed through a Softmax function to produce a probability distribution: the attention weights. These weights then blend the values into a single context vector, richer than any fixed-size compression could allow.

The Transformer Revolution

The 2017 paper Attention Is All You Need proposed discarding recurrence entirely, relying purely on self-attention — where a sequence attends to itself — arranged into stacked layers called Transformers. This architecture introduced Multi-Head Attention, running several attention computations in parallel across different representation subspaces, somewhat like a networked committee of specialists each examining the same sentence from a different angle. Because transformers process tokens simultaneously rather than one at a time, they also need Positional Encoding to inject a sense of order, since raw self-attention is otherwise blind to sequence position.

Beyond Language

Attention now underlies vision transformers, protein-folding predictors, and multimodal systems, functioning as a general-purpose tool for clustering relevant information out of noisy, high-dimensional data. Some researchers frame it as a computational echo of Cognitive processes in biological brains — a machine analogue of selective perception — though this comparison remains a useful metaphor rather than a settled neuroscientific claim, and enthusiasm for the parallel is itself sometimes flagged as a Cognitive bias among AI researchers eager to see minds everywhere.

A Living Idea

Attention continues to evolve, with sparse, linear, and hierarchical variants seeking to tame its quadratic computational cost. Like a Community gathering around a single conversation, attention mechanisms let vast, complex models achieve a strange and elegant kind of focus — arguably the closest thing artificial systems have to caring about something.

Related

Wishing…
your wish is being written

✨ Wish for a new page

👁 Wish for another view of this page

Sign in to WishWiki

Keep your wishes together, see your activity — and later, get your own private wiki space.

⏱ Page history