Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AI Northstar Tech Vector io Re embedding

From Leeroopedia
Knowledge Sources
Domains Embedding, Re_embedding, Vector_Database
Last Updated 2026-10-15 00:00 GMT

Overview

A data transformation technique that regenerates vector embeddings for text data in an existing dataset using a new embedding model, preserving the original text while adding new vector columns.

Description

Re-embedding addresses the problem that embedding models improve over time, and datasets embedded with older models can benefit from regeneration with newer, more capable models. Rather than re-creating the entire dataset from scratch, re-embedding:

  1. Reads the existing text column from parquet files in a VDF dataset
  2. Generates new embeddings using a different model (e.g. upgrading from text-embedding-ada-002 to text-embedding-3-small)
  3. Adds the new embeddings as a new vector column in the same parquet files (preserving original vectors)
  4. Updates VDF_META.json with the new model information, vector column name, and dimensions

The new vector column is named automatically as vec_{text_column}_{model_name}_dim{N}, which includes the text column name, model name (with slashes replaced by underscores), and dimensions. This naming convention enables a single dataset to contain vectors from multiple models simultaneously.

For datasets without existing VDF metadata (VDF_META.json), the handle_new_dataset function bootstraps metadata by scanning parquet schemas for list-type columns (potential vector columns) and interactively prompting for model information.

Usage

Use this principle when you need to:

  • Upgrade a dataset to use a better embedding model
  • Add embeddings from multiple models to the same dataset for comparison
  • Bootstrap VDF metadata for a directory of parquet files that wasn't created by vector-io

Theoretical Basis

The re-embedding pipeline:

# Abstract algorithm (NOT real implementation)
def reembed_impl(dataset_dir, new_model_name, text_column):
    vdf_meta = load_vdf_meta(dataset_dir)

    for index, namespace in vdf_meta.indexes:
        for parquet_file in get_parquet_files(namespace.data_path):
            df = read_parquet(parquet_file)

            # Generate new embeddings in batches
            new_vectors = []
            for batch in divide_into_batches(df[text_column], batch_size):
                embeddings = generate_embeddings(new_model_name, batch)
                new_vectors.extend(embeddings)

            # Add new vector column (preserves existing columns)
            new_col_name = f"vec_{text_column}_{new_model_name}_dim{dim}"
            df[new_col_name] = new_vectors
            df.to_parquet(parquet_file)  # Overwrite in place

        # Update VDF metadata
        namespace.vector_columns.insert(0, new_col_name)
        namespace.model_map[new_col_name] = {model_name, dimensions, ...}
        namespace.model_name = new_model_name
        namespace.dimensions = dim

    save_vdf_meta(vdf_meta)

Related Pages

Implemented By

Related Principles

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment