UNECA StatsChat/RAG course — Week 9
We have spent the course opening up the “black box” of a RAG system.
Today we ask: how do we know whether the whole system is working?
Evaluation is the feedback loop for the whole course.
The environment that AI operates in - data, users, workflows, and context - is much more important than the model itself.
What is the main purpose of evaluation in a RAG system?
A. To prove the system will never make mistakes
B. To measure and diagnose how well the system works
C. To replace human judgement
D. To make the model answer faster
Best answer: B. Evaluation measures performance and helps us diagnose what to improve.
Why use automated evaluation (opposed to manual evaluation) in a RAG system?
Evaluation is the feedback loop that lets us improve a RAG system safely.
“This answer looks good.”
“Across a tested set of questions, we know where the system works, where it fails, and what to improve next.”
Explain the automated evaluation loop.
Distinguish answer, guardrail, and retrieval metrics.
Explain why answerable and unanswerable rows matter.
Read headline results without overclaiming.
Create evaluation questions for your own NSO context.
Connect evaluation evidence to adoption choices.
We can start with the live system, not the metrics.
What was Kenya’s real GDP growth rate in 2024?
Then ask: what would we score as success?
A UI interaction becomes a repeatable test.
query_text
golden_answer
should_answer
relevant_doc_ids
evidence_pages / source_text
diagnosis / issue type
Evaluation turns examples into repeatable tests.
Not just the LLM.
A final answer can fail because of any stage in the chain.
The goal is pragmatic coverage of the important moving parts.
StatsChat returns the right document, but the generated answer uses the wrong number. Where is the main issue likely to be?
A. Ingestion
B. Retrieval
C. Generation / answer synthesis
D. User interface colour scheme
Best answer: C. Retrieval found useful evidence, but generation used it badly.
Evaluation is useful because it is repeatable.
There is no single source of good evaluation questions.
Questions people already ask.
Questions statisticians know are important.
Useful, but human-reviewed.
Regression tests after fixes.
Questions that revealed confusion.
Start from facts/tables and write questions.
Start with evidence, then write the question.
This helps ensure the question is auditable.
Useful for early development and regression checks.
Needed before relying heavily on headline scores.
Quality and range matter more than raw quantity alone.
A good evaluation row needs more than a question.
What the user asks
Expected answer, if answerable
Answer or refuse?
What publication should support it?
Where should support appear?
What behaviour is being tested?
A benchmark is also a statistical product: if the rows are weak, the metrics are weak.
Remove ambiguity.
Check against source.
Document, page, quote/span.
Clear should-answer decision.
Reports, dates, metrics, refusal cases.
Revise or remove weak rows.
Design questions that expose different failure points.
Tables, footnotes, awkward PDFs.
Answer split across boundaries.
Similar terms, old editions, related-but-wrong documents.
Multiple nearby numbers or comparison figures.
Future, policy, opinion, out-of-corpus questions.
Cited page must support exact claim.
“What was Kenya’s real GDP growth rate in 2024?”
Expected behaviour: answer from retrieved evidence.
“What will Kenya’s GDP growth rate be in 2027?”
Expected behaviour: refuse or explain evidence is insufficient.
A system that answers everything is not necessarily better.
The benchmark tests both whether StatsChat answers questions it should answer and whether it refuses questions it should not answer.
Strong result — but not a permanent certificate.
initial full benchmark
small set looked strong
new weaknesses exposed
performance recovered
Benchmark expansion exposed weaknesses that the smaller set had missed.
The smaller benchmark looked strong, but the expanded benchmark initially performed worse. What is the best interpretation?
A. The system became worse overnight
B. The expanded benchmark exposed more realistic variety
C. Evaluation is pointless
D. The answer generator was removed
Best answer: B. A better benchmark can reveal hidden weaknesses.
When the system should answer, does it give the expected answer?
answerable accuracynumeric match
When the system should not answer, does it refuse?
unanswerable accuracyfalse answer rate
Did the system retrieve the right evidence?
Doc Hit@kpage hit
Which should be included in a good StatsChat evaluation set?
A. Only easy factual questions
B. Only questions from one report family
C. Questions the system should refuse
D. Only questions with short numeric answers
Best answer: C. Refusal behaviour is part of system quality.
System working.
Prompt/model/synthesis issue.
Dangerous: may be unsupported.
Need better page-level grounding.
Document retrieval is strong, but evidence-page grounding still needs improvement.
Wrong edition or policy source.
Correct document, but no answer.
Correct number, but unit/currency wording affected scoring.
No unanswerable rows failed in the best run.
The system retrieves the right report and the predicted answer contains the right number, but the evaluator marks it wrong because the answer omitted “KSh” and “million”. What is this mainly?
A. Pure retrieval failure
B. Evaluator or answer-formatting edge case
C. Out-of-scope guardrail failure
D. PDF ingestion failure
Best answer: B. The answer is close, but scoring needs to handle unit/currency wording carefully.
Both runs used the same retrieval pipeline and had the same Pipeline Doc Hit@8: 56/61. Same retrieval, different answer synthesis.
The benchmark is a decision aid, not a guarantee.
The process is not just “calculate a score”.
Several hundred audited rows across report families.
Policy, future, causal, cross-country, out-of-corpus.
A set not used while tuning.
Measure LLM variability.
Page and span-level grounding.
Turn real issues into benchmark rows.
Evaluation should match the intended use.
PDF, Excel, HTML, APIs.
Terminology, translations, multilingual users.
Monthly, quarterly, annual, revisions.
Analysts, managers, public users.
Public, internal, confidential.
Internal search vs public answer service.
A small first benchmark might include:
The set should reflect the organisation’s real documents and users.
For your own NSO context, draft these three types of questions. For each, note the expected answer/source, whether the system should answer, and what failure would worry you most.
A straightforward answer from a known source.
Latest edition, revision, or period matters.
The system should refuse or answer carefully.
You do not need to finish this before Thursday.
The Thursday session is an evaluation design / mini-project clinic.
Who would use the system?
What should the system answer or refuse?
Which publications or data sources matter?
We will refine ideas into a practical adaptation/evaluation plan.
A practical next-step roadmap:
At the start, StatsChat may have looked like one AI tool.
Now you can ask:
What documents went in?
How were they converted and chunked?
What evidence was selected?
How did the LLM use the evidence?
Can the user check the answer?
How do we test whether it is safe?
Whether you adapt StatsChat or simply use AI systems more critically, you now have a practical framework:
Use it to ask better questions of any AI system that claims to answer from evidence.
Evaluation closes the loop.
It turns a prototype into a system we can improve, compare, maintain, and make decisions about.
A useful RAG system is not just built once. It is tested, diagnosed, improved, monitored, and adapted to real users.