Reference · Glossary

Embedding

Last updated

An **embedding** is a list of numbers that captures the meaning of text (or other media) so computers can compare how similar two ideas are — not just whether they share keywords.

#Intuition

Map sentences into a high-dimensional space where “refund policy” sits near “money-back guarantee,” even if the words differ. Distance metrics like cosine similarity then power search and clustering.

#When to use

  • Semantic search over docs or tickets
  • RAG retrieval before generation
  • Recommendations and near-duplicate detection
  • Routing support questions to the right queue

#When not to

Exact string matching — looking up an order ID or error code is usually faster with keyword or database lookup than vectors. Also avoid treating embeddings as a fact store; they encode similarity, not truth.

#Practical tips

  • Prefer the same embedding model at index time and query time.
  • Chunk size and overlap strongly affect retrieval quality.
  • Hybrid search (keyword + vector) often beats either alone on IDs and rare proper nouns.
  • Re-embed when you change models; old vectors are not compatible across every provider.

#Example

vec = embed("laptop won't turn on")

#Learn next