Skip to main content
Back to all articles
AI Engineering 6 min readUpdated September 18, 2026

The New Embedding Model Is Better. Your Old Vectors Still Have to Go.

An embedding-model upgrade is a data migration, not a one-line config change. Version the vector space, backfill into a parallel index, gate cutover on retrieval evals, and keep rollback instant.

By Salman Butt · Senior Full-Stack & Generative AI Engineer
#RAG#Embeddings#Vector Search#Retrieval Evaluation#AI Engineering#TypeScript#Python#Zero Downtime Migration
On this page

Changing an embedding model looks harmless.

One config value changes. The service redeploys. The health checks stay green.

Then retrieval gets worse.

No exception. No broken database migration. No obvious outage.

The system still returns ten nearest vectors. They are just the wrong ten.

That is why I treat an embedding-model upgrade as a data migration, not a model setting.

The dangerous case is simple: the query is embedded with the new model while the stored documents were embedded with the old one.

Even if both models return the same number of dimensions, that does not mean the vectors live in the same semantic space.

Unless the provider explicitly guarantees compatibility, I assume they do not.

The model version belongs to the vector

I never want a stored vector whose origin is "whatever model was configured at the time."

The model identity is part of the data.

type EmbeddingVersion = {  model: string;  dimensions: number;};​type StoredChunk = {  id: string;  text: string;  embeddingVersion: string;  vector: number[];};​function namespaceFor(  version: EmbeddingVersion,) {  return `${version.model}:${version.dimensions}`;}

This gives me one basic invariant:

a query vector is only compared with document vectors produced by the compatible embedding version.

That sounds obvious, but it is easy to violate when the model name lives in application config and the index has no version boundary.

A dimension check helps, but it is not enough. Two models can both emit 1,536 numbers and still encode meaning differently.

Build the new index beside the old one

I do not rewrite the live index in place.

I create a second namespace or collection for the new embedding version.

Parallel embedding indexes during migration

While index_v2 is filling, production continues to query index_v1.

That gives the migration room to fail without becoming a user-facing incident.

It also gives you something extremely valuable later: rollback.

Make the reindex resumable

Re-embedding a small corpus may take minutes.

Re-embedding millions of chunks may take hours or days.

So I assume the job will be interrupted.

The migration should be idempotent and resumable from the start.

type Chunk = {  id: string;  text: string;};​async function reindexBatch(  chunks: Chunk[],  version: EmbeddingVersion,) {  const missing = [];​  for (const chunk of chunks) {    const exists = await vectorStore.exists({      namespace: namespaceFor(version),      id: chunk.id,    });​    if (!exists) {      missing.push(chunk);    }  }​  if (missing.length === 0) return;​  const vectors = await embedder.embed(    missing.map((chunk) => chunk.text),    { model: version.model },  );​  await vectorStore.upsert({    namespace: namespaceFor(version),    items: missing.map((chunk, index) => ({      id: chunk.id,      vector: vectors[index],      metadata: {        embeddingModel: version.model,      },    })),  });}

Stable chunk IDs are important here.

If the same batch runs twice, it should overwrite or skip the same records instead of creating duplicates.

I also keep a checkpoint for large jobs so I can see migration progress without scanning the entire vector store.

Do not forget new writes during the backfill

This is the migration bug I see people miss.

You start re-embedding ten million old chunks into the new index.

The backfill takes six hours.

During those six hours, users upload new documents.

If ingestion only writes to the old index, the new index is already stale before it goes live.

During the migration window, I either dual-write new content to both versions or record a reliable change log that can be replayed into the new index before cutover.

Dual-write embedding migration flow

The extra cost is temporary.

The alternative is cutting traffic to an index that was complete only at the moment the migration started.

A successful backfill is not permission to cut over

The new model may be newer, cheaper, or better on a public benchmark.

That does not prove it retrieves your documents better.

Before changing production traffic, I compare both indexes on the same labeled retrieval set.

A small dataset can go a long way:

type RetrievalCase = {  query: string;  relevantIds: string[];};​function recallAtK(  retrieved: string[],  relevant: string[],  k: number,) {  const expected = new Set(relevant);  const found = new Set(    retrieved.slice(0, k),  );​  let hits = 0;​  for (const id of expected) {    if (found.has(id)) hits++;  }​  return expected.size === 0    ? 1    : hits / expected.size;}

I usually care about at least Recall@K and MRR.

Recall tells me whether the evidence made it into the result set.

MRR tells me how high the first useful result appeared.

The gate can be simple:

Text
new index must not regress beyond toleranceon the retrieval metrics we already care about

The exact tolerance is product-specific.

What matters is that the cutover decision comes from your corpus and your queries, not from the model card.

Test the migration, not only the model

I also add a few boring checks before cutover:

  • every source chunk expected in the new index exists;
  • the stored embedding version matches the namespace;
  • vector dimensions are correct;
  • new writes are reaching both indexes;
  • no query can accidentally search across versions;
  • retrieval latency is still inside budget.

These checks catch operational mistakes that retrieval metrics alone will not.

For example, a great model is not useful if 8% of the corpus never finished backfilling.

Cut over with one pointer

When the eval gate passes, I do not delete the old index.

I switch one logical pointer.

Embedding index pointer cutover

Your application should resolve the active embedding version from one place.

That could be an alias in the vector database, a row in Postgres, a feature flag, or a small configuration record.

The implementation is less important than the property:

cutover and rollback should not require another reindex.

If production quality looks wrong after the switch, point traffic back to index_v1.

The old vectors are still there.

The old query embedder is still available.

Rollback takes seconds instead of another six-hour migration.

Keep the old index warm for a while

I do not delete the old index immediately after a successful cutover.

Real traffic contains queries your evaluation set missed.

Keep both versions for a defined observation window and compare production signals:

  • zero-result rate;
  • retrieval latency;
  • click or citation usage;
  • downstream answer quality;
  • support reports;
  • fallback frequency.

Once the new index has survived that window, remove the dual-write path and retire the old vectors.

That is the moment the migration is actually finished.

One subtle point: same dimensions still does not mean compatible

This deserves repeating because it is easy to get wrong.

Suppose both the old and new model output 768-dimensional vectors.

A vector database will happily calculate cosine similarity between them.

That only proves the math is defined.

It does not prove the ranking is semantically meaningful.

Google's current Gemini migration guidance explicitly says its newer embedding space is incompatible with the previous one and requires re-embedding. MongoDB's Voyage guidance makes the same broader point: matching dimensions do not make embeddings from different models safely interchangeable.

So my default rule is conservative:

new embedding model = new index version

If a provider explicitly documents cross-model compatibility, that is a different case. I would still evaluate it before relying on the guarantee in production.

The migration I want

The whole process is intentionally boring:

Embedding model migration workflow

No mixed vector spaces.

No in-place destruction.

No benchmark-driven cutover.

No rollback that requires rebuilding yesterday's index.

The takeaway

An embedding-model upgrade changes the representation of your data.

Treat it with the same seriousness as a schema migration.

Version the vectors. Build the new index beside the old one. Keep new writes synchronized. Re-embed the corpus with resumable jobs. Compare both versions on a labeled retrieval set. Cut over through one pointer and keep the previous index available until the new path proves itself under real traffic.

The dangerous embedding migration is not the one that crashes.

It is the one that keeps returning results while quietly retrieving worse evidence.

References

KEEP READING

Related engineering notes