Skip to content
mentoor

Attention and transformers (intuition)

For engineers

How a transformer decides which earlier tokens matter, why attention cost grows with context, and how blocks stack into a model

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

In "The backup job slowed the server because it was copying two terabytes of files", what decides what "it" refers to?

Choose one answer

Check yourself · 2 of 5

In attention, what is compared with a token's query to produce a score?

Choose one answer

Check yourself · 3 of 5

What is the main benefit of using many attention heads in a layer?

Choose one answer

Check yourself · 4 of 5

What does the causal mask do in a decoder model?

Choose one answer

Check yourself · 5 of 5

A prompt grows from 2,000 to 4,000 tokens. Roughly how does the attention score grid change?

Choose one answer

Topics

  1. Why tokens need context from others3 min read · A word's meaning depends on earlier words, and fixed-size memory in older networks lost long-range links
  2. Queries, keys and values as lookup4 min read · Attention as a soft lookup: each token asks a question, scores every earlier token and mixes their values
  3. Many attention heads across layers4 min read · Why many small attention patterns in many layers beat one big one, and what single heads learn
  4. Inside one decoder transformer block5 min read · Attention, the feed-forward layer, residual connections, normalization, position encoding and the causal mask
  5. Attention cost and long-context tricks5 min read · Attention cost grows with the square of context length; KV caching, grouped-query and sliding-window attention cut it

Start here

110 questions · last verified 2026-12