Retrieval and RAG · Staff
Half the index uses the new embedding model. Are the search scores still meaningful?
The question
Interview question
A RAG system is moving to a better embedding model. New documents receive new vectors, old documents retain old vectors, and the API starts embedding every query with the new model. Both models produce 768-dimensional vectors, so the index accepts the writes. Offline tests on newly indexed documents improve. Existing documentation becomes hard to find. What broke, and how do you migrate with continuous writes and a rollback path?
Take a few minutes to form your approach. Then open a worked answer and compare the decisions.
Reveal a worked answer
Equal dimensions do not mean a shared coordinate system. A vector's direction and distance have meaning relative to the model that produced the query and document vectors. Feeding a new query vector into an index full of old document vectors can produce plausible numeric scores with no calibrated relevance. Even if both models use cosine similarity, the spaces are not interchangeable without evidence of alignment. That is why this can fail quietly instead of throwing a dimension error.
Make the embedding generation a named version that includes model, preprocessing, chunking, normalization, vector metric and source-document revision. A query must target a compatible generation. If we want to compare models, send the same authorized query to two separate indexes with their matching query encoders, and evaluate answer-bearing recall, freshness, citations, latency and cost on the same cases. Do not merge raw scores across generations as though a 0.82 in one means the same thing as 0.82 in the other. A learned fusion or rank-based merger is possible, but it needs its own evaluation and access checks.
I would build a new collection from a pinned source snapshot. While the backfill runs, send source changes to both generations or record a durable change cursor and replay into the new one. The source document revision and tombstone must be carried through. A document updated during backfill must not have its older snapshot vector overwrite the newer version. Apply idempotent, revision-ordered writes per document, and track per-partition coverage. Weaviate's vectorizer migration guide shows separate collection and alias-based migration as one concrete approach. The application still owns its dual-write or catch-up correctness.
Before cutover, compare inventory against the source, including deletes and permission metadata. Sample old and new queries from actual task types, especially rare exact product codes, policy exceptions and newly written pages. A better average retrieval score on a subset is not permission to lose the exception a user needs. If the new index lacks enough coverage, keep the old generation as primary. Route shadow traffic only where data handling permits, and verify the new query encoder is pinned to the same embedding model as the new document vectors.
Cutover switches the query encoder and index generation as one logical release. An alias switch for the collection is insufficient if the query service keeps using the old encoder. Keep the old collection and encoder together for rollback until the defined window closes. If permissions change, both generations need current enforcement. For sensitive revocation, do not wait for dual-index synchronization before blocking a result from model context.
If the interviewer proposes placing a model-version field on each vector and filtering at query time, it can work as a temporary separation in an engine that truly isolates scoring and candidate selection by that field. But it still leaves the new model with only partially re-embedded documents, and selective filters may hurt recall or performance. Separate generations make coverage and rollback easier to reason about. The success condition is not “both vectors are 768 wide.” It is that every served query uses a compatible, sufficiently complete and authorized evidence space.
Continue reading
Related questions
Read beyond the question
Explore more retrieval and rag
Follow another question in this area, or return to the full Interview Prep index.
Browse this area →