Embedding Model Migration: Change Vectors Without Breaking Search
Embedding upgrades change the geometry of your index. Use versioned vectors, dual writes, shadow queries, and measured cutover instead of mixing incompatible representations.
An embedding upgrade looks like a model-name change until retrieval quality collapses. New query vectors are compared with old document vectors, dimensions no longer match, or the same cosine threshold describes a completely different score distribution.
Embeddings are coordinates in a model-specific space. Migration requires a new index contract, not an in-place model swap.
Version every part of the representation
Define an embedding version that includes provider, model, output dimension, normalization, distance metric, preprocessing, chunking policy, and any instruction prefix. Two vectors from different contracts should never share a searchable namespace.
Store the version beside each vector and in index metadata. Keep source document IDs and chunk IDs stable so old and new representations can be compared. Preserve the source text or a durable pointer; without it, re-embedding becomes a data-recovery project.
Do not assume larger dimensions mean better retrieval. Evaluate the new model on the language, document type, query length, and domain vocabulary your users actually produce. Also measure latency, storage, indexing throughput, and cost.
Build the new index beside the old one
Backfill a separate index with the new contract. Process records in restartable batches, checkpoint progress, and record failed documents without stopping the entire migration.
While backfill runs, dual-write new and changed content to both versions. Make each write idempotent using document version and chunk ID. Deletions also need dual propagation; otherwise the new index can resurrect content removed from the old system.
If preprocessing changed, compare chunks as well as vectors. A new model evaluated on improved chunks is a valid product candidate, but the experiment should say clearly which layer caused the gain.
Verify counts, tenant partitions, access-control metadata, deletion tombstones, and a sample of source-to-vector lineage before sending any user traffic.
Shadow queries before routing answers
Run production queries against both indexes while continuing to serve results from the old one. Log ranked document IDs, scores, latency, filter behavior, and downstream answer quality using privacy-safe identifiers.
Overlap metrics such as recall at k and rank correlation reveal how much retrieval changed, but disagreement is not automatically bad. Create a judged set of real questions with relevant documents and failure labels. Include rare queries, multilingual inputs, exact identifiers, and adversarial near-duplicates.
Recalibrate score thresholds. Cosine similarity from one model is not interchangeable with cosine similarity from another. If the application uses a cutoff to decide “no answer,” fit it again using labeled examples.
For RAG, evaluate the final answer too. A new retriever may return stronger evidence but change ordering in a way that interacts with context limits, rerankers, or citation extraction.
Cut over gradually and keep rollback cheap
Route a small percentage of traffic to the new index, segmented by tenant or stable request hash. Monitor retrieval success, empty-result rate, answer quality, latency, cost, and support signals. Avoid per-request random switching when users expect repeated queries to behave consistently.
Keep the old index read-only but available through a defined rollback window. Freeze writes only after dual-write lag reaches zero and reconciliation passes. Then switch the default version in configuration rather than deleting infrastructure during the same change.
Retire the old index after retention, audit, and rollback requirements are satisfied. Record the migration decision and evaluation set so the next upgrade can compare against more than memory.
An embedding migration succeeds when the new geometry is isolated, measured, and reversible. The safest upgrade is not the cleverest model; it is the one whose retrieval behavior you can explain before every user depends on it.
Sources
> Want more like this?
Get the best AI insights delivered weekly.
By subscribing, you agree to our Privacy Policy. You can unsubscribe at any time.
> Related Articles
pgvector Can Return 4 of Your 10 Matches—Where Did the Rest Go?
A filtered vector search can quietly starve your AI app of evidence. pgvector has a fix, but builders need to measure recall and latency before trusting it.
Agent Memory Consolidation Scheduling: When to Merge, Summarize or Forget
Your agent doesn't need more memory — it needs a maintenance schedule. Here's how to build merge, summarize, and decay policies that keep long-term agents sharp instead of senile.
LLM Output Schema Evolution: Migrating Producers and Consumers Without a Flag Day
Your JSON schema will change. Here's how to evolve LLM output contracts safely — with dual readers, shadow validation, and staged rollouts instead of a risky big-bang cutover.
Most Read
- 1 Kimi K3.1 Pro: China's Open-Weight Model Just Caught the Frontier
- 2 OpenAI Is Buying the Bottleneck: Can Orchestra Bio Cut a 15-Year Drug Timeline?
- 3 1,068 Tokens Per Second: Can Mercury 3 Change How LLMs Generate Text?
- 4 Same Price, Better Coding: How Good Is DeepSeek V4.1 Flash 1017?
- 5 Used OpenCode? Should You Rotate Your API Key After the Console Breach?
Latest News
- Claude Code Left Secrets in 1,122 GitHub Files—Check This Setting
- Gemini Omni 1.2 Flash Makes 15-Second Video Cheaper—Then Comes the Edit
- GPT-6 Cyber Can Build Exploits—But Builders Face a Different Test
- 1,122 GitHub Files Exposed Secrets—What Did “Don't Ask Again” Save?
- Gemini Omni 1.2 Flash Offers $1.05 Clips—What Does That Buy You?
- GPT-6 Cyber Hits 48.5% on ExploitGym—Who Gets the Keys?
Tags
> Stay in the loop
Weekly AI tools & insights.