Bitpath

Boss lesson · Unit 01

Order matters

From a string to the tensor the model reads

13 exercisesabout 3 min

What you practise

  • Attention alone can't see word order
  • Positional encodings added to embeddings
  • The context window
  • The full input pipeline from a string to a [tokens, d_model] tensor

Try a question from this lesson

Pick one

An embedding lookup turns "dog" into the same row every time. In "dog bites man" and "man bites dog", how do the three input vectors differ?

The idea

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

Concept

Add a vector for the position

A simple fix: a second table with one row per position. Row 0 is added to the first token's embedding, row 1 to the second, and so on.

Now the same token at two positions enters the model as two different vectors. Some models compute position information with a formula instead of learning a table, but the idea is the same.

tokens    E[ids]        [tokens, d_model]
positions P[0..n-1]     [tokens, d_model]
input     E[ids] + P    [tokens, d_model]

11 more exercises in the app

  • 4× type the answer
  • 1× true or false
  • 3× multiple choice
  • 1× fill the blanks
  • 1× order the lines
  • 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