{"slug": "migrating-embedding-models-in-place", "title": "Migrating embedding models in-place", "summary": "A technique called reference z-score fusion keeps search quality within 2.0% to 7.1% of the fully migrated baseline during in-place embedding-model migrations, versus drops of up to 40% with reciprocal rank fusion, according to experiments spanning four corpora from 26K to 8.8M documents. The method embeds a 5,000-document reference sample with both the old and new models, z-score-normalizes each model's top-50 results against that sample's mean and standard deviation, then merges the two lists on the rescaled scores. The work matters for resource-constrained or very large-scale vector indexes where storing two full sets of vectors during a migration is too expensive, and it requires encoding each query with both models.", "body_md": "## Introduction\n\nSooner or later you will want to upgrade your embedding model. The straightforward way to do this is to just build a new index (or a new named vector in Weaviate), and embed each document with the new embedding model.\n\nThis works well, and has the benefit that you can easily test both models before switching. However it comes with a major drawback, in that for a period of time, you need to store twice the number of vectors.\n\nFor use cases that are resource constrained, where you want to use a fixed amount of disk or memory, or are at very large scale where re-embedding everything is just too expensive, you may want to instead migrate vectors in-place and for a period of time have some documents use the old vectors, while new vectors are backfilled.\n\nBut how can we combine search results for two models?\n\n- Firstly, the old and new models are usually *completely**incompatible* vector spaces, even having different dimensions.\n- Raw distances cannot generally be used to merge results as one model will return scores significantly closer for a given query.\n- Standard techniques to combine results like reciprocal rank fusion ([RRF](https://weaviate.io/blog/hybrid-search-explained) ) fail in this situation as they assume the same documents can occur in both sets of queries.\n\nThe net result is your search quality drops into a *compatibility valley* as data is migrated.\n\nIn the above graph we migrated NanoBEIR from `bge-small-en-v1.5` to `gte-modernbert-base` which when complete lifts search quality (NDCG@10) from 0.627 → 0.664.\n\n- With the naive approach of querying with just one model, search quality decays depending on the proportion of data migrated.\n- RRF is better than the naive approach but suffers significantly at the tails (losing 37%) and search quality dips below the original model for the entire migration.\n\n## Combining the scores\n\nWhat we would like from each model is not “how similar is this document to the query” on a model’s independent scale, but a calibrated score from both models. This is something you can estimate, if you have a small reference set embedded with both models, and are happy to encode the query with both models.\n\nTo do this we take a sample (in the below experiments 5,000 random documents) and embed them with both models.\n\nFor each query:\n\n1. Embed the query with both models.\n2. Search old vectors with old query vector, new vectors with new query vector.\n3. Score the query against the (5,000) reference vectors returning the top (50) results.\n4. For each model, compute mean and std dev of top results.\n5. Rescale every search result (subtract mean, divide by std dev).\n6. Merge the two lists on the rescaled score.\n\nThe rescaled score is a z-score: how many standard deviations a result sits above a strong match. Because of this we call the approach **reference z-score fusion**.\n\nWe tested 4 migrations on different datasets, and the results showed much better search quality than RRF during the migration.\n\n| Corpus | Documents | Migration | NDCG@10, old → new | RRF | Ref z-score fusion | Ref z-score fusion, all migrations | \n|---|---|---|---|---|---|---|\n| SCIDOCS | 26K | gte-modernbert-base → Qwen3-Embedding-0.6B | 0.195 → 0.228 | -40% | **-2.0%** | -0.5% to -2.3% | \n| FiQA | 58K | bge-small-en-v1.5 → gte-modernbert-base | 0.403 → 0.522 | -38% | **-3.2%** | -1.6% to -3.2% | \n| Quora | 523K | all-MiniLM-L6-v2 → bge-small-en-v1.5 | 0.877 → 0.889 | -36% | **-4.6%** | -3.1% to -4.7% | \n| MS MARCO | 8.8M | gte-modernbert-base → DenseOn | 0.405 → 0.437 | -39% | **-7.1%** | -7.1% to -10.6% | \n\nCompared to RRF which can suffer up to a 40% drop in NDCG, reference z-score fusion produces much tighter results, with no large drop when the datasets are unbalanced (early or late in the migration).\n\nOne benefit of this approach is that nothing depends on how far the migration has progressed. The performance overhead is just brute forcing the reference vector sample with both query vectors (a few milliseconds on modern hardware).\n\nWe used a fixed 5,000 reference set (or 10% of the corpus if it has fewer than 50,000 documents) for all experiments above. One valid question is how sensitive is this approach to the size of the reference set? Obviously we don’t want this to be too large or it negates the benefits of not duplicating vectors.\n\nThe below graph shows what happens on the 4 datasets as the reference set increases. On larger datasets like MS MARCO (8.8M documents) the gap from ideal continues to decrease with a larger set (from a 7.1% drop to 3.4%). The decision on the size becomes a tradeoff between search quality and latency, and how much better the new model is.\n\nGiven we only need the top-k vectors from the reference set for the z-score calculation, a vector index could even be used at scale to store the reference vectors.\n\n## In Weaviate\n\nHere is the core approach in Weaviate using two named vectors, along with a [full example](https://gist.github.com/trengrj/5064432e8e74b750d1ee92409abc6def) that migrates NanoBEIR data from `bge-small-en-v1.5` to `gte-modernbert-base` on a Weaviate HNSW index. Reference z-score fusion stayed within about 2% of the ideal line throughout the migration, while RRF dropped by up to 35%.\n\n```\ncollection = client.collections.create(    \"Docs\",    vector_config=[        Configure.Vectors.self_provided(name=\"old\"),        Configure.Vectors.self_provided(name=\"new\"),    ],)# assume the vectors start in the \"old\" named vector# and goal is to migrate to the \"new\" named vectorcollection.data.insert(properties=props, vector={\"old\": old_vector})def ref_zscore(result, query_vector, reference_vectors):    # convert cosine to similarity    scores = 1.0 - np.array([o.metadata.distance for o in result.objects])    top = np.sort(reference_vectors @ query_vector)[-50:]    zscores = (scores - top.mean()) / top.std()    return list(zip(result.objects, zscores))# while migrating, search both named vectors and merge on the z-scoreold = collection.query.near_vector(    near_vector=q_old, target_vector=\"old\", limit=10,    return_metadata=MetadataQuery(distance=True))new = collection.query.near_vector(    near_vector=q_new, target_vector=\"new\", limit=10,    return_metadata=MetadataQuery(distance=True))old_hits = ref_zscore(old, q_old, ref_old)new_hits = ref_zscore(new, q_new, ref_new)results = sorted(old_hits + new_hits, key=lambda hit: -hit[1])[:10]\n```\n\n## What about fine-tuned models?\n\nSo far we have looked at migration between completely different models. Another good question is what happens to compatibility when fine-tuning embedding models?\n\nA fine-tuned model starts from the old model’s weights, which means it starts out identical and drifts as more training occurs.\n\nIf it hasn’t drifted far, you can do something simpler than any fusion technique - just switch your queries to the fine-tuned model straight away, and re-embed as needed.\n\nWhether this works or not depends on the model. To validate this we fine-tuned three models using medical question-answering data from [MedEmbed](https://huggingface.co/datasets/abhinand/MedEmbed-training-triplets-v1) and tested search quality as the data was migrated.\n\n### Results\n\nBelow are results for a `bge-small-en-v1.5` medical fine-tune. This model gained significantly from the training data and fine-tuning improved it by 33% on held-out MedEmbed queries.\n\nWhen fine-tuning a model for a domain, it is possible that the new query vector is compatible with the original vectors. On the in-domain data (held-out MedEmbed), a ***12% improvement*** occurred just from switching to the new query vector. This query-only change is another strategy you can use if you do not want to migrate vectors at all.\n\nReference z-score fusion still worked well, and in this situation it was better to use it with only the new query vector: there was no quality drop during migration on the held-out MedEmbed data.\n\nAs an additional technique, we also considered ***model-merging***, where the original and fine-tuned parameters are merged together. This not only helps with overfitting but also keeps the embeddings compatible, and it achieved the best results on the other medical datasets. The merged model was so compatible it didn’t need fusion (though it still helped).\n\nFor stronger models like `gte-modernbert-base` and `DenseOn`, there was less improvement from fine-tuning on the MedEmbed dataset and the models were more at risk of overfitting. Because of this we used less data (one triplet per question, roughly a tenth of the training used for `bge-small`). This meant the models stayed highly compatible (within about 1% of the base model throughout the migration without any merging or fusion).\n\n## Related work\n\n[Metric Compatible Training for Online Backfilling in Large-Scale Retrieval](https://arxiv.org/abs/2301.03767) studied the same half-migrated state for image retrieval. They made the two models’ distances comparable by training a new model.\n\n[Federated Vector Retrieval across Heterogeneous VectorDBs](https://arxiv.org/abs/2611.01514) merged results across vector databases by learning a neural network to map between vector spaces.\n\nMore recently, [Plato’s Key](https://hazyresearch.stanford.edu/blog/2026-11-25-platos-key) showed that a simple rotation and scale can map between the hidden states of different LLMs, and a similar rotation is one of the maps evaluated for embedding model upgrades in [Drift-Adapter](https://arxiv.org/abs/2509.23471). We tried this approach, fitting the rotation on the reference set and using it to convert old vectors into the new model’s space. For two models sharing an architecture (gte-modernbert-base → DenseOn) it performed about as well as reference z-score fusion, including on MS MARCO, with the benefit it only needs the new model at query time. For less similar models though it fell 14-31% below the ideal line on the smaller corpora and more than 50% on MS MARCO. One explanation is that a mapping approximates every old vector, so any error changes the ranking itself, while fusion leaves each model’s ranking untouched and only decides how to interleave them.\n\n## Summary\n\nTo summarize, when migrating embedding models you have a few options:\n\nIf you can afford two vector indexes during the migration, it is a good idea to do so because it makes things much easier to test. However, if you don’t want or need two copies of each vector:\n\nFor a new model you haven’t trained yourself → look at using reference z-score fusion.\n\nIf you are going to do your own fine-tune of a model: 1) check how far it has drifted from the base model 2) consider model-merging to add compatibility back in 3) if the model has drifted far away consider using reference z-score fusion.\n\n## Ready to start building?\n\nCheck out the [Quickstart tutorial](https://docs.weaviate.io/weaviate/quickstart), or [sign up for a free Weaviate Cloud account](https://weaviate.io/go/console?utm_source=blog&utm_medium=website&utm_campaign=blog_signup&utm_content=migrating-embeddings-in-place&utm_term=ready-to-start-building).\n\nComments are loaded from GitHub Discussions via giscus. to show them.", "url": "https://wpnews.pro/news/migrating-embedding-models-in-place", "canonical_source": "https://weaviate.io/blog/migrating-embeddings-in-place", "published_at": "2026-12-02 00:00:00+00:00", "updated_at": "2026-12-02 10:44:27.610270+00:00", "lang": "en", "topics": ["ai-tools", "machine-learning"], "entities": ["Weaviate", "NanoBEIR", "bge-small-en-v1.5", "gte-modernbert-base", "Qwen3-Embedding-0.6B", "all-MiniLM-L6-v2", "MS MARCO", "SCIDOCS"], "also_reported_by": [], "takeaway": "During an in-place embedding migration, embed a 5,000-document reference sample with both models, z-score each model's top-50 results against that sample's mean and standard deviation, and merge on the rescaled scores to hold NDCG@10 within 2.0%-7.1% of the post-migration baseline instead of the up ", "recommendation": {"advice": "When migrating embedding models in place, keep a 5,000-document sample embedded in both models and merge per-model top-50 results by z-score rather than RRF; the source measured only 2.0%-7.1% NDCG@10 loss versus up to 40% for RRF.", "playbook": "rag-retrieval", "playbook_url": "https://wpnews.pro/playbooks/rag-retrieval"}, "alternates": {"html": "https://wpnews.pro/news/migrating-embedding-models-in-place", "markdown": "https://wpnews.pro/news/migrating-embedding-models-in-place.md", "text": "https://wpnews.pro/news/migrating-embedding-models-in-place.txt", "jsonld": "https://wpnews.pro/news/migrating-embedding-models-in-place.jsonld"}}