# Embeddings: how text becomes a list of numbers > An embedding turns text into a list of numbers so that similar meaning lands close together. How that powers search and RAG, where it fails, and what the vectors cost to store. Source: https://rfriedmann.de/blog/embeddings-explained/ Published: 2026-11-18 · Track: learn · Level: Beginner When people ask for "a search that understands what I mean", the part doing the understanding is usually not a chat model. It is an embedding model: a separate model that reads a piece of text and returns a fixed-length list of numbers. imp, the inference engine I build, serves one (nomic-embed-text) at `/v1/embeddings`, next to the chat models. This post covers what those numbers are, how they get compared, and where they stop working. ## A vector is a position A vector is an ordered list of numbers. Two numbers are a point on a map: how far across, how far up. Three numbers are a point in a room. An embedding is the same idea with many more numbers. The [nomic-embed-text v1.5 model card](https://huggingface.co/nomic-ai/nomic-embed-text-v1.5) lists 768 of them per text, OpenAI's [embeddings guide](https://developers.openai.com/api/docs/guides/embeddings) lists 1,536 for `text-embedding-3-small` and 3,072 for `text-embedding-3-large`. Nobody can picture 768 directions, but the arithmetic is the same as on the map. The training is what makes the position mean something. "How do I reset my password" and "credential recovery steps" share no words, but they end up near each other. "How many vacation days do I have left" ends up somewhere else entirely.
Similar meaning, nearby points (sketch)
[diagram omitted — see the page for the chart]
The idea in two dimensions. The query shares no word with "credential recovery steps" but lands next to it, so a search by distance finds it. Positions in this drawing are illustrative, not computed.
## Measuring closeness: cosine similarity Draw each vector as an arrow from a common starting point. Cosine similarity ignores how long the arrows are and only looks at the angle between them. Same direction gives 1, a right angle gives 0, opposite directions give -1. A search ranks its results by this number: the higher, the closer in meaning.
Cosine similarity looks at the angle
[diagram omitted — see the page for the chart]
Only the direction counts. Two texts about the same thing point the same way, regardless of how long either text is.
One practical detail: OpenAI states that its embeddings are normalized to length 1, so cosine similarity becomes a plain dot product, and cosine and Euclidean distance give the same ranking. Comparing vectors is multiply-and-add, which is why a vector search can check large collections quickly. ## Why meaning beats keywords, and where it doesn't Keyword search finds documents that contain the words you typed. It fails as soon as people use different words for the same thing: the wiki says "credential recovery", the user types "can't sign in". An embedding search turns every document chunk into a vector in advance, turns the question into a vector at query time, and returns the chunks whose vectors sit closest. No shared word is needed. It fails on exactly the things keyword search does well: - **Exact names.** A rare product or person name carries little meaning of its own. Its vector lands near whatever the name resembles, not necessarily near the one document that mentions it. - **Numbers and IDs.** Ticket `INC-40512` and ticket `INC-40521` are two different incidents, but as text they are almost identical. Version numbers, part numbers, error codes: anything where one character changes the meaning. - **Opposites on the same topic.** Embeddings capture what a text is about. "The printer supports duplex" and "the printer does not support duplex" are about the same thing, so they can sit close together. The common fix is to run both and merge the results, usually called hybrid search: keyword search for exact terms, embeddings for meaning. If your users search for ticket numbers, keep the keyword index. ## What embeddings power - **Semantic search** over an intranet, a ticket history or documentation. - **RAG**, the retrieval half of [pointing an LLM at your own documents](/blog/your-own-documents/): the closest chunks go into the prompt, and the chat model answers from them. - **Clustering**: group a pile of support tickets by topic without defining the categories first. - **Deduplication**: near-identical vectors flag the same content in different words, such as duplicate tickets or three copies of one policy. OpenAI's guide adds recommendations, anomaly detection and classification to that list. Embeddings are one of the [families of AI that aren't chat models](/blog/ai-that-isnt-an-llm/), and they are often the more useful one in a company. ## Embedding model vs chat model They do different jobs. A [chat model](/blog/what-is-an-llm/) reads text and writes new text, one token at a time. An embedding model reads text and returns one vector; it generates nothing, so it runs one pass over the input and stops. Two rules follow from that: 1. **Documents and queries must come from the same model.** Each model builds its own space. A vector from one model compared with a vector from another is a meaningless number. Switching embedding models means re-embedding every document. 2. **Read the model card for input rules.** The nomic card says the text must start with a task prefix such as `search_query:` or `search_document:`. The model still returns a vector without it, so a missing prefix produces no error. Inputs also have a length limit, measured in [tokens](/blog/why-models-cant-spell/): 8,192 for nomic-embed-text v1.5 and for both OpenAI models above. In practice you split documents into chunks long before that, because one vector for a whole manual says little about any single page of it. ## Dimensions and storage cost Every number in a vector is typically stored as a 32-bit float, 4 bytes. One 768-dimension vector is 768 × 4 = 3,072 bytes. For one million chunks that is 3,072 × 1,000,000 = 3.07 GB, before any search index on top.
Raw storage for one million vectors (32-bit floats)
[diagram omitted — see the page for the chart]
Dimensions × 4 bytes × 1,000,000. Dimension counts from the nomic model card and the OpenAI embeddings guide; the arithmetic is mine. Index structures add to this.
You can trade size for a little accuracy. The nomic v1.5 card supports 768, 512, 256, 128 and 64 dimensions and describes it as trading size for a small drop in performance. OpenAI offers a `dimensions` parameter that removes numbers from the end of the vector. At 256 dimensions the same million chunks need 256 × 4 × 1,000,000 = 1.02 GB. Whether the shorter vector is still good enough is something to test on your own documents, not to assume. ## Reranking: the second pass Embedding search is fast because the document vectors were computed in advance: at query time the question and the documents never meet inside a model, only their vectors get compared. A reranker reads them together. [Qwen3-Reranker](https://huggingface.co/Qwen/Qwen3-Reranker-0.6B), which imp serves at `/v1/rerank`, takes a query and one document as a pair and turns the model's probability for "yes" versus "no" into a relevance score. It comes in 0.6B, 4B and 8B sizes. Because it sees both texts at once, it can judge whether a passage answers the question, not only whether it is on the same topic. The price is one model call per pair, so it can't run over a million chunks per question. The usual pipeline has two steps: embeddings narrow a large collection down to a short list, say the top 50, the reranker reorders that list, and only the top few go to the chat model. ## Bottom line An embedding is a position: text in, a fixed-length list of numbers out, trained so that similar meaning lands close together. Cosine similarity measures that closeness by angle. It finds "credential recovery" when someone types "can't sign in", and it is unreliable for names, IDs and numbers, so keep keyword search next to it. Use the same model for documents and queries, budget 4 bytes per dimension per chunk, and add a reranker when the top results are on topic but not quite right.