RAG Essentials
·Bryan Lai
RAG Essentials
RAG is search plus context.
If search is bad, the answer will be bad.
The model cannot recover a document it never sees.
Rules
- Fix search before blaming the model.
- Lock down permissions before indexing company data.
- Clean the messy sources: email, Slack, docs, meetings, code.
- Start with text and tables.
Implementation
- Use one document shape. Every source should map to fields like title, body, type, owner, date, and permission.
- Index more than one source. Drive, Slack, tickets, docs, and code often hold different pieces of the answer.
- Respect company language. If the company has weird acronyms, product names, and customer terms, the search system must learn them.
- Split by domain. Product manuals, sales policy, and legal docs should not all use the same retrieval recipe.
- Route the query. A policy question should go to policy docs. A product question should go to product docs.
- Re-index when data changes. Old vectors point to old meaning.
- Use synthetic Q&A when data is thin. Generate likely questions from important docs, then test whether search finds the right source.
- Collect feedback. Clicks, dwell time, thumbs up, thumbs down, and "this did not answer my question" all matter.
- Log everything. Inputs, retrieved chunks, final answers, user feedback, model version, and timestamps.
When users say no, split the failure:
- Did search fetch the wrong source?
- Did the model use the right source badly?
- Did the user ask the wrong question?
Bottom line: bad retrieval kills good models.