DEV Community

Cover image for An Embedding Change Is a Reindex
FDE at Trida AI for Trida AI

Posted on Originally published at trida.ai

An Embedding Change Is a Reindex

Originally published at Trida AI.

The most expensive line in a RAG upgrade is the one that looks like a config change.

Somewhere in the settings there is a model name for embeddings. A newer model scores better on the public benchmarks, costs less per million tokens, or the old one has a retirement date attached. Swapping the name feels like swapping any other dependency: change it, redeploy, watch the dashboards. With a generation model that is roughly true. With an embedding model it is the start of a data migration, and treating it as anything less is how a search system quietly gets worse while every health check stays green.

Two spaces, no translation between them

An embedding model does not describe your documents. It places them. Every chunk in the index is a point in a space whose geometry that one model defined: which passages sit near each other, and how near, is a property of the model that encoded them. Encode the same sentence with a different model and you get a point in a different space. The dimensions may even match. The coordinates still mean nothing across the boundary, because similarity is only defined inside one space.

That is why a half-migrated index is worse than either model on its own. Re-encode a third of the corpus in place and queries embedded with the new model will rank that third against the rest using numbers that do not compare. Nothing errors. Results come back in the usual shape, plausible and wrong, and the failure looks like a quality wobble instead of what it is: two populations sharing a ranking they cannot both belong to.

Qdrant's migration tutorial puts the operational consequence plainly: switching models requires re-embedding all vectors in your collection. All of them. There is no supported setting that converts the old vectors, because there is nothing to convert them with: the information about where the new model would place a passage lives in the passage, not in its old coordinates.

People keep looking for the shortcut anyway, and the research on it is now fairly direct. A recent study, When the Bill Falls, tested the reuse strategies proposed for exactly this problem, adapters that translate new-model queries into the old space, and window re-ranking, where the old index nominates candidates for the new model to re-score, across sixteen model pairs and more. Its first finding is the one to plan around: reuse never avoids re-encoding. Once the migration has to finish, every strategy encodes every document. Reuse changes when the work is paid and how much quality is lost in the meantime. It does not change the bill.

The adapter result is sharper. Judged against the right baseline, not how close an adapter gets to the new model, but whether it beats the old model you could have kept, the result is narrow: of the five adapter families tested, only bridges between two LLM embedders from the same family cleared that bar, on a single model pair, by a margin the authors describe as too small to count as an improvement. A bridge that serves worse than staying put is not a migration strategy. It is a way to pay for a migration and not get one.

The cutover as a timeline: the old index keeps serving while the new space is built beside it: dual writes first, then the backfill, a comparison gate on your own queries, and the switch only after the gate passes, with the old space held through the rollback window.

The cutover as a timeline: the old index keeps serving while the new space is built beside it: dual writes first, then the backfill, a comparison gate on your own queries, and the switch only after the gate passes, with the old space held through the rollback window.

Run it as a migration, in this order

Once the change is treated as a migration, the shape is familiar from database work, and the order matters more than the tooling.

First, confirm you still have the source text. Re-embedding requires the original data, from the primary store, or from the payloads stored alongside the vectors, as Qdrant's tutorial assumes. Teams that kept only vectors discover, at this moment, that they do not have an index so much as a one-way function of a corpus they no longer hold. Storing the chunk text with each vector feels redundant right up until the day it is the migration.

Second, stand the new space up beside the old one and write to both. Qdrant's tutorial lays out two routes: a blue-green migration, with a second collection that works for any collection type, and, for collections already using named vectors on version 1.18 or later, adding the new model as an additional named vector inside the same collection. Either way, live writes go to both spaces from the moment the migration starts, and a background pass re-encodes the existing corpus into the new space. Writes that land in only one space are divergence you will meet later as missing documents.

Third, give the backfill a revision to check against. A document edited while the backfill is running can be re-encoded from its older revision and quietly resurrect the previous text in the new index. The write into the new space should carry the source revision it was encoded from, and be dropped if the source has moved on. This is the same stale-write problem any dual-write migration has; the embedding setting does not exempt anyone from it.

Fourth, compare before you cut over, on your own queries. The tutorial's flow does this explicitly: run the same questions against both spaces and read the differences before any traffic moves. A frozen set of real questions with known good answers is what makes that comparison a gate instead of a vibe. Newer on a benchmark is a claim about somebody else's corpus. Your corpus, your chunking, your queries. The new model has to win there, or the migration is a downgrade with a project plan.

Only then flip the pointer (the alias, the routing config, whichever indirection your reads go through) and keep the old space intact through a rollback window. Deleting it at cutover turns a reversible decision into a commitment for no saving worth having.

Example migration ledger, illustrative: one document traced through the backfill: re-encoded from its current revision, an older-revision write discarded, and its comparison result recorded before cutover.

Example migration ledger, illustrative: one document traced through the backfill: re-encoded from its current revision, an older-revision write discarded, and its comparison result recorded before cutover.

Where this stops applying

Three qualifications, because the rule has edges.

Some model families share a space on purpose. Cohere's Embed models include a current pair, Pro and Fast, that share an embedding space, so a corpus indexed with one can be queried with the other. Cohere recommends indexing with Pro and querying with Fast. If your provider documents a shared space for the two models in question, switching between them is genuinely a config change. The operative word is documents. Assume incompatibility until the vendor says otherwise, in writing, for those two models.

Scale cuts both ways. A small corpus, tens of thousands of chunks on a quiet write path, can be rebuilt over a weekend with none of the machinery above, and building dual-write infrastructure for it would be theatre. At the other end, the study above notes that re-encoding hundreds of millions of documents takes days of accelerator time, which is why the migration has to be planned like capacity work, not fitted around it. The rule (every vector, one space) does not scale up or down. The ceremony around it should.

And a bridge can still be the right temporary answer. If the old model is being retired on a date you do not control and the full re-encode cannot finish in time, window re-ranking buys a serving path while the background work runs. The study's point is that it defers the encoding, priced in advance, not that it is useless. What it cannot be is the end state. A migration that never finishes leaves you serving from a space you meant to leave, with the bill still outstanding.

Work with us

If an embedding model change is sitting in your backlog as a one-line ticket, that is the moment to re-scope it, before the swap, while the old index is still the only one you have to keep honest. Bring the corpus and the model you are moving to, through Trida AI's intake, and we will plan the re-encode, the comparison gate, and the cutover as the migration it actually is.

Top comments (0)