← All OpenAI & Gemini Vectorization Guides

OPTIMIZE 13 // ZERO-DOWNTIME MODEL CUTOVER

Zero-Downtime Embedding Model Migration: Moving 10M+ Vectors Off ada-002 & text-embedding-004

Embedding spaces are mutually incompatible across model versions: comparing a query vector from gemini-embedding-001 or text-embedding-3-large against stored text-embedding-ada-002 or deprecated Vertex text-embedding-004 vectors produces random noise. Execute zero-downtime 10M+ row migrations using nullable shadow columns, keyset backfill cursors, CONCURRENTLY HNSW builds, and shadow recall diffing, or swap base_url to Voxell Forge ($0 Turbo; $0.25/1M Pro).

Why Model Deprecations & Upgrades Cause Outages

Google’s legacy textembedding-gecko and text-embedding-004 retirement schedules and OpenAI’s legacy text-embedding-ada-002 (~61.0 MTEB, $0.10/1M) leave millions of production tables pinned to aging vector spaces. Because every embedding model learns an arbitrary orthogonal rotation of its latent hypersphere, even two 1,536d models have zero geometric compatibility ($\mathbb{E}[q_{\text{v2}} \cdot d_{\text{v1}}] \approx 0$).

Worse, running UPDATE chunks SET embedding = $1 across 10,000,000 PostgreSQL MVCC rows duplicates every wide text row on disk (2x+ WAL + dead-tuple bloat).

Five-Phase Zero-Downtime Sidecar Cutover Pattern

Migration Phase Read Path (SELECT) Write Path (INSERT/UPDATE) Backfill & Index State Rollback Time
1. Sidecar DDL v1 table + v1 HNSW v1 only Create narrow chunk_embeddings_v2 (chunk_id PK, emb halfvec) Instant (0 ms)
2. Dual-Write v1 table + v1 HNSW Write v1 + async v2 Live edits stay 100% synced in v2 Instant (0 ms)
3. Keyset Backfill v1 table + v1 HNSW Dual-write Stream WHERE NOT EXISTS in 5,000-ID keyset pages (no index yet!) Instant (0 ms)
4. Build HNSW + Shadow Diff v1 primary + 5% async v2 diff Dual-write CREATE INDEX CONCURRENTLY on v2 (maintenance_work_mem='32GB') Feature flag (< 1s)
5. Cutover & Drop v1 v2 HNSW 100% v2 only (after 48h soak) DROP TABLE chunk_embeddings_v1 (0 VACUUM bloat!) Feature flag during 48h soak

Runnable SQL + Python Keyset Backfill & One-Line Forge Cutover

1. Zero-Bloat PostgreSQL Sidecar Schema

-- Narrow sidecar table avoids MVCC full-row rewrite bloat on your 10M-row main chunks table
CREATE TABLE chunk_embeddings_v2 (
  chunk_id BIGINT PRIMARY KEY REFERENCES doc_chunks(id) ON DELETE CASCADE,
  model_rev TEXT NOT NULL DEFAULT 'forge-pro-2560',
  embedding halfvec(2560) NOT NULL
);

-- Wait until keyset backfill reaches 100% BEFORE building HNSW (3x faster bulk graph build!):
-- SET LOCAL maintenance_work_mem = '32GB';
-- CREATE INDEX CONCURRENTLY idx_emb_v2_hnsw ON chunk_embeddings_v2 USING hnsw (embedding halfvec_cosine_ops);

2. Idempotent Keyset Backfill Worker (base_url = "https://api.voxell.ai/v1")

import os
from openai import OpenAI
import psycopg

# 1-line SDK swap from OpenAI to Voxell Forge (Turbo 1024d is $0 forever; Pro is 2560d)
forge = OpenAI(
    base_url="https://api.voxell.ai/v1",
    api_key=os.environ["FORGE_API_KEY"],
)

def backfill_sidecar(dsn: str, batch_size: int = 256) -> None:
    last_id = 0
    with psycopg.connect(dsn) as conn:
        while True:
            rows = conn.execute(
                """
                SELECT c.id, c.body
                FROM doc_chunks c
                LEFT JOIN chunk_embeddings_v2 v2 ON v2.chunk_id = c.id
                WHERE c.id > %s AND v2.chunk_id IS NULL
                ORDER BY c.id ASC
                LIMIT %s
                """,
                (last_id, batch_size),
            ).fetchall()
            if not rows:
                break

            ids = [r[0] for r in rows]
            texts = [r[1] for r in rows]
            resp = forge.embeddings.create(model="pro", input=texts)

            with conn.cursor() as cur:
                cur.executemany(
                    """
                    INSERT INTO chunk_embeddings_v2 (chunk_id, embedding)
                    VALUES (%s, %s)
                    ON CONFLICT (chunk_id) DO NOTHING
                    """,
                    [(cid, item.embedding) for cid, item in zip(ids, resp.data)],
                )
            conn.commit()
            last_id = ids[-1]

