Build a RAG chatbot: the pipeline from documents to answers
A RAG chatbot answers from your documents by retrieving the right passages first. See each stage of the pipeline, a small code sketch and the failures to test for.
Read articlePeople say train when they mean give the model my documents. Three methods get you there: instructions, retrieval and fine-tuning. Here is how to choose and where to start.
By the Askocto team · · 4 min read
When people say they want to train ChatGPT with their data, they almost always mean they want it to answer questions using their documents. That is rarely done by training the model itself. It is done by giving the model the right information at the moment of the question, which is cheaper, easier to update and easier to check. This article explains three methods and when each applies.
In short: For facts that change, use retrieval from your sources. For style and fixed rules, use instructions and procedures. Consider fine-tuning only for narrow, stable behavior that the first two cannot achieve.
Three different things hide behind the word, and they work in different ways.
| Method | What changes | Good for | Weak at |
|---|---|---|---|
| Instructions | The brief the model reads before each conversation | Tone, scope, refusal rules | Large amounts of facts |
| Retrieval from your sources | The passages passed in with each question | Policies, product details, changing content | Behavior and style on its own |
| Fine-tuning | The model's internal settings | Consistent format or style in a narrow task | Facts that change, and traceability |
Check the provider's current documentation for what each of these looks like on their platform, since the options and terms differ and change.
Instructions are plain text that tells the model who it is, what it may discuss and how to answer. They are the cheapest change and take effect immediately. Use them for:
Instructions have limits. A long block of facts in the instructions gets stale, and long instructions compete for room with the conversation. For the habits of good instructions, keep them short and specific.
Retrieval keeps your knowledge outside the model. Your documents are split into passages and stored in a searchable form. When a customer asks a question, the system finds the best passages and gives them to the model with the question, and the model writes an answer from them.
Why this is usually the right answer to "train it on my data":
The quality of retrieval depends on the quality of your content. Structuring a knowledge base for AI is the most useful preparation you can do.
Fine-tuning continues a model's training on examples you supply, so it adopts a style, format or behavior. It suits narrow cases, such as always producing a certain structured output or matching a specific writing style across thousands of examples.
It is a poor fit for facts. Facts embedded in a model's settings are hard to update, hard to trace and can still be answered wrongly. For a deeper comparison read RAG vs fine-tuning and the guide to fine-tuning language models.
In Askocto, this path is the product's core flow. You add a website, files, pasted text or Q&A pairs under Build > Sources, watch each move from Queued and Training to Ready, and use Auto-retrain if you want sources refreshed on a schedule. You write procedures under Build > Procedures, and test in Test > Playground, where each answer shows the sources and procedure behind it. The guide on training an agent on your help center goes through the flow in detail, and the data sources docs list each source type. Start free to try it on your own content.
Be careful about what goes into any system:
Treat the sources as something customers could see through answers. This is not legal advice; ask your security or legal contact about sensitive material.
You can make a model answer from your documents by supplying them as sources the system retrieves from. Check the provider's documentation for the specific features and terms of each product.
Training usually refers to building a model from scratch, which providers do. Fine-tuning adjusts an existing model with extra examples. Most support needs are met by retrieval and instructions instead.
Update the source and retrain it, or schedule automatic retraining if your platform offers it. This is the main advantage of retrieval over fine-tuning.
That depends on the provider, product and plan. Read the data handling terms before you upload anything, and ask your security contact if you need certainty.
Askocto answers the repeat questions across chat, email and voice and hands the hard ones to your team.
A RAG chatbot answers from your documents by retrieving the right passages first. See each stage of the pipeline, a small code sketch and the failures to test for.
Read articleRetrieval finds candidates and reranking puts them in the right order. See how the second pass works, when it is worth the extra step and how to measure the gain.
Read articleAn embedding turns a sentence into a list of numbers so search can match meaning, not just words. Learn how it works, what it misses and how to check it on your own content.
Read article