Skip to main content
Hello and welcome back. You’ve seen how Google Photos can find every picture of your dog by searching the word “dog,” even when those photos were never tagged. That capability comes from how vector databases store and retrieve data — specifically, what they store and how they use those stored items for semantic search. In short: a vector database primarily stores embeddings — numeric representations of your data. The rest of this article explains what embeddings are, how they’re stored, and why this matters for search, ML, and generative AI.
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

  1. 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.
  2. 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.
The image explains what a vector database stores, highlighting that it contains arrays of floating-point numbers generated by machine learning models. It includes a visual of a database with a magnifying glass over it.
  1. 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:
[ 2.0, 1.0, 0.3, -0.5, 0.22, ... ]
The image explains the concept of vector embeddings and shows how a vector database stores semantic meanings from images as arrays of floating-point numbers using machine learning models.
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.
Because the comparison operates on semantic vectors rather than filenames or exact tags, the system finds images that are conceptually similar to “dog.” Example pseudocode (conceptual):
query_vec = encode("dog")                # produce query embedding
results = index.search(query_vec, k=10)  # nearest neighbors by similarity
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

FieldPurposeExample
EmbeddingThe numeric vector used for semantic comparison[-0.12, 0.83, 1.04, ...]
IDUnique identifier for the itemimg_2026_07_03_001.jpg
MetadataOptional contextual info to filter or display results (filenames, timestamps, URLs, labels){"filename":"sunrise.jpg","timestamp":"2024-06-20"}
Index structureInternal data structure that enables fast similarity search (HNSW, IVFPQ, etc.)Managed by the vector DB
Optional raw payloadOriginal 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
Tools and platforms that support vector storage and similarity search include Pinecone, Milvus, Weaviate, and FAISS-based solutions. These systems scale embeddings, provide index choices, and often include filtering and metadata queries to refine results.

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.
Future lessons will dive deeper into how models generate embeddings, the stages in building vector pipelines, and index choices for performance and scalability.

Watch Video