Your Chatbot Isn’t Dumb. It Just Never Read the Manual.
From the publisher’s feed, collected in the ZeroLabs newsroom.
Everything I wish someone had told me before I built my first RAG system, from the twenty-line demo to the version that survived real users.The demo took me an afternoon.I loaded about forty PDFs of internal documentation, split them into chunks, pushed the chunks into a vector database and wired the whole thing to an LLM. I asked it how our refund policy worked. It answered perfectly, right number of days and everything. I remember leaning back in my chair feeling slightly too pleased with myself.Then a colleague tried it. Her very first question was about refunds on annual plans. The bot told her, with total confidence, thirty days. The real answer was fourteen. The thirty-day rule belonged to monthly plans, and the annual-plan exception lived two paragraphs further down, sliced into a different chunk that never got retrieved.Nothing crashed. No error, no warning. Just a wrong answer delivered in a calm, helpful, entirely believable tone.That was the day I stopped thinking of RAG as “a vector database bolted onto ChatGPT” and started seeing it for what it actually is: a search engine with a writer at the end of it. If the search is bad, the writing will be bad, and it will be bad in the most convincing way possible.This is the guide I wish I’d had that week. It isn’t a catalogue of every RAG variant with a name. It’s an honest map of the parts that matter, the order in which they start to matter, and the traps that cost me the most time.First, why does RAG exist at all?Think of an LLM as a brilliant new hire who read most of the public internet up to a certain date and was then locked in a room. Ask general questions, and they’re superb. Ask about your pricing page from last Tuesday, a customer’s contract, or anything that never touched the public web, and they have two choices: admit they don’t know, or improvise. Models are not naturally good at the first one.You could fine-tune the model on your data. But fine-tuning is far better at changing how a model behaves than what it reliably knows. It’s expensive to repeat every time a document changes, and it gives you no way to point at where an answer came from.RAG takes the other road. Instead of making the model memorise your documents, you hand it the right pages at the exact moment it needs them. It’s the difference between a closed-book exam and an open-book one. Same student, very different result, as long as you give them the right book, open at the right page.A rule of thumb that has never let me down: fine-tune for behaviour (tone, format, domain style). Use RAG for knowledge (facts that change, facts that are private, facts that need a citation). Plenty of production systems quietly do both.The whole idea in one pictureFigure 1. RAG is really two systems running at different times.The offline half runs whenever your documents change. You pull text out of PDFs, web pages, tickets and wikis, clean it, split it into chunks, and turn each chunk into 3 an embedding: a list of numbers that captures roughly what the text means. Those vectors go into an index.The online half runs every time someone asks something. The question becomes an embedding too. You find the chunks whose vectors sit closest to it, paste them into the prompt next to the question, and ask the model to answer using that material and nothing else.That’s genuinely all RAG is. The rest of this article is about one uncomfortable fact: every arrow in that picture is a place where things can go quietly wrong.Chunking: the boring step that decides everythingIf I could give you only one piece of advice, it would be this: look at your chunks. Print fifty of them and actually read them. It’s the least glamorous hour you’ll spend on the project and probably the most valuable.My refund bug was a chunking bug. The rule and its exception had been split apart, so retrieval could only ever surface half the truth. No embedding model and no clever prompt could have rescued that.Fixed-size chunks (say, 500 tokens with a little overlap) are a fine place to start and a terrible place to finish. They cut sentences, tables and lists in half without mercy. Recursive splitting, which tries to break on paragraphs first, then sentences, then words, respects the natural shape of writing and makes a much better default.The real gains come from structure-aware chunking. If your documents have headings, use them. Keep a table together with its caption. Keep each FAQ question glued to its answer. Prepend the section title to every chunk, so that “Annual plans: refunds within 14 days” doesn’t turn into a context-free “refunds within 14 days.”The trick that fixed the most for me was parent–child chunking: search over small, precise chunks, but hand the model the larger section each one came from. You get sharp retrieval and enough surrounding context for the model to reason properly.And store metadata from day one: source, date, section, product, access level. You will want to filter on it much sooner than you think.Retrieval: why “semantic search” alone isn’t enoughEmbeddings are wonderful at meaning. Ask “how do I get my money back?” and dense retrieval will happily find a chunk titled Refund policy, even though the two barely share a word.But embeddings are surprisingly clumsy with exactness: error codes, product SKUs, people’s names, version numbers, the acronyms your company invented last year. Ask about ERR-4012 and a dense retriever may cheerfully return the page for ERR-4021, because to an embedding they look almost identical.Old-school keyword search (BM25, the algorithm behind classic search engines) has the opposite personality. It’s literal and precise, and it has no idea that “money back” and “refund” are related.So you use both. This is hybrid retrieval, and in my experience it’s the single highest-return upgrade over a basic setup. Run both searches, then merge the results. A simple and remarkably sturdy way to merge is Reciprocal Rank Fusion: every document earns points based on its position in each list, and you add the points up.score(doc) = sum over each list of 1 / (60 + rank of doc in that list)No normalising score scales, no fiddly weights. It just works, which is rare enough to be worth celebrating.Then add a reranker. Your first-stage retrievers are fast but shallow: they score the question and each chunk separately. A cross-encoder reranker reads the question and the chunk together and judges how well they actually fit. It’s far too slow to run across a million chunks, but perfect for re-scoring the top fifty.Figure 2. Retrieval as a funnel: wide and cheap first, narrow and careful lastRetrieve twenty to fifty, rerank, keep three to eight. Stuffing thirty chunks into the prompt “just in case” doesn’t help. Models tend to lose track of whatever sits in the middle of a long context, and you pay for every token you send.One more trick: rewrite the question before you search. People type follow-ups like “and for annual?”, which is a useless search query on its own. A small model can turn it into “refund policy for annual plans” using the conversation so far. Some teams go a step further and have the model write a hypothetical answer first, then search with that (the technique is called HyDE). Oddly enough, a made-up answer often looks more like your real documents than the question does.The RAG zoo, and when you actually need each animalRead enough posts and you’ll meet Naive RAG, Advanced RAG, Hybrid RAG, GraphRAG, Agentic RAG, Corrective RAG, Self-RAG, Adaptive RAG, Modular RAG, Hierarchical RAG, Multimodal RAG, Multi-Agent RAG… It starts to feel like you have to pick a religion.You don’t. Most of these aren’t rival architectures. They’re fixes for specific failures. So the useful question isn’t “which RAG is best?” It’s “what is my system getting wrong?”Figure 3. Diagnose the symptom first, then pick the upgrade. Not the other way round.Here’s how I think about the main ones.Naive RAG (retrieve top-k, generate) is where everyone should start. It handles FAQ-style questions over clean documents well, and it’s the baseline you’ll measure everything else against. Advanced RAG layers on query rewriting, hybrid search and reranking. If your system misses things it ought to find, this is your next step, and for a lot of products it’s the last one you’ll need.Corrective RAG puts a checkpoint between retrieval and generation. A grader looks at what came back and asks whether it’s actually relevant. If not, it filters the junk, rewrites the query and searches again, or falls back to another source such as the web. It earns its cost when retrieval is noisy and wrong answers are expensive: legal, medical, finance.Self-RAG moves the critic to after generation. The model drafts an answer, then interrogates it. Is every claim supported by the context? Did I answer the whole question? If not, it retrieves more and revises. It’s more accurate, and also slower and pricier, so put a hard cap on the number of loops.Adaptive RAG accepts that not every question deserves the same effort. “What’s our office address?” needs one quick lookup, maybe none at all. “How did our churn drivers change between 2023 and 2024?” needs several. A lightweight classifier sends each query down the cheapest path that can handle it.GraphRAG builds a knowledge graph of entities and relationships from your documents. It shines on questions about connections (“which suppliers are linked to the vendors flagged in last quarter’s audit?”) where the answer is scattered across many files, and no single chunk holds it. The bill is real, though: building the graph is expensive, and it’s only as good as your extraction.Hierarchical RAG indexes documents at several levels, from whole document to section to paragraph, and searches top-down. It’s excellent for long manuals, contracts and policy libraries, where knowing which section to look in is half the battle.Agentic RAG turns retrieval into a tool that an agent decides when and how to use. The agent makes a plan (“get Q4 revenue for both companies, compute the growth, then look up acquisitions”), calls retrieval, a SQL database, a calculator or the web, looks at what came back and decides what to do next. It’s the most flexible pattern and by far the hardest to debug. Multi-agent RAG spreads that work across specialised agents with an orchestrator, which helps on large research-style tasks and multiplies every other kind of complexity.Finally, multimodal RAG extends all of this to images, tables, charts, audio and video, either by converting them to text (OCR, captions, transcripts) or by embedding them directly. And memory gives the system a record of what this user said before, so a follow-up like “what about its population?” actually makes sense.Climb the ladder one rung at a time, and only when your evaluation tells you to. Every rung adds latency, cost and brand-new ways to fail.You can’t improve what you can’t seeFor months, my “evaluation” was asking the system ten questions I already knew the answers to and nodding when the replies looked right. That isn’t evaluation. That’s vibes.The most useful shift I made was to evaluate retrieval and generation separately. When an answer is wrong, there are really only two possibilities: the right information never reached the model, or it did, and the model fumbled it. Those need completely different fixes, and an end-to-end score on its own can’t tell you which one you’re looking at.Figure 4. Put a checkpoint at every stage, so a bad answer tells you where it went bad.For retrieval, collect a set of real questions (ideally from real users) and label which chunks contain each answer. Then measure Recall@k: how often does the right chunk show up in your top k? If that number is low, stop touching your prompt. The problem lives upstream.For generation, measure faithfulness: is every claim in the answer supported by the retrieved context? This is where hallucinations show their faces. Answer relevance checks whether the reply actually addresses what was asked.Using a strong model as a judge, with a clear rubric, makes all of this practical at scale, and open-source frameworks like RAGAS package these metrics up for you. But calibrate your judge against a few dozen human-graded examples first. A judge you’ve never checked is just a more expensive source of vibes.Fifty good, real questions beat five thousand synthetic ones you’ve never read.What changes when real users show upA prototype answers questions. A production system answers questions for thousands of people, about documents that change every day, while somebody watches the cloud bill. A few things that bit me, or people I know:Freshness. Your index starts going stale the moment someone edits a doc. Build incremental indexing that re-embeds only what changed, and date-stamp chunks so you can prefer recent ones.Permissions. If the HR folder is in your index, your chatbot will quote salaries to anyone who asks nicely. Filter retrieval by the user’s access rights at query time, every single time. A prompt is not access control.Latency. Every upgrade adds a hop: rewrite, two searches, rerank, generate, maybe a grading step. Run retrievals in parallel, cache embeddings and frequent answers, stream the response, and use smaller models for the cheap steps.Permission to say “I don’t know.” Tell the model explicitly to admit when the context doesn’t contain the answer, and set a minimum relevance score below which you don’t even try. This one change prevents a surprising number of confident wrong answers.Citations. Show your sources. They build trust, and they turn every wrong answer into a debuggable one, because you can see exactly which chunk led the model astray.Observability. Log the original query, the rewritten query, the retrieved chunk IDs and scores, the final prompt and the answer. When someone reports a bad response, you want to replay exactly what happened, not guess.If you remember nothing else1. Better retrieval beats a better prompt, almost every time. 2. Read your chunks. Most problems are visible to the naked eye. 3. Go hybrid and add a reranker before you reach for anything fancier. 4. Measure retrieval and generation separately, using real questions. 5. Add complexity only when a metric asks for it.My refund bot did eventually get it right. The fix wasn’t a bigger model or an agent framework. It was a chunker that kept rules next to their exceptions, a keyword index that noticed the words “annual plan,” and a reranker that understood the difference. Unglamorous, all three.The magic everyone sees is the language model. The quality everyone feels comes from the plumbing.If you’re building one of these right now, I’d love to hear what broke first for you. Mine was the refund policy.It’s always the refund policy.Your Chatbot Isn’t Dumb. It Just Never Read the Manual. was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.