Notes

Embedding Model

A search for "how do I cancel my plan" should find a page titled "Ending your subscription", even though the two share almost no words. An embedding model is what makes that possible: it converts a piece of text into a list of numbers positioned so that related meanings land near each other.

What the numbers are

It is a transformer — usually a compact encoder rather than a generative model — whose token outputs are pooled into one fixed-length vector, typically between 384 and 3,072 dimensions. Training pulls pairs that belong together (a question and its answer, a title and its article) closer while pushing unrelated text apart, so cosine distance in the resulting space tracks meaning instead of word overlap. The generative model never sees these vectors; they exist only to decide which text it gets to read.

Choosing one
  • Task shape: a model trained to match short queries against long passages behaves differently from one trained to compare two sentences, and some expect an instruction prefix on the query.
  • Dimension and cost: larger vectors retrieve slightly better and charge memory for every chunk in the index, permanently.
  • Domain and language: an English web-trained model degrades on clinical notes or on Hindi. The MTEB leaderboard is a starting point; your own queries are the deciding test.
Why the choice sticks

Documents and queries must be embedded by the same model with the same pooling, so a switch means re-embedding the entire corpus. When a retrieval system keeps answering from the wrong document, a mismatched or ill-suited embedding model is a more common cause than a weak generator.

An embedding model turns text into a fixed-length vector whose position encodes meaning, so passages with similar sense sit close together regardless of shared wording. It is the component that makes semantic search and RAG retrieval work: every chunk is embedded when the index is built and every query when it is asked, by the same model. Its quality caps retrieval quality, and replacing it forces the whole corpus to be re-embedded.

Picture an enormous map where every sentence gets a pin, and sentences that mean similar things are pinned close together — "my flight was cancelled" right next to "the airline called off my trip", even though the words are different. An embedding model is the tool that decides where each pin goes. It reads a piece of text and turns it into a position on that map. This is how an assistant searching through your documents finds the right passage when you ask in your own words, instead of needing the exact phrase the document happened to use. Better pinning, better answers.