LearnThatStack Ace your next interview
RAG (Retrieval-Augmented Generation) · question
Question 3 of 56

What is an embedding, and why is it central to RAG?

beginner
← All RAG (Retrieval-Augmented Generation) questions
Re-explain

An embedding is a list of numbers, called a vector, that a model produces from a piece of text. Text with similar meaning gets vectors that sit close together in vector space.

RAG depends on embeddings because retrieval must match on meaning, not exact words. You embed each chunk at index time and the question at query time, then hand the nearest chunks to the LLM that writes the answer. A question about getting money back can reach the refund policy with no word in common.

q = embed("can I get my money back")      # one vector, e.g. 1536 floats
hits = index.search(q, k=5)               # chunks whose vectors are nearest

The query and the chunks must go through the same embedding model, or the numbers are not comparable. And the vector only carries what the model learned, so rare product names or IDs can be missed.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for RAG (Retrieval-Augmented Generation) One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

What you can say

  1. An embedding is a vector, a list of numbers a model produces from a piece of text, and text with similar meaning gets vectors that sit close together.
  2. RAG depends on that because retrieval has to match on meaning, not on exact words.
  3. At index time you embed every chunk, at query time you embed the question, and the nearest chunks go to the LLM that writes the answer.
  4. So a question like 'can I get my money back' can still reach the refund policy, even with no word in common.
  5. The query and the chunks have to go through the same embedding model, or the numbers aren't comparable.
  6. The limit is that the vector only carries what the model learned, so rare product names or IDs can get missed.

Weak answers to avoid

  • Treats embeddings like keyword matching The point is matching on meaning, so a question can find a passage with no words in common. Mixing this up with keyword search misses why RAG needs embeddings.
  • Skips the same-model rule Vectors from two different models aren't comparable, so the distances mean nothing. Say that chunks and queries must go through the same embedding model.
  • Defines embeddings but never ties them to RAG The question asks why they are central. Walk the flow: embed chunks at index time, the question at query time, and pass the nearest chunks to the LLM.
  • Presents embeddings as flawless A vector only carries what the model learned, so rare product names and IDs can be missed. Name that limit and say keyword search can cover it.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the RAG (Retrieval-Augmented Generation) cheatsheet.

← Back to all RAG (Retrieval-Augmented Generation) questions
Pro · $10/mo

50 of 56 RAG (Retrieval-Augmented Generation) answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime