← All news

News / Learn / Embeddings & vector search

How do you choose an embedding model?

You'll be able to pick an embedding model by testing it on your own data, not by reading a leaderboard.

An embedding model turns text into a list of numbers. Texts with similar meaning get similar numbers. Choosing one means balancing how well it matches meaning in your domain, how big its vectors are, how fast it runs, and what it costs to host or call.

The embedding model sets the ceiling for your search quality. If it misreads your domain, no later step fixes that. Vector size and model speed also drive your storage bill and your response times, so the choice affects cost and user experience from day one.

Start with the task. Are you matching questions to answers, finding near-duplicates, or grouping documents? Some models are trained mainly for search queries against passages. Others are trained for general similarity. Check the model card for the training goal, supported languages, and the maximum input length. If your chunks are longer than the limit, the model silently drops text or you must split it differently.

Next, look at the vector size, often called the dimension. Larger vectors can capture more detail but take more memory and slow down search. Many models let you shorten the vector, which trades a little accuracy for lower storage. Multiply the dimension by the number of items and the bytes per number to estimate storage before you commit.

Then measure. Build a small test set of real queries paired with the passages that should answer them, often 50 to 200 pairs. Embed your documents with each candidate model, run the queries, and score whether the right passage appears near the top. Use retrieval metrics such as recall at k. Test on your language, your jargon, and your typical document length, because general benchmarks may not match your data.

Finally, consider operations. Hosted APIs are simple but add network latency, rate limits, and a per-token cost. Open-weights models you run yourself give control and predictable cost but need hardware and maintenance. Also plan for change. If you switch models later, every stored vector must be recomputed, so record which model and version produced each vector.

A minimal test loop that compares recall for two candidate models on your own query set.

import numpy as np

def recall_at_k(query_vecs, doc_vecs, gold_index, k=5):
    # Normalize so dot product equals cosine similarity
    q = query_vecs / np.linalg.norm(query_vecs, axis=1, keepdims=True)
    d = doc_vecs / np.linalg.norm(doc_vecs, axis=1, keepdims=True)
    scores = q @ d.T
    hits = 0
    for i, gold in enumerate(gold_index):
        top = np.argsort(-scores[i])[:k]
        if gold in top:
            hits += 1
    return hits / len(gold_index)

# embed_fn(model_name, texts) is your own function that calls the model
# for name in ["model_a", "model_b"]:
#     qv = embed_fn(name, queries)
#     dv = embed_fn(name, documents)
#     print(name, recall_at_k(qv, dv, gold_doc_ids, k=5))

A short sketch to show the idea. Check the official docs of the tool you use.

  • Choosing by a public leaderboard alone Public scores use generic data. Build a small test set from your own queries and documents and score candidates on that.
  • Mixing vectors from different models Vectors from different models live in different spaces and cannot be compared. Store the model name with each vector and re-embed everything when you switch.
  • Ignoring the input length limit Check the maximum token count. Chunks longer than the limit get cut off, so match your chunk size to what the model accepts.
  • Skipping the storage math Estimate items times dimension times bytes per value before choosing. Large vectors across millions of items can cost far more than expected.

Learn how chunking choices interact with the embedding model, and how reranking can recover accuracy after a fast first-pass search. Then study evaluation design so your test set grows with your product.

Do I need the biggest embedding model?

Not usually. Test on your data. A smaller model often matches a larger one for narrow domains, and it is cheaper and faster to run.

Can I change embedding models later?

Yes, but every stored vector must be recomputed with the new model. Keep the raw text so you can re-embed without losing source material.

Should I use one model for queries and documents?

It depends. Some models are trained for asymmetric search, where queries and passages use different prompts or settings. Read the model's usage notes and follow them.

Does a higher dimension always mean better results?

No. Higher dimensions can capture more detail, but gains often flatten out. Measure accuracy against storage and speed before you decide.

How often should I re-check my choice?

Re-run your test set when your data changes, when you add a language, or when you consider a new model. Keep the test set so comparisons stay fair.

Written with AI by CapyLaunch. Spotted a mistake? Email hello@capylaunch.com.