RAG & Retrieval·Question 51 of 100Advanced

A better embedding model ships. You have 400M chunks indexed. Walk me through the migration.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

The hard constraint first: embeddings from different models live in incompatible vector spaces. There is no shared coordinate system, so you cannot mix old and new vectors in one index. A partially reindexed index does not degrade gracefully, it returns nonsense, because the distance between a new query vector and an old document vector is meaningless. So this is a full reindex or nothing. The one exception is a family deliberately trained into a shared space, such as Cohere's Embed 5 Pro and Fast tiers (September 2026), where either model can query an index built with the other. That lets you mix tiers within one generation, after checking the loss on your own golden set, but it does not make a new model generation compatible with an old index.

Full worked answer with diagram

The hard constraint first: embeddings from different models live in incompatible vector spaces. There is no shared coordinate system, so you cannot mix old and new vectors in one index. A partially reindexed index does not degrade gracefully, it returns nonsense, because the distance between a new query vector and an old document vector is meaningless. So this is a full reindex or nothing. The one exception is a family deliberately trained into a shared space, such as Cohere's Embed 5 Pro and Fast tiers (September 2026), where either model can query an index built with the other. That lets you mix tiers within one generation, after checking the loss on your own golden set, but it does not make a new model generation compatible with an old index.

Justify it first. Reindexing 400M chunks is not free: embedding inference at that scale, plus index build, plus double storage during cutover, plus the engineering weeks. Before spending it, evaluate the new model on my golden set at my own scale. Leaderboard deltas routinely evaporate on a real domain corpus, and 'slightly better on MTEB' is not a reason to spend that budget.

If it is justified, the shape is blue-green:

  1. Build the new index alongside the old. Old index keeps serving. This is the expensive window, since you are paying for both.
  2. Backfill from source of truth, not from the old index, so you can fix parser and chunker bugs in the same pass. Reindexing is the only cheap moment to change chunking, since you are re-embedding everything anyway.
  3. Keep both pipelines live for new writes during the backfill, so the new index does not fall behind. This dual-write window is the main source of bugs.
  4. Shadow-evaluate: run production queries against both, compare recall@k on the golden set and diff the top-k. Look for regressions on specific query classes, since aggregate metrics hide them.
  5. Cut over behind a flag, ramping traffic. Keep the old index warm for a fast rollback.

The safety rail that matters: store the embedding model name and version in chunk metadata and assert at query time that the stored version matches the query encoder. This converts the silent catastrophic failure into a loud error, and it costs one comparison.

If a full reindex is genuinely unaffordable, the researched alternative is learning a lightweight transformation between the two embedding spaces and applying it to the stored document vectors, approximating the new space without re-encoding every chunk. Treat it as a stopgap: a learned map cannot recover information the old model discarded, so you get part of the new model's quality, not all of it.

Worth sketching. The dual-write window and the version assertion are the two places this goes wrong, and both are one arrow each.

flowchart LR
    S["Source of truth,<br/>raw text"] --> N["Build new index: re-parse,<br/>re-chunk, re-embed"]
    S -->|"dual write during<br/>the whole backfill"| O["Old index<br/>keeps serving"]
    N --> E["Shadow eval: diff top-k,<br/>recall per query class"]
    E -->|"no per-slice regression"| R["Ramp traffic<br/>behind a flag"]
    O -->|"kept warm<br/>for rollback"| R
    R --> A["Assert stored model version<br/>matches the query encoder"]

What a good answer covers

  • The hard constraint first: embeddings from different models live in incompatible vector spaces
  • There is no shared coordinate system, so you cannot mix old and new vectors in one index
  • A partially reindexed index does not degrade gracefully, it returns nonsense, because the distance…
  • So this is a full reindex or nothing
  • The one exception is a family deliberately trained into a shared space, such as Cohere's Embed 5 Pro and…

Key terms: incompatible vector spaces · Justify it first · The safety rail that matters

Interviewer follow-ups to expect

  1. How would you decide whether the new model is worth the reindex, concretely?

  2. What breaks if the dual-write window has a gap and some documents are only in the old index?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep