How Data Becomes Vectors

Before data enters a vector database, it must be converted into a vector — a list of numbers. This conversion process is called embedding. Understanding how this works helps you use vector databases effectively.

The GPS Coordinate Analogy

Every city on Earth has GPS coordinates — two numbers (latitude, longitude) that pinpoint its location. You can calculate distance between cities using those numbers, even without a map.

Vectors work the same way, but instead of two numbers describing a location in physical space, they use hundreds or thousands of numbers to describe a location in meaning space.

Physical Space (GPS)          Meaning Space (Vectors)
─────────────────────         ─────────────────────────────────────
New York: [40.7, -74.0]       "King":   [0.8,  0.1,  0.9,  0.2 ...]
London:   [51.5,  -0.1]       "Queen":  [0.8,  0.2,  0.9,  0.1 ...]
Tokyo:    [35.7, 139.7]       "Man":    [0.7,  0.1,  0.2,  0.5 ...]

NY → London: ~5,500 km        "King" → "Queen": very close
NY → Tokyo:  ~10,800 km       "King" → "Car":   very far

Words with similar meanings end up close together in meaning space. Words with different meanings sit far apart.

What Creates a Vector

A special type of AI model called an embedding model reads your data and outputs a vector. Popular embedding models include OpenAI's text-embedding models, Google's Sentence Encoders, and open-source models like BERT.

INPUT DATA                  EMBEDDING MODEL             OUTPUT VECTOR
──────────────              ───────────────             ─────────────────────────────
"The cat sat                                            [0.23, -0.87, 0.45, 0.12,
  on the mat"   ──────────► AI Model (BERT)  ─────────► 0.78, -0.34, 0.91, 0.05,
                                                         0.67, -0.22, 0.38, 0.84,
                                                         ...768 numbers total]

The model assigns numbers based on patterns learned from billions of examples. Similar inputs produce similar number patterns.

Dimensionality: How Many Numbers?

The count of numbers in a vector is called its dimensionality. More dimensions capture more nuance.

ModelDimensionsGood For
Simple word2vec100–300Basic text similarity
BERT base768Sentence understanding
OpenAI ada-0021536General purpose text
CLIP (images)512Images and text together

Different Data Types, Different Embedding Models

Every data type needs a matching embedding model. Using the wrong model produces poor results.

  • Text → Language models (BERT, OpenAI embeddings)
  • Images → Vision models (CLIP, ResNet)
  • Audio → Audio encoders (Wav2Vec, Whisper features)
  • Code → Code-specific models (CodeBERT)

A Concrete Text Example

Watch how three sentences produce vectors that reflect their meaning:

Sentence                          Vector Position (simplified 2D view)
──────────────────────────────    ─────────────────────────────────────
"I love my dog"                   [0.82, 0.91]   ← near other pet sentences
"My cat is fluffy"                [0.79, 0.88]   ← close to dog sentence
"The stock market crashed"        [0.12, 0.23]   ← far from pet sentences

   HIGH
    │
0.9 │  ● "I love my dog"
    │    ● "My cat is fluffy"
0.5 │
    │
0.2 │                      ● "Stock market crashed"
    └────────────────────────────────── HIGH
       0.1       0.5       0.9

Key Points to Remember

  • Embedding models convert raw data into vectors
  • Every dimension in a vector captures some aspect of meaning
  • Similar data produces similar vectors, automatically
  • You choose the embedding model — the vector database just stores the result

The embedding model is separate from the vector database. You embed your data first, then store the resulting vectors in the database. This separation gives you flexibility to switch embedding models without rebuilding your entire database system.

Leave a Comment

Your email address will not be published. Required fields are marked *