Embedding
A list of numbers that captures what a piece of text means, so a computer can find documents by meaning instead of by exact words.
What Is an Embedding
An embedding turns a piece of text into a long list of numbers, usually a few hundred to a few thousand of them. Texts with similar meaning end up with similar numbers. “Supplier raised the unit price” and “vendor increased what they charge per item” share almost no words, but their embeddings sit close together.
That lets you search by meaning. You compare the numbers for a question with the numbers for every passage you stored, and the closest ones are the most relevant.
Why it matters to you
Keyword search fails when people phrase things differently from the document. An employee asks “can I expense a client dinner?” and the policy says “hospitality costs incurred with third parties”. Embeddings connect the two.
This is the search step behind retrieval-augmented generation (RAG). Your contracts, policies and procedures are split into chunks, each chunk gets an embedding, and the embeddings go into a vector database. When someone asks a question, the system embeds the question, pulls the closest chunks and hands them to a language model to write a cited answer. If your documents cannot leave your own servers, the same setup runs with an open source embedding model on your hardware. That is what private RAG covers.
A short example
Creating an embedding is one API call. With the OpenAI Python SDK:
from openai import OpenAI
client = OpenAI()
result = client.embeddings.create(
model="text-embedding-3-small",
input="Payment terms: net 45 days from invoice date.",
)
vector = result.data[0].embedding # a list of 1,536 numbers
You store vector next to the original text and a link to its source document. The vector database then finds the stored vectors closest to the question’s vector.
What it costs
Embedding is cheap compared with generating answers. As of November 2026, OpenAI lists text-embedding-3-small at $0.02 per million tokens. A million tokens is very roughly 750,000 words, so embedding a few thousand pages of policies costs cents. The real money goes elsewhere: cleaning and splitting documents, hosting the vector database, and the model calls that write the answers. Plan for re-embedding too. Vectors from different models cannot be mixed, so switching models means processing every document again.
Common embedding models
| Model | Dimensions | Provider |
|---|---|---|
| text-embedding-3-small | 1536 | OpenAI |
| text-embedding-3-large | 3072 | OpenAI |
| voyage-3 | 1024 | Voyage AI |
| all-MiniLM-L6-v2 | 384 | Open source |
For storage, Pinecone and Weaviate are managed options, and pgvector inside PostgreSQL is often good enough.
What embeddings do not do
They handle exact values poorly. “Invoice over $10,000” and “invoice under $10,000” look nearly identical as embeddings. Filters on amounts, dates and IDs belong in normal database fields stored next to the vector.
They do not answer questions. They find candidate passages. A language model still has to read them, and a person still checks anything that matters.
They do not enforce access rights. If a junior analyst should not see board minutes, that rule has to be applied in the search step.
They do not fix bad source material. Poor scans and tables split across chunks give poor matches. The embeddings explainer and chunking strategies cover how to get retrieval right.