AI Hints
Home›LangChain Tutorial›RAG in Practice
LangChain · Lesson 78 of 120

RAG Pitfalls

And fixes.

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

Most RAG problems fall into a few familiar patterns. Once you know them, you can spot them quickly, and fix them.

RAG Pitfalls
From the video: RAG Pitfalls
  • Familiar problems
  • Spot them quickly
  • Fix them

Pitfalls and fixes

Chunks too small lose meaning, so make them bigger, or add overlap. Chunks too big mix topics, so make them smaller. Wrong document found, so improve metadata and use filters. The model ignores the context, so strengthen the prompt. And the model invents answers, so add a fallback, and a score threshold.

ProblemFix
Chunks lose meaningbigger chunks, overlap
Chunks mix topicssmaller chunks
Wrong doc foundmetadata, filters
Context ignoredstronger prompt
Invented answersfallback, threshold

Two more

Two more to watch for. Out of date documents give out of date answers, so rebuild the store when policies change. And follow-up questions search badly, so rewrite them first.

keyvalue
Stale documentsrebuild the store
Follow-upsrewrite the question
Alwaystest retrieval
Thentest answers

Summary

Most RAG problems come from chunking, retrieval, or the prompt, and each has a simple fix. Next, practise building a complete FAQ bot.

Key takeaways
  • Check chunk size
  • Check retrieval
  • Check the prompt
Next up: Practice: Bookshop FAQ Bot — RAG end to end