Skip to content

RAG Simply Explained

Read the Portuguese translation →

Author: Better Stack · Watch on YouTube

Video authored by the channel shown, not by IANIA; all rights belong to the creator. Transcript and summary generated automatically; the original-language content is preserved.

Original language: English

Original video: RAG Simply Explained · Channel: Better Stack · 01:01 · Watch on YouTube

Topics: Data, databases and embeddings, AI models, RAG, search and information retrieval

The video explains how vector databases help models answer questions about information they did not encounter during training, such as internal company documents. Text is converted into embeddings—vectors that represent meaning—so a database can retrieve relevant text even when a query uses different words. RAG connects this retrieval process to a language model by adding relevant text to the prompt alongside the user’s question. The model then uses that text to generate its answer.

  • Models may need to answer questions about information they never learned during training.
  • A vector database stores and searches data by meaning.
  • Embeddings are lists of numbers that capture the meaning of text.
  • Texts with similar meanings have embeddings that are close together.
  • A user’s question is also converted into an embedding for searching.
  • The database returns text that is closest in meaning to the question.
  • RAG connects vector database retrieval to language models.
  • The app adds relevant text chunks and the original question to the prompt.
  • The model uses the retrieved text to answer questions about documents it was never trained on.
Start Chapter Summary
00:00 Why use a vector database? The video introduces the need to ask models about information outside their training and explains meaning-based search with a refund-policy example.
00:30 Embeddings and vectors Embeddings represent text meaning as vectors, allowing a database to find text that is semantically close to a query.
01:01 How RAG generates answers RAG adds relevant retrieved text and the original question to the prompt so the model can answer using that information.

a vector database is which lets you store and search data by meaning. — 00:00

the text gets turned into embeddings, which are long lists of numbers that capture its meaning. — 00:00

That collection of numbers is called a vector and it’s where the database gets its name. — 00:30

RAG or retrieval augmented generation connects vector databases to the models. — 00:30

The model then writes its answer using that text — 01:01

vector database, embedding, vector, RAG

00:00 Okay, so beyond the models themselves, you’ll want to ask questions the model never learned during training, like about your company’s internal docs or maybe something that happened yesterday. First up, a vector database is which lets you store and search data by meaning. So, a search for how do I get my money back can find a document called refund policy even though the two don’t share any single words. To do that, the text gets turned into embeddings, which are long lists of numbers that capture its meaning. You can picture it as a chart with two distinct directions. Say

00:30 how round something is and how much of a fruit it is an orange and an apple land close together and a car ends up far away. An embedding does the same thing with thousands of directions. That collection of numbers is called a vector and it’s where the database gets its name. It stores each embedding next to the original text and when you search, your question gets turned into an embedding, too, so the database can hand back the text that sits closest to it. RAG or retrieval augmented generation connects vector databases to the models. When you ask a question, your app uh searches the vector database for the

01:01 most relevant chunks of text, then pastes them into the prompt along with your original question. The model then writes its answer using that text, so it can answer questions about a document it was never trained on.