Why RAG if the model is already smart
Language models know a lot in general but nothing about your business: price lists, contracts, stock levels, internal rules. Fine-tuning on that is costly and goes stale as data changes daily. RAG inserts the right data into each request instead.
How it works
- Prepare: split documents into passages along headings and sections.
- Retrieve: find the 3–8 most relevant passages for the question.
- Prompt: question + passages + rules (“answer only from this data”).
- Answer with sources so people can verify.
Keyword search vs. embeddings
| Keyword search | Embeddings (vector search) | |
|---|---|---|
| Matches by | shared words | meaning: “send it back” finds “return policy” |
| Enough for | a site, FAQ, price list — dozens of pages | thousands of documents, varied wording, multiple languages |
| Infrastructure | none | an embedding model + a vector store or DB extension |
Hybrid search often works best: keywords catch exact terms (SKUs, names), embeddings catch meaning. A simple keyword RAG example: build an AI assistant for your website.
When you need a vector database
- More than a few hundred documents.
- Users phrase questions differently from the documents.
- Multiple languages.
- Metadata filters: department, date, type, access rights.
It doesn’t have to be a separate system — extensions such as pgvector for PostgreSQL are often enough.
Common mistakes
- Bad chunking that splits tables or drops headings.
- A stale index after documents change.
- No “I don’t know” rule — the model improvises.
- No access control — a customer bot finds internal docs.
- No evaluation set.
How to evaluate
Collect 30–50 real questions with correct answers. Check both retrieval (were the right passages found?) and the final answer, and rerun the set after every change to chunking, prompts or models.
Implementation is part of AI integration.
FAQ
What is RAG in simple terms?
The AI first finds relevant passages in your documents and answers only from them, citing sources.
Do I need a vector database for RAG?
Not always — keyword search works for dozens of pages; vector search pays off for hundreds or thousands of documents and meaning-based queries.
Why RAG instead of fine-tuning?
Data can be updated any time without retraining, answers are verifiable against sources, and it costs less.
Let’s talk about your project
Describe the task in a couple of sentences — I reply within one business day. Free and no obligation.
Telegram Discuss a project