Turning Text Into Numbers: Embeddings
embeddings
Part of: Chat With Your PDF
You have a pile of text chunks. To find the ones relevant to a question, you need to compare meaning, and a computer can't compare meaning directly. It compares numbers. An embedding is how you turn meaning into numbers it can work with. What an embedding is An embedding model takes a piece of text and returns a vector : a fixed-length list of floating-point numbers, often a thousand or more, that places the text's meaning as a point in space. Texts about similar things point in similar directions. "The cat sat on the mat" and "a feline rested on the rug" land close together even though they share no words. That closeness is the whole basis of RAG search. Calling an embedding model Anthropic recommends Voyage AI for embeddings. You call it like any other model API: text goes in, vectors come back. You embed every chunk once , right after chunking, and store each vector next to its chunk text. At query time you embed the user's question with the same model and compare that one vector against every stored chunk vector. Same embedding call, different input. Vectors as plain lists of numbers Strip away the API and a vector is just [0.12, -0.87, 0.33, ...]. Two measurements carry the re
Challenge: Rank Vectors by Magnitude