How to choose an embedding model: MTEB and your own evals
How to choose an embedding model: read MTEB the right way, weigh dimensions, context length and cost, then test on your own queries with a Python harness.
Tags
17 posts tagged
How to choose an embedding model: read MTEB the right way, weigh dimensions, context length and cost, then test on your own queries with a Python harness.
Reciprocal rank fusion (RRF) merges ranked lists by summing 1/(k + rank) for each document. Why k = 60, why it beats adding scores, with runnable Python.
Hybrid RAG combines keyword (BM25) and vector search, then fuses the rankings. Why each misses what the other finds, and how to fuse them, with runnable Python.
Contextual retrieval prepends an LLM-written note on where each chunk sits in its document before indexing, cutting RAG retrieval failures. With Python.
RAG chunking strategies decide how documents are split before embedding. Fixed-size, recursive, structure-aware and semantic chunking compared, with Python.
GraphRAG builds a knowledge graph and community summaries from your documents so an LLM can answer whole-corpus questions. How it works, with a Python demo.
ColBERT is a late interaction retriever: one vector per token and a MaxSim score instead of one vector per document. How it works and costs, with Python code.
Reranking rescores a retriever's shortlist with a cross-encoder that reads the query and each document together. Why it beats embeddings alone, with Python.
BM25 ranks documents by how often query terms appear, how rare they are and how long the document is. The formula, k1 and b, with a from-scratch Python demo.
Matryoshka embeddings pack the most useful information into the first dimensions, so you can truncate vectors to cut storage. How it works, with a Python demo.
pgvector is a Postgres extension that stores embeddings and runs nearest-neighbor search in SQL. Types, operators, HNSW vs IVFFlat and the filtering trap.
HyDE (hypothetical document embeddings) has an LLM write a fake answer, then searches with its embedding. How HyDE and query rewriting work, in Python.
HNSW is a layered graph index for approximate nearest neighbor search. How M, ef_construction and ef_search trade recall for speed, with a Python build.
Cosine similarity scores two embeddings by the angle between them. When it equals the dot product, when Euclidean distance agrees, with a Python demo.
RAG (retrieval-augmented generation) fetches relevant text from your data and puts it in the prompt so the LLM answers from it. How it works, in Python.
Semantic search finds results by meaning using embeddings, not shared words. How it differs from keyword (BM25) search, where each fails, with a Python demo.
A vector database stores embeddings and finds the nearest ones to a query fast. How ANN indexes trade recall for speed, with a runnable Python IVF demo.