Embeddings and Vector Databases
A customer types "Can I send my bike back?". Pedal Point has a page titled "Returns policy" that answers exactly this. The old keyword search finds nothing, because the two texts share no useful words. People search by meaning; computers searched by spelling. Embeddings close that gap.
The rule
Embeddings turn meaning into coordinates; close points mean similar meaning.
An embedding model reads a piece of text and outputs a vector: a fixed-length list of numbers, often hundreds or thousands long. You can picture each vector as a point in a space with many dimensions.
The model is trained so that texts with similar meaning land near each other:
- "Can I send my bike back?" and "Returns policy" land close.
- "How do I fix a squeaky brake?" lands somewhere else entirely.
"Near" is measured with a similarity score. The most common is cosine similarity, which compares the direction two vectors point. Pointing the same way scores close to 1; unrelated directions score near 0.
A vector database stores many vectors, each linked to its original text and some labels, and answers one question fast: "Which stored vectors are nearest to this one?" With millions of vectors, checking every one is slow, so these databases use clever indexes that find very good matches without comparing everything.
Embeddings power semantic search, recommendations ("customers who read this also read"), grouping similar tickets, and spotting unusual ones. They are also the heart of the next lesson, RAG.
The shortcut
Embed both sides with the same model, then take the nearest neighbours. Documents are embedded once, ahead of time. Each question is embedded when it arrives.
Prepare once
Every help page is embedded and stored in the vector database with its title and text.
The trap is mixing models. Vectors from two different embedding models live in different spaces, so comparing them gives nonsense. Change the model, and you must re-embed everything. Store the name of the embedding model alongside your vectors so you always know which space they live in.
Drills
Answer fast — trust the rule.
What does an embedding model output for a piece of text?
Why can embedding search match "send my bike back" to "Returns policy" when keyword search cannot?
Which pair of 2-number vectors points in the most similar direction?
The team switches to a new embedding model for questions but keeps the old document vectors. What happens?
Remember
- Embeddings turn meaning into coordinates; close points mean similar meaning.
- Embed both sides with the same model, then take the nearest neighbours.
- New embedding model means re-embedding everything.
