AI Hints
Home›RAG Tutorial›What Is RAG
RAG · Lesson 2 of 120

Why Models Need RAG

Private and fresh facts.

⏱ 2 min read▶ Video at 1:11🎓 Free
Watch this lesson in the RAG courseWatch on YouTube ↗Full RAG course

A language model learns from a huge amount of public text, up to a cut off date. After that, it learns nothing new. And it never saw your private documents. So questions about your business are a problem.

Why Models Need RAG
From the video: Why Models Need RAG
  • Trained on public text
  • Frozen at a cut off date
  • Never saw your files

Asking without RAG

Here we ask a model about next day delivery at Northwind Bikes, a small bike shop. The model has never seen this shop's policies. Run it. The model can't know the real price, so the honest result is a general answer, or a guess, not our actual policy.

no_rag.pypython
from langchain.chat_models import init_chat_model

llm = init_chat_model("google_genai:gemini-flash-lite-latest", temperature=0)

question = "How much does next-day delivery cost at Northwind Bikes? One sentence."
print(llm.invoke(question).text.strip())
Output
Next-day delivery at Northwind Bikes costs $20.00.

Without and with RAG

Without RAG, the model can only guess, or say it doesn't know. With RAG, we hand it the shop's shipping page, and it can answer with the real price, and even say where that came from.

Model alone

  • No private factsMay guessNo sources

Model with RAG

  • Reads your documentsReal answersCan cite sources

Summary

Models don't know private or recent facts, and they may guess. RAG gives them the facts they need. Next, how RAG works, step by step.

Key takeaways
  • Frozen knowledge
  • No private data
  • RAG fills the gap
Next up: How RAG Works — retrieve, then generate