Embeddings and RAG: how a model answers from your documents
Essence
An embedding is a vector of hundreds or thousands of numbers that encodes the meaning of a text. Texts with similar meaning get nearby vectors, even if they share no words. RAG (Retrieval-Augmented Generation) uses this for search: before asking the LLM, we find relevant document fragments and insert them into the prompt. The model answers from up-to-date data instead of "from memory".
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep