# How Do You Choose an Embedding Model?

> How to pick an embedding model by testing it on your own data, weighing cost and privacy, and planning for a switch later, explained simply for your AI interview.

**In short:** Test two or three candidate models on your own real questions, then pick the one that finds the right text most often at a cost, speed and privacy level you can accept. Public leaderboards are only a starting point.

AI and LLM interview question Q116, Retrieval-augmented generation (RAG). Intermediate, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-do-you-choose-an-embedding-model

## Say it in 30 seconds

An embedding model turns text into a list of numbers, so texts with similar meaning sit close together. To choose one, I start with the job: what text I have, how much, which languages, and where it is allowed to go. Then I test two or three candidates on real questions where I already know the right answer. I pick the one that finds the right text most often at a fair cost and speed. Public leaderboards help me shortlist. My own test settles it.

## Say it in 2 minutes

An embedding model turns each piece of text into a vector, which is a list of numbers. Texts with similar meaning get vectors that sit close together, and that is how search finds a clause matching a question even when the words differ. Choosing a model means choosing how that map of meaning is drawn for your kind of text.

I start with the job. What is the text, how long is each chunk, which languages are involved, and where is the data allowed to go? A hosted model means sending your text to a vendor. An open model that runs on your own servers keeps it in house, but someone has to run and update it. Each model also has a maximum input length, so every chunk has to fit.

Then I test. Public leaderboards are useful for a shortlist, but they test general tasks, and no single model wins them all. So I take a few hundred real questions where we know the right document, embed the documents with two or three candidates, and count how often the right document lands in the top three results. Ten questions are too few to trust. A few hundred show which model really wins.

Last, I weigh the result against cost, speed and vector size, and I plan for change. Switching models means re-embedding every chunk and rebuilding the index, so I decide early and keep the test set, so I can check any future model fairly.

## What is an embedding model, in plain words?

An embedding model reads a piece of text and returns a vector, which is a list of numbers. The numbers are a position on a map of meaning. Texts that mean similar things land close together, so a search can match a question to a clause even when they share few words.

Think of a records clerk at an insurance firm who files each claim under a short code, so similar claims sit in the same drawer. A different clerk with a different filing system would put the same claims in different drawers. Your search only works as well as the filing system, and the model is that system.

If you later change to a different model, every chunk must be turned into vectors again with the new model. That is called re-embedding.

- **Vector:** A list of numbers that stands for the meaning of a piece of text.
- **Chunk:** A slice of a document, such as one clause or paragraph, that gets its own vector.
- **Input limit:** The most text a model reads in one go. Longer chunks do not fit.
- **Index:** The stored set of vectors that search runs over.
- **Open-weight model:** A model whose files you can download and run on your own servers.

## How do you test models on your own data?

Say an insurance firm wants to search its policy wording to answer claim questions. It has 300 past questions, and a claims handler marked the right policy clause for each one. Each candidate model gets the same chunks and the same questions, and we check whether the right clause shows up in the top three results.

*Diagram, Testing candidate models on your own questions: Two candidates get the same files and the same test questions. Each one's answers are scored on how often the right chunk comes back near the top. The best score at a fair cost wins.*
1. The same files and questions go to the hosted model.
2. The same files and questions go to the open model, so the test is fair.
3. The hosted model's answers go to scoring.
4. The open model's answers go to scoring the same way.
5. The best score at a fair cost is chosen.

1. **Build the test set:** Collect a few hundred real questions with the right chunk marked. Take them from the claims team's logs.
2. **Embed each chunk with each candidate:** Embedding means turning each chunk into a vector. Keep the chunking and the documents the same for every model, so only the model changes.
3. **Measure how often it finds the answer:** Count how often the right chunk is in the top three. Made-up numbers for illustration: one model found it 81 times in 100, another 88 times.

The open model wins here, but that is not free: someone has to run, patch and update it on your own servers. The script below is the same idea in miniature. It uses ten made-up questions and counts how often the right clause lands in the top three. Ten is far too few for a real decision, but it shows the logic.

```python
# Score two embedding models on the same past questions (made-up numbers).
# Each number is the rank where the right policy clause came back; 1 is the top result.
TOP_K = 3
ranks = {
    "Model A (hosted)": [1, 4, 2, 1, 7, 3, 2, 1, 9, 2],
    "Model B (open, own servers)": [1, 2, 1, 3, 2, 1, 5, 1, 2, 2],
}
def hits(found):
    return sum(1 for r in found if r <= TOP_K)
for name, found in ranks.items():
    print(f"{name}: right clause in top {TOP_K} for {hits(found)} of {len(found)} questions")
best = max(ranks, key=lambda name: hits(ranks[name]))
print("Pick:", best)
```

Output:

```text
Model A (hosted): right clause in top 3 for 7 of 10 questions
Model B (open, own servers): right clause in top 3 for 9 of 10 questions
Pick: Model B (open, own servers)
```

## Why don't public leaderboards settle it?

- **Quality: It depends on your data.** The top model on a public test can trail on your claims notes. Anthropic's guide says larger or more domain-specific data generally gives better embeddings for text in that domain.
- **Cost: Vectors cost to keep.** Bigger vectors need more storage, memory and search time. Test whether the extra size helps your results at all.
- **Control: Where the text goes.** A hosted model sends your text to a vendor. An open model on your servers keeps it in house, but someone has to run it.

Anthropic's embeddings guide says it does not offer its own embedding model, and tells readers to assess a variety of vendors for their use case. Researchers who built the MTEB benchmark (a public test that runs embedding models on many tasks) found the same thing from the other side: no single method wins every task.

> "Anthropic does not offer its own embedding model." (Anthropic)
>
> "We find that no particular text embedding method dominates across all tasks." (The MTEB researchers)
>
> "Using larger embeddings, for example storing them in a vector store for retrieval, generally costs more and consumes more compute, memory and storage than using smaller embeddings." (OpenAI)

## What about vector size, input limits and switching later?

Some models let you shorten the vector, which is the count of numbers in it. OpenAI's guide says a dimensions setting shortens an embedding while keeping its ability to represent concepts. Anthropic's guide says models with several output sizes, such as voyage-code-4, generate Matryoshka embeddings. These pack a rough summary and finer detail into one vector.

Check the input limit too. Each model reads only so much text at once, counted in tokens (small pieces of text, roughly words). Anthropic's guide, which points to Voyage AI's models, says the total number of tokens across all inputs has a cap, so plan chunk sizes around the model you pick. Check the languages as well. Test each language your users write in, using real questions from those users.

*Diagram, Switching models means building the index again: Old vectors cannot be mixed with the new model's vectors, so every chunk is read again and the index is rebuilt. Only then do questions go through the new model, and the two must match.*
1. Old vectors are set aside, because they cannot be compared with new ones.
2. The new vectors are stored together to form a fresh index.
3. The new index is built, and questions go through the same new model.

Microsoft's guidance for Azure AI Search says to always use the same embedding model for the stored documents and the queries. So a switch means re-embedding every chunk and rebuilding the index. Old and new vectors are never mixed.

> **Tip:** Keep the test set after you launch. When a new model comes out, build the new index beside the old one, run the same test questions against both, and switch only if the new one wins on your data.

### How would you choose a model for a legal team's contract search?

A legal team has 40,000 contracts, and lawyers ask questions like which contracts let either side end the deal early. The contracts cannot leave the firm, so hosted models need a close look. I would build a test set from questions lawyers really asked and check that long clauses fit each input limit.

1. **Test with real questions:** Use questions the lawyers asked last year, with the right clause marked by a senior associate.
2. **Check privacy before any vendor:** If the contracts cannot leave the firm, an open model on the firm's own servers is the first candidate to test.
3. **Plan the re-index before go-live:** Write down the cost and time to re-embed 40,000 contracts, so a later switch is a planned job, not a surprise.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] Start from the job: the text, its length, its languages and where the data may go.
- [ ] Test on your own real questions with the right answer marked, not on a public leaderboard alone.
- [ ] Weigh accuracy against cost, speed and vector size.
- [ ] Know that switching models means re-embedding everything and rebuilding the index.
- [ ] Check that the input limit fits your chunks.
- [ ] Say how you would know the choice is good enough, and what result would change your mind.

**Common traps**

- Trap: "Pick the model at the top of the leaderboard." Better: Leaderboards test general tasks. Test on your own questions, since no one model wins them all.
- Trap: "A bigger vector is always more accurate." Better: Bigger vectors cost more to store and search. Check whether the extra size helps your results.
- Trap: "We can switch models later for free." Better: A switch means re-embedding every chunk and rebuilding the index. Plan it like a migration, with a cost and a date.

## Can you spot the weak plan?

**Spot the weak plan:** A team is choosing an embedding model for its support search. Which plan is the weak one?

A. Test three models on 300 real past questions and score whether the right article lands in the top three.
B. Choose the model with the highest public leaderboard score, since it covers every task we have.
C. Record each model's vector size, price and data terms before deciding.
D. Check that the longest help article fits inside each model's input limit.

**Answer:** B. A leaderboard score covers general tasks, and no single model wins them all. The other three plans test on the team's own data, check cost and privacy, and check the input limit.

**Quick check:** Next month you switch from the current model to a new one. What must happen to the stored vectors?

A. Nothing, the old vectors still match the new model
B. Re-embed every stored chunk with the new model and rebuild the index
C. Only re-embed the documents added after the switch
D. Lower the temperature so the old vectors fit

**Answer:** B. Vectors from different models are positioned on different maps, so old and new ones cannot be compared. Every chunk has to be read again and the index rebuilt.

## Can you answer these from memory?

**Flash cards**

- **What does an embedding model do?** Turns text into a vector, a list of numbers, so similar meanings sit close together.
- **Pick by public leaderboard alone?** No. No model wins every task, so test on your own real questions.
- **What is the dimension?** How many numbers a vector holds. More means more storage and slower search.
- **What must match for search to work?** The same model for the questions and for the stored documents.
- **Why does privacy matter here?** A hosted model receives your text. An open model on your servers keeps it in house.
- **What if you change the model later?** Re-embed every chunk and rebuild the index. Old vectors cannot be mixed in.

## Likely follow-up questions

- Q117 What is a vector database? https://designervenkat.online/interview/ai/what-is-a-vector-database
- Q118 Cosine vs dot product vs Euclidean distance? https://designervenkat.online/interview/ai/cosine-vs-dot-product-vs-euclidean-distance
- Q114 Fixed vs recursive vs semantic chunking? https://designervenkat.online/interview/ai/fixed-vs-recursive-vs-semantic-chunking
- Q154 Sparse vs dense embeddings? (full answer coming)
- Q301 How do you fine-tune embedding models? (full answer coming)

## Learn it in depth

- [Choosing an embedding model](https://designervenkat.online/learn/ai-engineering/embedding-models)
