SheetИ-02
Submit a request
Article · И-02RAG2 min read

RAG for procedures: how to stop a model from making things up

A language model can answer wrongly with confidence. For procedures and instructions that is unacceptable. Here is how to build a RAG system that answers only from documents and honestly says when there is no answer.

§ 1Why models «make things up»

A language model is trained to continue text plausibly. Ask it about a procedure it hasn't seen and it will compose a plausible answer. For procedures, safety instructions and contracts this is dangerous.

§ 2How RAG works

RAG (Retrieval-Augmented Generation) separates search from answering:

  • documents are split into chunks and indexed;
  • for a question, the system finds the most relevant chunks;
  • the model receives the question and the retrieved chunks and answers only from them;
  • the answer cites the document and clause it came from.

§ 3Rules that stop the model from inventing

  • **No source, no answer.** If search finds no relevant chunks, the system replies that the documents contain no answer.
  • **A quote next to the answer.** The user sees the procedure clause and can check it.
  • **Access rights.** Staff get answers only from documents they have access to.
  • **A log.** All questions and answers are recorded to catch errors.

§ 4How to check quality

Before launch we collect a set of real questions — from staff, from logs, from typical situations — and reference answers with clause numbers. The system runs through this set before launch and after every change to documents or settings. We separately check questions that the documents don't answer: the system must decline to answer.

§ 5Where to run it

If documents can't be sent to external services, the model and the index are deployed on the company's server. Open models are weaker than the best cloud models at complex reasoning, but for answering from a retrieved chunk they are often enough; this is checked on your questions.

§ 6Where to start

Choose one set of documents that people use most often and 50–100 real questions about it. That is enough to find out within a few weeks whether RAG suits your task.