UNECA StatsChat / RAG course — Week 8
2026-06-02
Last week:
Retrieval is evidence selection.
This week:
Generation is evidence use.
The question is now:
What answer can we safely produce from the retrieved chunks?
Best answer: B. Retrieval selected the evidence; generation uses it.
By the end of today, you should be able to:
Retrieval decides what the LLM gets to see.
Generation decides what can be said from what the LLM sees.
Best answer: B. Generation depends strongly on the context it receives.
Question:
What was Kenya’s real GDP growth rate in 2024?
Before we inspect the answer:
What would make this a good answer?
User sees:
System does more:
The LLM does not see every KNBS document.
It sees something like:
A good generation step asks:
StatsChat uses retrieval scores to help decide whether to answer.
Important:
Zone B is useful because weak evidence may still help a human user.
Best answer: C. This lets the user inspect possible evidence without overclaiming.
A prompt defines the model’s task and boundaries.
For RAG, it should say:
The StatsChat prompt tells the model to:
For statistical questions, the prompt also says:
Example risk:
“3.5% in February 2025, compared with 6.3% in February 2024”
Multiple choice
Question: “What was inflation in February 2025?”
Context: “Inflation was 3.5% in February 2025, compared with 6.3% in February 2024.”
Which figure should the model choose?
A. 6.3%
B. The largest number
C. 3.5%
D. Both numbers as the answer
Best answer: C. The metric and period directly match the question.
| Ordinary chatbot answer | Grounded RAG answer |
|---|---|
| May use general model knowledge | Should use retrieved evidence |
| May not show sources | Should return references |
| May answer when unsure | Should refuse or hedge |
| Can sound right but be unsupported | Should be checkable |
Instead of just asking for a paragraph, an application may ask for fields:
StatsChat can ask the model for exact supporting phrases.
Then the system searches for those phrases in the retrieved chunks.
This helps the user move from:
“The AI said this.”
To:
“This passage supports the answer.”
Answer
Kenya’s real GDP grew by 4.7 per cent in 2024.
Supporting phrase
“real Gross Domestic Product (GDP) grew by 4.7 per cent”
UI effect
Multiple choice
A highlight says “GDP grew by 4.7 per cent”, but the answer says “services grew by 4.7 per cent”. What is the issue?
A. The highlight proves the answer is correct
B. The answer may use the right number for the wrong measure
C. There is no issue
D. The system has found no documents
Best answer: B. The evidence must support the exact claim, not just the number.
Examples:
A cautious refusal can be safer than a confident unsupported answer.
Multiple choice
Which question should StatsChat probably refuse unless the retrieved KNBS context directly supports it?
A. “What was Kenya’s real GDP growth rate in 2024?”
B. “What was the CPI inflation rate in February 2025?”
C. “Should Kenya change interest rates next month?”
D. “Which publication reports GDP growth in 2024?”
Best answer: C. That asks for policy advice/forecasting, not just evidence extraction.
Evidence
“Real GDP grew by 4.7 per cent in 2024.”
Generated answer
“GDP grew by 4.7%, mainly because of new government policy.”
Problem
The growth figure is supported, but the cause is not.
Question
“What was inflation in February 2025?”
Evidence
“Inflation was 3.5% in February 2025, compared with 6.3% in February 2024.”
Generated answer
“Inflation was 6.3% in February 2025.”
Problem: the model selected the comparison figure.
Generated answer
“It was 4.7%.”
Better answer
“Kenya’s real GDP grew by 4.7% in 2024.”
Problem
The weak answer gives a number but not the country, measure, or period.
Question
“What will Kenya’s GDP growth be in 2027?”
Retrieved context
A 2024 report with historical figures only.
Generated answer
“GDP growth will be 4.7%.”
Problem: the system should not answer a future question from historical evidence.
Generated answer
“Real GDP grew by 4.7% in 2024.”
Reference/highlight shown
“The Economic Survey includes national accounts statistics.”
Problem
The reference is related to GDP, but it does not support the exact figure.
Multiple choice
Answer: “Inflation was 6.3% in February 2025.”
Evidence: “Inflation was 3.5% in February 2025, compared with 6.3% in February 2024.”
What is the main failure?
A. Unsupported causal claim
B. Wrong figure
C. Poor UI colour choice
D. Hosting problem
Best answer: B. The model selected the comparison figure.
StatsChat is one example of a wider pattern:
The LLM is a component inside a system.
| App type | What the LLM does |
|---|---|
| Customer support | Drafts replies from help articles and case history |
| Coding assistant | Explains code, proposes edits, runs tests via tools |
| Data assistant | Writes code, creates charts, summarises outputs |
| Document extraction | Converts PDFs/forms into structured fields |
| Workflow assistant | Uses APIs such as email, calendar, or tickets |
Many LLM apps add:
This is a general chatbot-style call.
Now the output is easier for an application to parse.
The clearer teaching language is:
| Hosting option | Meaning |
|---|---|
| External-hosted LLM | Model hosted by an external provider, e.g. OpenAI, Google, Anthropic, Mistral |
| Self-hosted LLM | KNBS hosts the model on its own machines or rented servers |
The generation pattern is the same either way.
| Option | Advantages | Trade-offs |
|---|---|---|
| External-hosted | Fast, easier to operate, no GPU needed | Data sent to provider, token costs, provider dependency |
| Self-hosted | More control, data can stay in chosen infrastructure | Hardware, maintenance, slower/complex deployment |
A modular system can change hosting option later.
Some LLM systems can:
StatsChat is not an agent, but it is also not “just a chatbot”.
Examples such as OpenClaw and Hermes Agent show a broader pattern:
For StatsChat, the link is conceptual:
The application around the model matters as much as the model.
Multiple choice
Which are good candidates for an NSO LLM system?
A. Drafting a summary with citations for human review
B. Automatically publishing statistics without review
C. Suggesting relevant publications for a user question
D. Changing official figures based on model output
Strong candidates: A and C. B and D would need very strong controls and are usually inappropriate.
Return to the UI answer from the start.
Discuss:
Before the lab, complete a short answer-inspection task.
In this exercise, you will inspect a StatsChat-style answer and decide how trustworthy it is.
You do not need to use the StatsChat interface. Use the example provided on the course site.
Next week we bring the pipeline together: