Changing the embedding model is a migration.
I expected a newer embedding model to be a normal dependency bump: one string in a config file. But every vector in the index was written by the old model, and a vector only means something to the model that wrote it. On this site, the swap moved half of every top five, improved recall, and broke search completely when I didn't rebuild the index.
- 265 headings used as free, labelled queries against 330 sections
- Recall@5 56.6% vs 64.5%: the new model wins 34 to 13 where they disagree
- New queries against the old index: 1.1% recall, no better than random, no error
- A 0.7 score cut-off keeps every ada-002 result and none from 3-small
I thought switching embedding models was a one-line upgrade. On this site it moved half of every top-five result. And when I skipped rebuilding the index, search got no better than random, with no error anywhere.
I thought changing an embedding model was a version bump.
That is how I treat most dependencies. A new version comes out, I read the changelog, bump the number and run the tests. If something breaks, it usually breaks loudly.
An embedding model looked like the same kind of thing. If you haven’t used one: it turns a piece of text into a list of numbers, called a vector. Texts with a similar meaning get vectors that sit close together. Search then becomes simple math. Turn the question into a vector, find the stored vectors closest to it, and return their text. For how a vector index finds the closest ones without checking every single vector, read Before the Model Answers: Retrieval, Reranking, and the Kraska Thesis.
In January 2024 OpenAI released text-embedding-3-small as the successor to text-embedding-ada-002.1 It is five times cheaper, it scores higher on the standard retrieval benchmarks, and its vectors have the same length, 1,536 numbers. On paper, switching is one string in a config file.
So I expected search to get a little better. I just wanted to see by how much.
The part I hadn’t thought about
A library runs when I call it and keeps nothing afterwards. An embedding model is different, because what it produces gets stored. Every vector in my search index was written by the old model, and it stays there until I rewrite it.
That raises a question a normal upgrade doesn’t: what happens to everything the old model already wrote?
I tried it on the one corpus I know well, this site. It has 36 published articles, which I cut into 330 sections at their ## headings.
Then I needed test questions. Real user queries would be better, but they don’t come with the right answer attached, and I don’t have labelled ones. The headings helped here. A heading is a short question whose answer I already know: the right result for “Why the count becomes a weight” is the section under that heading. I kept only the headings that appear once across the site, so no “Closing” or “References”. That left 265 queries, each with exactly one correct section.
I wanted to answer two things. How many results change when I switch models? And are the new ones better or worse?
Half the results moved
My guess was that most results would stay put and a few would improve. I embedded every section and every query with both models, ran the searches, and compared the top five for each query.
The two models agreed on 47.6% of the top-five results. Only 8 of the 265 queries came back with the same five sections, and 18 had none in common. Even when both models put the right section first, which happened 76 times, the other four places shared only about half their sections.
So for a typical search, about half of what a reader sees is different. I had changed one string.
Then I tried the mistake I think is easiest to make: change the string and forget to re-embed the stored sections. Now the queries come from 3-small and the index is still ada-002. Both produce 1,536 numbers, so the math runs and nothing throws an error.
The right section landed in the top five for 1.1% of queries. Picking five sections at random gets 1.5%.
One query, “What the inventory actually buys”, found its section at rank 1 with the new model and rank 15 with the old one. With the two mixed, it came in at rank 202 of 330.
This is the result that changed how I think about the whole thing. A change everyone calls an upgrade, done the way that word suggests, made search slightly worse than random. And no log line said anything.
What I had missed is simple once I saw it. I assumed a vector means something on its own, so an old vector and a new one are the same kind of thing. They aren’t. Each model builds its own space, and the numbers in a vector only mean something to the model that wrote them. Same length, different map.
Key takeaway
Photo by Kelly Sikkema on Unsplash.
A vector belongs to the model that wrote it
Ada-002 and 3-small both return 1,536 numbers per text, so nothing stops a 3-small query from being compared with ada-002 vectors. Like a key in the wrong lock, it fits and opens nothing: 1.1% recall@5, against 1.5% for random picks.
The model's name belongs in the index, next to every vector it wrote.
Seen that way, switching models changes three things: the code that embeds new queries, every vector already stored, and the range of the similarity scores. A normal upgrade touches only the first. A database migration touches all three, and that is much closer to what this is.
Was the new model actually better?
Overlap tells me how much changed. It doesn’t tell me which side was right, and 3-small could still be the better model. The headings let me check that with two numbers.
Recall@5 is how often the correct section lands in the top five. MRR, mean reciprocal rank, scores each query as 1 divided by the rank of the correct section, then takes the average. Rank 1 scores 1, rank 2 scores 0.5, rank 10 scores 0.1.
I fell into a trap first. My sections still started with their headings, so every query was literally the first line of its own answer. Recall came out at 91% for ada-002 and 97% for 3-small. I was measuring string matching, not search. So the script strips the heading out of each section before anything is embedded.
This is the part of the script that does the measuring. The rest just reads the articles and calls the embeddings API.
function cosine(a, b) {
let dot = 0, na = 0, nb = 0;
for (let i = 0; i < a.length; i++) {
dot += a[i] * b[i];
na += a[i] * a[i];
nb += b[i] * b[i];
}
return dot / (Math.sqrt(na) * Math.sqrt(nb));
}
// Every section index, best match first.
function ranking(queryVec, sectionVecs) {
return sectionVecs
.map((v, i) => ({ i, score: cosine(queryVec, v) }))
.sort((a, b) => b.score - a.score)
.map((s) => s.i);
}
// rankings[q] is one model's ranking for query q; answers[q] is its own section.
function quality(rankings, answers) {
let hits = 0, rr = 0;
rankings.forEach((r, q) => {
const rank = r.indexOf(answers[q]) + 1;
if (rank <= 5) hits++;
rr += 1 / rank;
});
return { recallAt5: hits / rankings.length, mrr: rr / rankings.length };
}
// Share of the top five two rankings have in common, 0 to 1.
function overlap(a, b) {
const top = new Set(a.slice(0, 5));
return b.slice(0, 5).filter((i) => top.has(i)).length / 5;
}
Provenance: text-embedding-ada-002 and text-embedding-3-small, OpenAI embeddings API, 36 articles, 330 sections, 265 queries, Node v25.2.1, run on 13 October 2026. About two cents at list prices.
| ada-002 | 3-small | 3-small queries, ada-002 index | |
|---|---|---|---|
| Recall@5 | 56.6% | 64.5% | 1.1% |
| MRR | 0.451 | 0.518 | 0.018 |
The new model is better. To check that it isn’t luck, I looked only at the queries where the two models disagree on whether the right section made the top five. 3-small wins 34 of them and ada-002 wins 13. If the two models were equally good, a split that uneven would show up about 3 times in 1,000 (exact binomial test, p ≈ 0.003).
So the upgrade was real. But I only got it after rewriting every stored vector, and it moved half the results on the way.
The scores moved too, and I didn’t expect this one. Under ada-002, the best match for a query scored between 0.73 and 0.89. Under 3-small it scored between 0.24 and 0.69. A lot of search code drops weak matches with a fixed cut-off, and 0.7 looks like a reasonable one for ada-002: it keeps all 265 of its top results. On 3-small it keeps none. Search returns nothing, and again, nothing reports an error.

Every one of them is right. A cut-off written on one is wrong on the others. Photo by William Warby on Unsplash.
What this test can’t tell me
The headings made the test free, but they are short, clean, and written by the same person who wrote the answers. Both models missed 81 of the 265 queries, mostly the generic ones: “Why this matters in production” came back at rank 233 with ada-002 and 108 with 3-small. Real users ask longer, vaguer, misspelled questions. I don’t know if the gap between the two models holds up for them.
One correct answer per query also undercounts. If a section from another article answers the same question, it is scored as a miss. So my recall numbers are probably too low, and I can’t say they are too low by the same amount for both models.
Overlap has a blind spot of its own. It ignores order, so a section that drops from first to fifth counts as unchanged. A rank-aware measure called rank-biased overlap would catch that.2 I didn’t use it here.
And the corpus is small. 330 sections from one author share one vocabulary. A hundred thousand support documents written by twenty people will behave differently, and I would want to run the same check on them before saying anything.
There is also a trap in the test itself. “Recall went up on the headings, ship it” is the same mistake as “it’s newer, ship it”, just one step later. A model that wins on headings and loses on real questions would still pass.
What I’d do before changing the string
The config file still holds one string. But that string names the model that wrote every vector in the index, so changing it is a migration. Next time, I’ll treat it the way I’d treat a schema change:
- Store the model name next to every vector, the way a container image is pinned by its digest instead of a tag that can move. For more on that idea, read The Digest Is the Container. The Tag Is Just a Rumor.
- Build the new index beside the old one, not on top of it.
- Run both on the same queries before switching. The overlap at least, and recall wherever there are questions with known answers: headings, FAQ titles, or old support tickets with the document that solved them.
- Check every score cut-off against the new model’s scores.
- Switch reads in one step, and keep the old index until nobody needs it.
In this run the new model was better. I only know that because both indexes existed at the same time and I compared them. Before running this, I would have just changed the string.
References
Footnotes
-
OpenAI, New embedding models and API updates, 25 January 2024. The price drop (from $0.0001 to $0.00002 per 1k tokens) and the benchmark gains are OpenAI’s figures; the 1,536 dimensions are what the API returned in this run for both models. ↩
-
William Webber, Alistair Moffat and Justin Zobel, A Similarity Measure for Indefinite Rankings, ACM Transactions on Information Systems, 2010. ↩