Embedding

Compass

A numerical representation of a passage of text, arranged so that similar meanings fall near one another.

What is an embedding?

An embedding is a numerical representation of a passage of text, produced by a model trained so that passages with similar meaning fall near one another. Similarity between two embeddings therefore approximates similarity of meaning. Retrieval uses this to find passages related to a question even where no word is shared.

Also called: Vector embedding, Text embedding

Why similarity of meaning is a weaker signal than it appears

An embedding is often described as capturing meaning, which overstates what it does and leads teams to trust it where they should test it. Two passages about a policy and its repeal embed close together, because they discuss the same subject in nearly the same language, while meaning opposite things. Negation and numeric thresholds are exactly the distinctions a regulated answer depends on, and exactly the distinctions embeddings handle least well. This is the reason keyword ranking remains in the retrieval path.

  • Embeddings retrieve passages that share no vocabulary with the question.
  • Proximity reflects subject similarity, which can hold between contradictory statements.
  • The embedding model is a dependency, so changing it invalidates the whole index.
  • Domain vocabulary absent from training embeds imprecisely and retrieves poorly.

How an embedding works

  • Each chunk is passed through an embedding model and stored as a vector.
  • The same model converts an incoming question into a vector of equal dimension.
  • A vector index returns the nearest stored vectors by cosine or inner product.
  • Those candidates are merged with the keyword ranking before reranking occurs.
  • The model version is recorded, since vectors from two versions are incomparable.
  • Reindexing the corpus is scheduled whenever the embedding model changes.

How an embedding is evaluated

An embedding model is assessed on the retrieval it enables rather than on a published benchmark. Measure the following on the corpus and the questions in use:

  • recall of the correct passage within the nearest candidates returned
  • separation between a statement and its negation in the same corpus
  • retrieval quality on domain abbreviations absent from general training data
  • performance per language where the corpus is multilingual
  • change in recall when the embedding model version is replaced

Limitations, risks and common failure modes

  • A general-purpose model embeds internal terminology as though it were ordinary prose.
  • Opposite statements retrieve together, so an answer cites a superseded clause.
  • An embedding model is replaced without reindexing, leaving the index incoherent.
  • Vector similarity scores are compared across models that produced them differently.
  • Short chunks embed noisily, which inflates their apparent similarity to anything.

All 315 terms