RAG sounds simple but has many ways to go subtly wrong.
Poor chunking. Chunks too large dilute relevance; chunks too small miss context; chunks that split mid-sentence break meaning.
Test different strategies.
Bad embedding model choice. Some embedding models work better for some domains.
A model trained mostly on English news may underperform on, say, medical terminology or non-English content.
Stale data. If you index your documents once and never refresh, your RAG system will get out of date.
Plan how often to re-index and how to handle deletions.
Over-retrieval. Returning too many chunks fills the context window with marginally relevant material and distracts the LLM.
Often, 3–5 high-quality chunks beat 20 mediocre ones.
Under-retrieval. Returning too few chunks risks missing the key information.
Tune this carefully.
Lost in the middle. LLMs are often best at attending to information at the beginning and end of their context, not the middle.
Putting the most important chunks at the start of the context (or restating key facts at the end) helps.
No guardrails. If your prompt is "Answer based on this context," and the context doesn't actually contain the answer, many models will still try to answer using their general knowledge — which defeats the point.
Explicit instructions like "If the context does not contain the answer, say 'I don't know based on the available information'" help, but aren't perfect.
Confidential data leakage. Be careful what you put in the vector database.
If users have differing permissions (some can see HR documents, others can't), the RAG system needs to filter retrievals accordingly.
This is non-trivial.
Evaluation is hard. It's easy to build a RAG system that seems to work but actually performs poorly on hard queries.
Building a real evaluation set of (question, ideal answer) pairs and measuring is essential for production use.