Page languageFrançaisEnglish
Teacher area
Laurent PoupetClaude trainer and artificial intelligence architectStudent area

Category · Data and retrieval-augmented generation

What is an embedding?

An embedding is a text turned into a list of numbers that sums up its meaning. Two sentences that mean the same thing get close lists, even with different words. That is what makes searching by meaning possible.

By , Claude trainer and artificial intelligence architect · Updated

How it works

  • The model turns a text into a list of a few hundred to a few thousand numbers, and the closeness between two lists measures how similar their meanings are.
  • This closeness is most often measured with cosine similarity, which compares the direction of the vectors rather than their length.
  • An embedding captures exact identifiers poorly, such as a contract number or an error code, hence the value of combining it with full-text search.

The trap to avoid

The trap is mixing models; vectors produced by two different models cannot be compared, except within a family designed for it, such as voyage-4, and changing models usually means re-indexing everything.

A concrete example

The question “how do I request time off?” and the passage “absence request procedure” share almost no words. Their embeddings, however, are close, because they are about the same thing: searching by meaning finds the right passage where a keyword search would fail. Conversely, for an exact contract number, keyword search remains better.

What is the difference with full-text search?

CriterionEmbeddingfull-text search
What is comparedThe meaning of sentencesThe exact words
Strong forRephrasing, synonymsIdentifiers, codes, names
TogetherHybrid search combines bothHybrid search combines both

Related terms

Where this is taught

This idea comes up throughout the lessons; we work on it with your own examples during a lesson.

Lesson content (step-by-step instructions, exercises with solutions, quizzes) is for students only, with an access code received after the first lesson.

See the full program

Sources

All glossary terms

Trial lesson · 30 min · $20

Book (new tab)