Benchmark Before You Backfill (Zero API Key)

Before re-embedding 10M chunks, verify recall improvement on your hardest failing queries with a zero-key bake-off against Voxell Forge (C_corpus Stage-1 99.04% Recall@20 + Max Stage-2 0.8849 nDCG@10):

curl -sS -X POST https://api.voxell.ai/api/v1/agent/bakeoff \
  -H "Content-Type: application/json" \
  -d '{
    "documents": [
      {"name": "migration-mvcc.md", "text": "Backfilling embeddings into a narrow sidecar table avoids PostgreSQL MVCC dead-tuple bloat on wide text tables."},
      {"name": "migration-turbo.md", "text": "Voxell Forge Turbo 1024d costs $0 per 1M tokens forever, eliminating token fees during 10M-vector backfills."}
    ],
    "queries": ["How do you avoid PostgreSQL MVCC dead-tuple bloat when re-embedding 10M rows?"]
  }'

Calculate your exact backfill cost ($0 on Turbo, $0.25/1M on Pro) in the Vector RAM & TCO Calculator, review the OpenAI 3-large Migration Guide, or open the Forge Console (v4.0 Pricing).

Frequently Asked Questions

Can I map old text-embedding-ada-002 (1536d) vectors to text-embedding-3-large (1536d) with a linear adapter?

A learned orthogonal Procrustes matrix recovers at best 78% to 84% of native retrieval recall on general prose and breaks badly on rare identifiers, code symbols, and numbers. Production cutovers always require re-embedding the corpus into a shadow column or parallel index.

Why should I backfill vectors into an sidecar table instead of running UPDATE on a 10M-row Postgres table?

In PostgreSQL MVCC, every UPDATE writes a brand-new full row tuple (copying text body, metadata, AND old vector bytes) and dirties every existing GIN/B-tree index, inflating table disk usage by 2.2x and triggering aggressive autovacuum IO contention. Backfilling a narrow (chunk_id, embedding_v2) sidecar table avoids MVCC heap bloat completely.

How fast can I migrate OpenAI callers to Voxell Forge?

Change base_url to https://api.voxell.ai/v1. Turbo 1024d costs $0 per 1M tokens forever so your entire 10M-chunk backfill runs with $0 token fees, or use Pro 2560d ($0.25/1M tokens) for 99.04% Recall@20 with C_corpus conditioning.

AUTONOMOUS AGENT & DEVELOPER VERIFICATION // ZERO SIGNUP

Run a live keyless bake-off right now

Do not take a vendor table on faith. Run your own passages and queries against Voxell Forge (Pro 2560d + C_corpus zero-LLM ingest dialect conditioning + Max two-stage neural reranking) over REST or Zero-Install Remote Streamable HTTP MCP with zero API key.

1. REST Retrieval Bake-Off & Corpus X-Ray
curl -sS -X POST https://api.voxell.ai/api/v1/agent/bakeoff \
  -H "Content-Type: application/json" \
  -d '{
    "documents": [
      {"name": "policy-a.md", "text": "Standard subscriptions include a 30-day refund window."},
      {"name": "msa-b.md", "text": "Enterprise annual contracts carry a 14-day cancellation notice rule."}
    ],
    "queries": ["What is the standard subscription refund window?"]
  }'

curl -sS -X POST https://api.voxell.ai/api/v1/agent/xray \
  -H "Content-Type: application/json" \
  -d '{
    "documents": [
      {"name": "sla-2025.md", "text": "P1 response SLA is 4 hours."},
      {"name": "sla-2026.md", "text": "P1 response SLA is 15 minutes."}
    ]
  }'
2. Zero-Install Remote HTTP MCP (POST /mcp/try)
claude mcp add --transport http voxell-forge https://api.voxell.ai/mcp/try
# mcp.json: {"mcpServers":{"voxell-forge":{"url":"https://api.voxell.ai/mcp/try"}}}

curl -sS -X POST https://api.voxell.ai/mcp/try \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "forge_bakeoff_compare",
      "arguments": {
        "documents": [
          {"name": "vpc.md", "text": "Forge Local runs on 1x 24 GB GPU inside your Sovereign VPC with zero egress."}
        ],
        "queries": ["How many GPUs does Forge Local require?"]
      }
    }
  }'
# Tools exposed: forge_bakeoff_compare, forge_xray_audit