Embeddings and Embedding Space
In this article
- Say what an embedding call takes and what it returns, and why the result is a short, learned list of numbers.
- Explain why vectors can be compared only when one model and version produced them.
- Read closeness on an embedding map as similar meaning to the model, and say what it never tells you.
- Spot a search, such as one for an exact error code, that meaning alone can miss.
- Terms defined here: dense vector, embedding space.
Overview
A customer of a home-internet provider writes "My Wi-Fi gets slow every evening". The help page that answers it says "Speeds can drop at peak times". The two share no word, so a search that matches words finds nothing, yet any person sees that they are about the same thing.
Semantic search, the vector search of Retrieval Methods for RAG, closes that gap: it copes with synonyms and rewordings that a word match misses. [5] It runs on embeddings: lists of numbers that a model places so that texts with similar meaning sit close together. [4]
By the end you can say what an embedding call takes and returns, why two vectors can be compared only when the same model made them, and what it means that a stored text sits near a question, and what that closeness never means.
Text in, numbers out
An embedding call is small. In Google's Gemini API you call embed_content with the name of an embedding model and the text, and you get back the text's embedding, a vector of numbers. [2] OpenAI's text-embedding-3-small returns 1,536 numbers for each text it embeds. [1]
Why a list like that, and not something simpler? The naive way to turn items into numbers gives every possible item its own slot. A menu of 5,000 dishes becomes 5,000 lists of 5,000 numbers, each all zeros except a single 1 that marks its dish. [3] Lists like that are long and mostly empty, and they make a model bigger and hungry for data and memory. [3] They also say which item you have and nothing more: every dish differs from every other dish in exactly two slots, so a hot dog is as far from a shawarma as from a soup.
An embedding replaces that with a dense vector, a much shorter list in which every number helps place the item. [3,4] Nobody picks those numbers by hand. Whoever trains the model sets the task and the length of the list (its dimensions), and training arranges the examples so that items related for that task end up close. [4] A single number in the list rarely means anything a person can name. [4]
Here is how embeddings fit into RAG, where a program first finds stored text and the model then answers from it. In a made-up example, Brightline, a home-internet provider, runs a support assistant that searches about 2,000 chunks, short stored pieces of its help pages, router manuals and staff handbook. Each chunk sits in the index with its text, its source id (the label that names the page it came from) and its text-embedding-3-small embedding. When a customer asks something, the search code embeds the question with the same model, compares that vector with the stored ones and keeps the top 3, the three nearest chunks. The model that writes the reply never sees a vector or a comparison: it receives the text of those three chunks and their source ids.
That shape is the usual one for semantic search: embed every stored entry once, embed each query into the same space, and return the stored entries closest to it. [5]
The map of meaning
Each list of 1,536 numbers is a position, and all the positions a model can produce form its embedding space. The distance between two positions stands for how related the model takes the two items to be: close means closely related in the model's picture of the data. [4]
A two-axis toy shows the idea. Place dishes by how much each is like a sandwich and how much like a dessert: a hot dog and a shawarma land side by side, and an apple strudel lands far from both. [4] A real space works the same way with many more axes than three, 1,536 for text-embedding-3-small, and its axes are seldom as easy to name as "dessertness". [1,4]
Now predict before you look. The question "My Wi-Fi gets slow every evening" goes into Brightline's space. Which chunk lands nearest: help-router-setup#1, on setting up the router; help-refunds#2, with the refund rules; or help-busy-hours#1, "Speeds can drop at peak times"?
On the made-up map it lands right next to help-busy-hours#1, with no word in common. "Gets slow" and "speeds can drop" say one thing, and so do "every evening" and "peak times", so a model trained on meaning puts them together. That is the strength of semantic search over a search that can only match the exact words. [5]
One model, one map
Positions mean something only inside the space of the model that made them, and that space depends on the job the model was trained for. [4] In a model that suggests dishes by time of day, cereal and breakfast sausage sit close; in a model that sorts dishes into vegetarian and not, they sit far apart. [4] Same two items, two maps, two answers to "are they close?".
Now take Brightline's index, filled with 1,536-number vectors. A teammate embeds 50 new help pages with Google's gemini-embedding-001, which returns 3,072 numbers by default. [2] Those vectors cannot join the index: a point with 3,072 coordinates and a point with 1,536 do not sit on the same map, so there is nothing to compare.
Matching the length would not save them. Google states that the spaces of its own gemini-embedding-001 and gemini-embedding-2 are incompatible, so their vectors cannot be compared directly and moving to the newer one means embedding all your data again. [2] If two models from one company do not share a map, you cannot assume a model from another company shares OpenAI's.
So an index belongs to one model. A change of model or version means embedding every chunk again, a full pass over all 2,000, and replacing the whole index; old and new vectors never sit side by side.
:::note In practice (Nov 2026) Anthropic does not offer an embedding model; its documentation points to Voyage AI. [6] Voyage's calls take an input_type of query or document, and the guide asks you to set it for every retrieval use, since it can give better vectors for search. [6] :::
What closeness tells you
The search code always finds a nearest chunk. Closeness tells you that the model represents the chunk and the question in a similar way, and nothing beyond that. Vector similarity captures how related two texts are in general; it does not judge whether a chunk answers the question. [1]
Two refund pages show the limit. Brightline keeps help-refunds, which allows refunds for 14 days, and an archived 2023 version that allowed 30. A refund question sits equally close to both, because both talk about the same thing in nearly the same words, and nothing on the map says which one is current.
The vector does not hold the refund rule either. It is a position the search code follows back to the chunk; the 14 days live in the chunk text. An embedding is a retrieval signal, never a store of facts.
Closeness is not confidence. A question about a service Brightline does not sell still has three nearest chunks, and they still come back in the top 3. Being nearest says how a chunk ranks against the other chunks, not that it is right. How well "near" tracks "relevant" also depends on the model's training: larger or more domain-specific training data generally gives better embeddings for that domain. [6]
Exact codes are the sharpest case. "What does E-42 mean?" may land nearer a general page on router errors, or the E-41 row, than the manual-bl-r7#e42 row that answers it, since the rows of one error table read almost alike. Product codes, error strings and names are a job for a search that matches the words themselves, which catches what a meaning search misses, and the reverse. [7]
:::note In an interview Asked what it means that two embeddings are close, say: the model represents the two texts in a similar way, inside that one model's space. [4] It is not evidence that the text is true or current, and vectors from two incompatible models cannot be compared directly. [2] :::
Reading the map at work
Treat an embedding as coordinates on one model's map. Before you compare two vectors, check that one model and version produced both; if not, embed again. Read closeness as a reason to open the chunk, and let other things judge the rest: the chunk text for what is true, its version for what is current, a word search for exact codes.
Common mistakes
- Reading the nearest chunk as the answer. The assistant quotes the archived 30-day refund page because it sat as close as the current one. Closeness picked a candidate; the page's version decides whether it is current.
- Re-embedding only part of the index. After a model upgrade, a teammate embeds just the changed pages with the new model and keeps the rest. Google states that even two of its own embedding models produce incompatible spaces, so embed every chunk again. [2]
Sources
- Develop a RAG Solution on Azure - Information-Retrieval Phase (Azure Architecture Center). Microsoft. Checked 21 Nov 2026.
- Embeddings | Gemini API. Google (Gemini API docs). Checked 24 Oct 2026.
- Google ML Crash Course: Embeddings. Google. Checked 24 Oct 2026.
- Google ML Crash Course: Embedding space and static embeddings. Google. Checked 24 Oct 2026.
- Sentence Transformers: Semantic Search. Hugging Face. Checked 24 Oct 2026.
- Embeddings. Anthropic. Checked 24 Oct 2026.
- Hybrid search overview (Pinecone docs). Pinecone. Checked 29 Oct 2026.
Check yourself
Check yourself
Question 1 of 13
What does an embedding call take in, and what does it return?
Your first check counts towards your result.