Bitpath

Lesson 2 · Unit 01

Embeddings

A lookup table that turns ids into meaning

12 exercisesabout 3 min

What you practise

  • A lookup table from token id to vector, similar meanings point the same way, the embedding matrix's shape, nearest neighbours by cosine similarity

Try a question from this lesson

Pick one

A tokenizer happens to give "cat" id 5, "dog" id 6 and "car" id 7. What does the fact that 6 lies between 5 and 7 tell a model about meaning?

The idea

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

Concept

The embedding table

The embedding matrix has one row per token in the vocabulary and d_model columns. Turning an id into its vector is a row lookup, nothing more.

Looking up several ids at once returns one row each, stacked: shape [tokens, d_model].

Python
import numpy as np
E = np.array([[0.1, 0.9],   # id 0
              [0.8, 0.2],   # id 1
              [0.7, 0.3]])  # id 2
print(E[2])             # one token
print(E[[0, 2]].shape)  # two tokens

10 more exercises in the app

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

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