What are embeddings?
An embedding is a list of numbers that captures what a piece of text means. Similar meanings get similar numbers, which lets an app search by meaning instead of exact words.

Key takeaways
- An embedding is a vector (a list of hundreds or thousands of numbers) that represents the meaning of a text, image or other item.
- Items with similar meaning get vectors that are close together, measured with cosine similarity or a similar distance.
- Apps use embeddings for semantic search, "related items", duplicate detection, and retrieval for RAG.
Embeddings are numerical representations of content, usually text, produced by an AI model as a list of numbers called a vector, arranged so that pieces of content with similar meaning end up with similar numbers. They let software compare meaning with arithmetic: "how close are these two vectors?" stands in for "how related are these two ideas?"
An everyday picture is a map of a city's restaurants. Two sushi bars sit near each other in one district, pizza places cluster in another, and a fusion spot sits between them. Embeddings place every sentence on a map like that, except the map has hundreds of directions instead of two, and "near" means "about the same thing".
How they work in practice
- 01Embed your content. Send each item (a help article, a product description, a paragraph of a long document) to an embedding model and get back a vector, for example 1,024 numbers. Store it next to the item.
- 02Embed the query. When a user searches "my card got declined", embed that sentence the same way, with the same model.
- 03Find the nearest. Compare the query vector with the stored ones, usually by cosine similarity, and return the closest items. "Payment failed: what to do" comes back first, even though it shares almost no words with the query.
Long documents are split into chunks first (a few paragraphs each is a common starting point), because one vector for a 40-page manual blurs everything together.
What apps use them for
- Semantic search: a recipe app where "something warm for a rainy night" finds soups and stews.
- Related items: "you might also like" for articles, listings or courses, without hand-tagging.
- Duplicate and near-duplicate detection: spotting the same support question asked in different words.
- Clustering: grouping thousands of feedback comments into themes.
- Retrieval for AI answers: finding the passages a language model should read before answering (what RAG is).
Embeddings in an app built with Startbase
Startbase Cloud gives your app a Postgres database (database docs). Postgres has a widely used extension, pgvector, that stores vectors in a column and finds nearest neighbors with an index, and Supabase supports it. Creating the vectors needs an embedding model from an AI provider; keep that provider's key in your project's Secrets so it is used only by server-side functions (API keys and secrets). Ask the agent to plan the setup first, since the right chunk size and refresh strategy depend on your data.
Plan semantic search for the recipes table. When a recipe is created or edited, a server function should create an embedding of its title, ingredients and description using my embedding API key from Secrets, and store it in a vector column. The search box should embed the query the same way and return the 10 closest recipes, with a fallback to plain text search if the embedding call fails. Tell me what tables, indexes and functions you will add before building.
Common confusions
- Embeddings vs keyword search. Keyword search matches words; embeddings match meaning. Many good search boxes combine both, because exact names and codes still need keyword matching.
- Mixing models. Vectors from two different embedding models are not comparable. If you change models, re-embed everything.
- Embeddings are not the text. You cannot reliably read the original back out of a vector, but treat vectors of private data as sensitive anyway.
- Embeddings vs an LLM. An embedding model outputs numbers for comparison; a language model outputs text. RAG uses both.
Frequently asked questions
Do I need a separate vector database?
Not for most apps. A Postgres extension such as pgvector handles many thousands to millions of vectors well. Dedicated vector databases make sense at very large scale or with special needs.
Are embeddings expensive?
Creating embeddings is typically much cheaper per token than generating text, and you embed each item once. Searching is just a database query.

