Retrieval-augmented generation: architecture that holds up in production
A working retrieval pipeline is straightforward. Making it reliable enough to trust with business questions is where the engineering is.
Without an evaluation set, every change to a language model system is argued on anecdote. Building one is the highest-value early task.
A few hundred questions with verified answers, drawn from real user queries where possible, is enough to start. It must cover four categories deliberately.
Answerable questions the corpus supports. Unanswerable ones where the correct behaviour is to decline — usually missing and the most important. Ambiguous ones where the system should ask. Adversarial ones with near-miss retrievals and superseded documents.
Using a language model to grade outputs scales where human review cannot. It is useful and it is not ground truth: graders have biases, favour verbose answers and can be inconsistent.
Calibrate the grader against human judgements on a sample, and re-check periodically. Treat model grading as a screening tool with human review on a rotating subset.
Wire evaluation into the pipeline so prompt edits, model version changes, chunking changes and threshold adjustments are all measured. Without this, improvements and regressions are indistinguishable.
Track cost per query alongside quality. An accuracy gain that triples inference cost is a trade-off someone should make deliberately rather than discover on an invoice.
The evaluation set should grow from real failures. When a user reports a wrong answer, add that question with the correct answer to the set before fixing anything.
This does two things: it prevents the same regression recurring, and it steadily makes the set representative of what users actually ask rather than what the team imagined.
Review the additions periodically to keep the set balanced. A set dominated by one failure mode will over-optimise for it, which is its own kind of drift.
A few hundred well-chosen items is enough to detect meaningful regressions. Breadth of scenario matters more than raw count.
They are useful for comparing base models and tell you little about your corpus and your users' questions. Your own set is what matters for your system.
Whenever production surfaces a failure the set did not catch. Adding those cases is how the set stays representative.
Keep reading
A working retrieval pipeline is straightforward. Making it reliable enough to trust with business questions is where the engineering is.
Connecting a language model to your documents is the straightforward part. The reliability work is everything after that, and it looks nothing like the demonstration.
Governance is largely about being able to explain what a system does, on what data, with what oversight, and to evidence it.