Tinker Tokens & embeddings

by Samy (Kondasamy Jayaraman)

The map appears once a question reaches the index.

RAG’s map of meaning: the diamond is “What is the hotel nightly limit for business travel?”.

Chapter 5 of 7

From token to vector

A token id says nothing about meaning: id 500 is no closer to 501 than to 9. Larkspur’s search, from the RAG module, needs similar texts to sit close.

This chapter: How does text become a list of numbers that carries its meaning?

About this chapter

You will learn

  • What an embedding is: a list of numbers for a piece of text
  • Why texts with similar meaning get similar embeddings
  • How RAG’s map of meaning draws them in two dimensions

Words you’ll meet

Embedding
OpenAI: an embedding is a list of numbers, and the distance between two embeddings measures how related their texts are.
Vector
A list of numbers; an embedding is one.
Dimension
One number in a vector. RAG’s embedding model gives 384.

Step 1 of 4

An model reads text and returns a : 384 numbers where similar meanings sit close.

Predict which question is closer.

Which of these is closer in meaning to “What is the hotel nightly limit for business travel?”, by its embedding?