Buildoto
All articles
RAGGetting started

What is RAG? Simple definition, steps, costs

10 juin 20267 min read

RAG (Retrieval-Augmented Generation) is a technique that lets an artificial intelligence answer from documents you provide, rather than from its general knowledge alone. Concretely, before drafting its answer, the system searches for the relevant passages in your files (contracts, procedures, manuals), then the language model writes an answer confined to those passages, citing the source.

In short

  • RAG works in 4 steps: chop the documents up, turn them into vectors, retrieve the relevant passages, generate a sourced answer.
  • The technique was formalized in 2020 by Patrick Lewis and his team at Facebook AI Research. It's now the standard method for connecting an AI to a company's documents.
  • On budget: custom development is negotiated between 10,000 and 70,000 € with an agency or a senior freelancer, and routine operations cost a few dozen euros a month.
  • Unlike fine-tuning, RAG doesn't modify the model: your documents change, the answers follow, with no retraining.
  • It isn't magic: RAG sharply reduces inventions (hallucinations), it doesn't eliminate them. Everything hinges on the quality of the search.

I design and operate this type of system daily, notably on beforbuild.com, my B2B SaaS in production. Here's what this acronym really covers, with no unexplained jargon.

How it works, step by step

Let's take a concrete through-line: you ask an assistant "what is the notice period in the Acme contract?". Here's what happens, on both sides of the curtain.

1. Indexing: chopping documents into passages

You never hand an 80-page PDF to an AI in one block. Upstream, each document is chopped into short, coherent passages: a clause, a section, a table. It's the work of a librarian who would turn each book into standalone cards, each understandable on its own, with the chapter title repeated at the top. In our example, the termination clause of the Acme contract becomes a card: "Acme contract · Article 12 · Termination: 3-month notice by registered letter."

2. Vectorization: turning meaning into coordinates

Each passage is then converted into an embedding: a long list of numbers that represents its meaning. The simplest analogy: GPS coordinates, but on a map of ideas. Two passages that talk about the same thing ("termination notice" and "deadline to end the contract") end up neighbors on that map, even if they don't use the same words. These coordinates are stored in a vector database, a database designed to answer quickly the question "which passages are close to this one?".

3. Retrieval: finding the right passages

When you ask your question, it's converted into coordinates the same way, and the system pulls up the closest passages on the map. It's the "R" in RAG, and it's the step that decides everything: if the search pulls up the confidentiality clause instead of the termination clause, the answer will be wrong, whatever the model. In practice, we combine this meaning-based search with a classic keyword search, so as not to miss an exact reference like "article 12."

4. Confined generation: writing while citing the source

The retrieved passages are handed to the language model with a strict instruction: answer only from these excerpts, cite the document and page, and say "I don't know" if the information isn't there. It's the student in an open-book exam: allowed to consult the binder, not to invent, and required to state the page. Result in our through-line: "The notice period is 3 months (Acme contract, article 12, page 14)." You verify in one click.

RAG, fine-tuning or ChatGPT: which to choose?

Three approaches come up as soon as you want an AI that knows your business. Let's compare them honestly, criterion by criterion.

  • Data freshness. Generic ChatGPT ignores your documents and stops at its training date. Fine-tuning (retraining a model on your content) freezes a snapshot: every update to your documents means starting over. RAG fetches the information on the fly: you replace a PDF, the answers follow right away.
  • Cost. ChatGPT as-is costs nothing extra, but doesn't answer on your business. Fine-tuning adds training and recurring retraining costs. RAG costs mostly to build, then a few dozen euros a month to operate.
  • Traceability. This is the decisive point in a company. ChatGPT and a fine-tuned model answer without being able to prove where the information comes from. RAG cites the document and the page of origin: the answer is verifiable.
  • Confidentiality. Pasting contract excerpts into a consumer ChatGPT means sending your data without a framework. A well-built RAG keeps your documents in a database you control, with a chosen hosting (European if needed) and per-user access.

The honest verdict: to answer on a documentary base that evolves, RAG almost always wins. Fine-tuning keeps an interest for adjusting the style of a model or for very repetitive tasks, rarely for "learning your documents."

The misconceptions

"RAG eliminates hallucinations"

No. It sharply reduces them and, above all, it makes them detectable: the answer cites its source, so an error is verified in one click. But no technique guarantees 0% invention. Most of a RAG's errors are in fact search failures (the wrong passages come up), not model whims. I detailed the guardrails that matter in RAG: how to keep the AI from inventing.

"You need a big model, hence a big budget"

Not so. A light model, well fed by a quality search and confined by a strict instruction, answers better than a big model poorly fed. In a RAG, the size of the model matters less than the quality of the chopping and the retrieval. That's good news for costs and for data sovereignty.

"It's reserved for large companies"

That was true in 2023, not anymore today. The technical building blocks have standardized, and an SMB with a few hundred documents is even the ideal case: a mastered corpus, recurring questions, a measurable return on investment. The entry ticket dropped most of all when you start from an already-built base instead of developing everything.

"It takes months to prepare your documents"

Not necessarily. RAG indexes PDFs, Word files, wiki exports as-is. It's better to start on a restricted and clean scope (your 50 up-to-date procedures) than to try to index everything, including the obsolete versions that will pollute the answers.

When RAG is NOT the right tool

Let's be frank, I turn down RAG projects when the need is elsewhere.

  • Very few documents. If all your knowledge fits in 20 pages, there's no point setting up a vector database: you give the 20 pages directly to the model with each question. Simpler, cheaper.
  • Highly structured data. "What is client X's revenue in Q2?" is a question for your database, not for a RAG. A SQL query (possibly generated by an AI) gives an exact answer where a RAG would give an approximate one.
  • A need for long reasoning. Comparing 40 contracts against each other, running a multi-step regulatory calculation: RAG retrieves passages, it doesn't conduct an in-depth analysis. These cases call for AI agents with orchestrated steps, another undertaking.

What it costs

On the French market in 2026, a custom-developed RAG assistant is most often billed between 10,000 and 70,000 € depending on scope: volume and formats of documents, channels (website, intranet, internal tools), access-rights management, hosting requirements. The low end corresponds to a serious prototype, the high end to a multi-team deployment with strong constraints.

My approach is different: the core of a RAG is identical from one project to the next, so I don't redevelop it each time. I start from the building block running in production on beforbuild.com and I bill only the adaptation to your documents and your channel: the base starts at 2 640 € excl. tax. The scope detail is on the RAG chatbot page, and two concrete use cases are described in RAG application on your documents and chatbot on your documents.

That leaves operations: vectorizing the documents costs little, the vector database can be nearly free if it relies on an existing database, and the model call depends on the volume of questions. For an SMB with normal usage, expect a few dozen euros a month, not thousands.

Sources

Related feature

Want this feature in your product?

See « Chatbot on your documents »

Frequently asked questions

Have a feature in mind? Let's talk.

30 minutes to scope your need and quote the fixed price. Reply within 24h.

Book my free audit · 30 min