Bitpath

Lesson 1 · Unit 02

Self-attention

Queries, keys, values and a weighted mix

12 exercisesabout 3 min

What you practise

  • Queries, keys and values, scores by dot product, softmax weights, a weighted mix of values, computed for a three-token example

Try a question from this lesson

Pick one

"The trophy did not fit in the suitcase because it was too big." To represent "it" well, which other token does the model most need information from?

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Query, key, value

Every token gets three vectors, each made from its own vector by a learned matrix.

The score between token i and token j is the dot product of i's query with j's key: high when j has what i is looking for. The values are what actually gets passed along.

query  q   what am I looking for?
key    k   what do I contain?
value  v   what do I hand over?

score(i, j) = q_i . k_j

10 more exercises in the app

  • 4× multiple choice
  • 2× type the answer
  • 1× fill the blanks
  • 1× order the lines
  • 1× true or false
  • 1× match the pairs

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy