SourceBacked
Learn

What RAG actually is

June 16, 20265 min read

A language model can't answer questions about your lease, because it was never trained on your lease. It has never seen it. Retrieval-augmented generation, RAG, is the fix for that: instead of asking the model to recall something it doesn't know, you hand it the relevant part of the document at the moment you ask the question, and let it read that instead of guessing from memory.

The problem it solves

Language models are trained once, on a fixed dataset, up to a cutoff date. Anything created after that, or anything private, like a contract you uploaded five minutes ago, simply isn't in there. Without RAG, a model asked about your lease has two options: say it doesn't know, or generate something plausible-sounding based on what leases usually say. The second option is the one that produces confident, wrong answers, and it's the whole reason source-grounded tools exist.

How it actually works

A RAG system does four things, in order, every time you ask a question:

  1. Break the document into chunks.A 40-page lease isn't handed to the model whole. It's split into smaller pieces, page by page or section by section, each one small enough to search individually.
  2. Turn each chunk into a vector. An embedding model converts each chunk of text into a list of numbers that represents its meaning, so that chunks about similar topics end up mathematically close to each other, regardless of the exact words used.
  3. Retrieve the relevant chunks for a question. Your question gets turned into a vector the same way, and the system finds the chunks whose vectors are closest to it, plus, in a good implementation, chunks that share exact keywords, since meaning-based search alone can miss an exact term like a case number or a defined term.
  4. Generate an answer from only those chunks.The model gets the original question plus the retrieved chunks, and is instructed to answer using only what's in front of it. Nothing else it “knows” from training is supposed to enter the answer.

Why the citation matters more than the retrieval

Retrieval alone doesn't make an answer trustworthy, it just makes it more likely to be grounded. The step that actually lets you verify anything is telling you which chunk the answer came from, specifically enough that you can go check it. A system that retrieves well but doesn't cite its source is asking you to trust it anyway, which defeats most of the point.

How SourceBacked does this

Every document you upload gets split into chunks with page and section references preserved, embedded, and indexed for both meaning-based and keyword search. When you ask a question, the system retrieves from just the documents in your workspace, generates an answer using only what it retrieved, and returns the answer with a citation to the exact chunk it used, which you can click to see for yourself. That last step, the part that lets you verify it, is what we built the whole product around.