Writing

Evaluate your RAG system before your customers do

Retrieval-augmented generation demos well and fails quietly. How to build a small test set from your own documents, what to measure, and the failures to look for before launch.

Retrieval-augmented generation (RAG) is the usual way to make a language model answer from your own documents: find the relevant passages, give them to the model, ask it to answer from them. It demos well. Then customers ask questions nobody tried, and it answers confidently and wrongly.

The fix is not a better model. It is a test set, built before launch and rerun on every change.

Build the test set from real questions

  • Collect real questions: support tickets, sales emails, search logs. Not questions the team invents.
  • For each, write the correct answer and mark which document and passage it comes from.
  • Include questions the documents cannot answer. The right answer is “I don’t know”.
  • Start small. A few dozen well-chosen questions find most problems.

Measure the two halves separately

A RAG system can fail in two places, and you need to know which.

  • Retrieval: did it find the right passage? Check whether the passage you marked is among the ones retrieved.
  • Answering: given the right passage, did the model answer correctly and only from it?

If retrieval is wrong, a better prompt will not help. If retrieval is right and the answer is wrong, a better index will not help.

The failures to look for

  • Confident answers to unanswerable questions. The most damaging failure, and the most common.
  • Stale documents. An old policy retrieved instead of the current one.
  • Answers stitched from two passages that do not belong together.
  • Numbers and dates copied wrongly from the passage.
  • Ignoring the question’s scope: answering for one product when the customer asked about another.

Keep a person in the loop where it matters

For anything with a cost if wrong (refunds, medical, legal, pricing), route low-confidence answers to a person, and log what they change. Those corrections become new test cases.

Rerun on every change

New documents, a new model, a new prompt, a new chunk size: rerun the test set and compare. A change that improves the average and breaks three important questions is not an improvement.

This is how we build and test language-model systems for clients, and the same discipline as our annotation and evaluation work.

Follow new articles by RSS or email.

Putting a model in front of customers?

We test whether a model does your task well, then tune or prompt it until it does, with a test set you can rerun.

Fine-tuning and evaluation

Tell us what you need.

In a 20-minute call we tell you which of our services fits, what the first step costs and how long it takes, or that we are not the right team.

Book a 20-minute call

Not ready to talk? See a sample audit readout or an annotation quality sample.