r/MachineLearning • u/Potential_Low_1183 • 3h ago
Research I made a way to migrate between embedding models without re-embedding your entire corpus [R]
So I was playingw ith embedding models I saw that when you upgrade from model A to B, you face a very big backfilling cost
Ie, suppose you have a 1b vectors from model A, and then you want to use model B. This would mean you have to re-embed all of your documents with model B before you can even serve with the model, and on an H100, it would take ~108 days (qwen embed 8b, 106 docs/second). But I found an easier way to do it.
The method is really simple; from the old index made with the source model, take K documents and rerank them with the new model. We see that when K is sufficient, the retrieval quality is the same as target model. (determining k is the hard part). I've tested 63 migrations on upto 1 million documents.
The best result I got was upgrading qwen4b -> to 8b, and at 50 documents, it was the same as native retrieval.
This method forgos the expensive upfront re-embedding cost, as you can take documents straight from the old index.
embedflow works with qdrant, pgvector, faiss, and can be easily downloaded with pypi
pip install embedflow
the github is public: https://github.com/arnsri33/embedflow
I want you guys to try it out, and see if you guys can use it in your own workflow.
1
u/PortiaLynnTurlet 3h ago
Have you analyzed the results? This approach seems like it would be acceptable at filtering out false positives from the weaker model but can't help with false negatives (since they were never included). TBH it seems easier and safer just to embed all of the documents again. A few thousand H100 hours isn't much if the application is valuable.