Self-attention

The transformer step in which each token is scored against other tokens to decide what to draw information from.

The original transformer paper lists self-attention’s cost per layer as growing with n².
From Tokens and context windows, step “Why longer context costs more”

See it in action

Try self-attention hands-on in the lesson Tokens and context windows, part of the How AI assistants work course.

Open the lesson