A vector database typically stores embeddings together with an identifier (ID), optional metadata (like filenames, timestamps, or URLs), and an index structure that enables fast similarity search. The embedding is the key piece used for semantic search.
What is an embedding?
An embedding is a numeric representation of some input — an image, a sentence, a short audio clip, etc. Instead of storing raw pixels or words, a model encodes the meaning or features of that input as a list (vector) of floating-point numbers. Think of a zip code: it’s a small numeric label that tells you where someone lives. An embedding is similarly compact but encodes semantic properties and relationships learned by a machine learning model.Three important facts about embeddings
-
They are arrays of floating-point numbers
Embeddings are vectors — arrays of decimal numbers such as: 0.82, 1.4, 0.3, … The vector dimensionality is commonly in the hundreds or thousands depending on the encoder model. -
They are generated by machine learning models
A neural encoder (or similar model) takes the raw data and outputs the vector automatically. You don’t handcraft these values — models learn to place similar concepts near each other in vector space.

- They capture semantic meaning (features) of the original data
Embeddings encode high-level concepts and features — not raw pixels or literal words — so items with similar meanings are close together in the vector space.
A concrete example
Imagine a photo of a sunrise over a mountain. An encoder model converts that image into a vector — a list of floating-point values that capture concepts like “sunrise,” “mountain,” and “warm colors.” These numbers don’t map directly to pixels; they encode the learned features that describe the image’s content. Example of a (shortened) embedding vector:
How this enables semantic search
When you query a photo collection with the word “dog,” the system:- Converts the text query into a query embedding using a compatible encoder model,
- Computes similarity between the query embedding and stored image embeddings using a similarity metric (cosine similarity, dot product, or Euclidean distance),
- Returns the images whose embeddings are nearest to the query embedding.
Embeddings are tied to the encoder model that produced them. Mixing embeddings from different models (or from different model versions) can produce incorrect similarity results. Always ensure query and stored embeddings are generated with compatible models.
What a vector database typically stores
| Field | Purpose | Example |
|---|---|---|
| Embedding | The numeric vector used for semantic comparison | [-0.12, 0.83, 1.04, ...] |
| ID | Unique identifier for the item | img_2026_07_03_001.jpg |
| Metadata | Optional contextual info to filter or display results (filenames, timestamps, URLs, labels) | {"filename":"sunrise.jpg","timestamp":"2024-06-20"} |
| Index structure | Internal data structure that enables fast similarity search (HNSW, IVFPQ, etc.) | Managed by the vector DB |
| Optional raw payload | Original data or a link to it (e.g., URL or storage pointer) | https://cdn.example.com/sunrise.jpg |
Why this matters for ML and generative AI
Vector databases are essential when you need to search or retrieve items by meaning rather than exact text matches. Common use cases include:- Retrieval-augmented generation (RAG) for grounding LLM answers with relevant context
- Semantic search across documents, images, audio, or video
- Recommendation systems and personalization
- Clustering, anomaly detection, and nearest-neighbor analytics
Summary
- A vector database stores embeddings (numeric vectors), plus IDs, metadata, and an index for fast similarity search.
- Embeddings are learned by ML models and encode semantic meaning, enabling systems to match by concept rather than exact text.
- For reliable results, ensure embeddings for queries and stored items are produced by compatible encoders.
Links and further reading
- Retrieval-Augmented Generation (RAG) — Learn KodeKloud
- Pinecone — https://www.pinecone.io/
- Milvus — https://milvus.io/
- Weaviate — https://www.semi.technology/
- FAISS (Facebook AI Similarity Search) — https://github.com/facebookresearch/faiss