Skip to main content

What are embeddings, and how are they used in search?

RAG · Intermediate 2

Short answer

An embedding is a vector of numbers that represents the meaning of a piece of text, so texts with similar meaning get vectors that are close together. In search you embed documents ahead of time and the query at search time, then return the documents whose vectors are nearest, often by cosine similarity.

Deeper answer

Embedding models are trained so that related text lands close together, which lets search match "forgot login" to "reset your password" without shared words. The vectors are stored in a vector index that can find nearest neighbours quickly, even among millions of items, using approximate search.

Limits matter in interviews: embeddings can miss exact strings such as product codes or names, and quality depends on the embedding model and the domain. That is why many systems combine vector search with keyword search, and why you must use the same embedding model for queries and documents.

What a strong answer covers

Answer it out loud in the mock interview about 1 min

Follow-ups to expect

Common mistakes

Learn it

Embeddings

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.