What is an Attention Mechanism?

The attention mechanism is the core neural-network technique that lets a model weigh the relevance of every other token in its input when computing the representation of a given token, rather than processing the sequence strictly in order.

Before attention, sequence models like RNNs processed text step by step, compressing everything seen so far into a fixed-size hidden state — a bottleneck that made it hard to retain information from far earlier in a long input. Attention instead lets each position in the sequence directly compute a weighted combination of every other position, so a word late in a document can draw directly on a word from the very beginning without that information having to survive being compressed through every step in between. The transformer architecture — the basis of virtually every modern large language model — is built around "self-attention," where the model computes, for each token, how much it should attend to every other token, using learned query/key/value projections. This is what lets transformers process an entire input in parallel rather than sequentially, which is also why they scale so much better on modern GPU hardware than older recurrent architectures did. Attention is also the mechanism behind context length limits and their cost: naive self-attention cost grows quadratically with sequence length, which is exactly why longer-context models require specialized, more efficient attention implementations rather than just scaling the naive version up.

In practice with Neotask

The long-context reasoning that lets a Neotask agent hold an entire multi-tool conversation and a large pulled-in document in view at once, and still correctly reference something mentioned many turns earlier, is a direct product of the attention mechanism inside the underlying model.

Related terms

Start free

Plans

Free

$0/mo

Download without a card and start for free.

Individual

$50/mo

The full personal agent platform for one person.

Enterprise

$200/mo

Multiple workspaces and capacity for larger teams.

Continue