Topic 4 of 5 · 5 min read
Re-embedding when the model changes
Goal: Plan a migration to a new embedding model that keeps search working, with version tags and a rollback step.
Vectors from different embedding models cannot be compared, so changing the model means building a second index with every chunk re-embedded, then switching traffic when it is ready. Never overwrite the live vectors one by one.
Check yourself · 1 of 3
Why can a vector from model A not be searched with a query vector from model B?
Why it matters
Each model builds its own coordinate system. A query vector from model B compared with a document vector from model A produces a number, but the number means nothing. Even a new version of the same model family counts as a different model. Mixed indexes return confident but wrong results and raise no error, so the damage is invisible until users complain.
How to migrate
- Version everything. Store the model name and version with every vector, or keep one index per model version, for example
docs_v1anddocs_v2. Record the embedding config (model, dimensions, prefixes) with the index. - Build the new index beside the old. Backfill: read all chunks from the source of truth, embed them with the new model in batches, and write them to
docs_v2. Throttle batches to stay inside rate limits and budget. - Dual-write. While the backfill runs, every new or edited chunk is embedded by both models and written to both indexes, so the new index does not fall behind.
- Verify. Run your labelled question set against
docs_v2. Compare withdocs_v1. Check counts: same number of chunks in both. - Cut over. Switch the query path to
docs_v2using a flag, ideally for a small share of traffic first. Queries must be embedded with the new model at the same moment. - Keep the rollback. Leave
docs_v1and its query path intact for a few days. Delete it only after the new index has held up.
Before and after
Before: "We'll loop through the table and overwrite each vector with the new model's output."
Halfway through, half the index is in one space and half in another, and queries match neither well.
After: "Create index v2, backfill in batches of 500, dual-write new chunks, test recall on 30 questions, flip the flag for 10% of queries, then 100%, keep v1 for a week."
What goes wrong
- Changing only the query-side model, so queries land in a space the stored vectors do not share.
- No version tag, so nobody can tell which model produced a vector.
- Cutting over before the backfill finishes, so recent documents are missing.
- Deleting the old index at cut-over, which removes the rollback.
- Forgetting that the provider can retire a hosted model, which forces this migration on their timetable.
Examples
Version tag on every record
{
"chunk_id": "kb-2041-3",
"embedding_model": "model-x-2026-03",
"dimensions": 1024,
"index": "docs_v2"
}
A tag like this lets a query service refuse to compare vectors from different models.
A cut-over order
Backfill v2, dual-write, verify, send 10% of queries to v2, watch recall and latency, move to 100%, wait a week, retire v1. Each step has a way back until the last one.
Key points
- Vectors from different models, including different versions, live in different spaces and cannot be compared.
- Build a new versioned index next to the old one instead of overwriting vectors.
- Dual-write new and edited chunks while the backfill runs.
- Verify counts and recall on your test questions before moving traffic.
- Keep the old index and query path until the new one has proven itself.
Common mistakes
- Overwriting vectors in place with the new model.
- Switching the query embedding model without switching the index.
- Leaving no rollback because the old index was deleted.
- Not tracking which chunks changed during the backfill.
Check yourself · 2 of 3
During a model migration, a new chunk is added at 10:00. What keeps the new index current?
Check yourself · 3 of 3
When should a team delete the old index after cut-over?
Practice items, not counted towards your mastery.
Start here
- MTEB embedding leaderboard (opens in a new tab)ToolFree
Compare embedding models per task and language, and filter to the tasks that resemble your corpus.
- Sentence Transformers documentation (opens in a new tab)DocsFree
Reference for loading open-weight embedding models, encode_query and encode_document, and truncation.
- Matryoshka Representation Learning (opens in a new tab)PaperFree
The paper behind truncatable vectors: why the first dimensions of some embeddings carry most of the signal.
More for this topic
- Embeddings (Claude docs) (opens in a new tab)DocsFree
Notes on choosing an embedding provider and on input types for queries and documents.