sasitha.dev
Download CV
← All projectsProject 05 / 07
Client · Generative AI

RAG evaluation framework

An evaluation harness for the retrieval layer of an enterprise AI knowledge assistant. A golden set of real questions with known answers is scored for context precision and context recall, and the scores decide what to improve next. It is growing into nightly, domain-specific runs with alarms when quality drops.

Role
Co-architect & developer
Type
Internal platform
Timeline
2026 — present
Stack
RAGAS · Python · Amazon Bedrock Knowledge Bases · Amazon CloudWatch

The problem

The enterprise AI knowledge assistant answers questions from Confluence and about 80 code repositories. Every change (how documents are chunked, how repositories are summarised, adding a reranker) could make answers better or worse, and without a measure, the only evidence was whether a few answers looked right.

We needed a repeatable score for the retrieval layer that could tell us whether a change helped, and where to look when it didn’t.

The approach

A golden dataset of 50 real questions, each with a reference answer, is run against the knowledge base. RAGAS scores the retrieved passages on two metrics:

Low precision means noise, so we tune ranking and result counts. Low recall means missing evidence, so we look at chunking, query handling and gaps in the content. The latest run showed precision around 0.80 and recall around 0.56: what we retrieve is mostly relevant, but we often miss passages a full answer needs. That made recall the clear next priority.

The harness also measured the reranking step. Because the managed reranker is not available in the region the data must stay in, we added an LLM-based reranker and used the evaluation to judge whether it was worth its cost.

What comes next

What I learned

Key decisions

Decision

Score retrieval on its own

The knowledge assistant only retrieves, and the client model writes the answer. Scoring the retrieved passages, not the final answer, isolates the part we own, so a chunking problem is not mistaken for a prompt problem.

Trade-off: It says nothing about how well the client model uses the passages. Answer quality still needs a separate check.
Decision

Real questions with known answers

The golden set is built from real questions people asked, each with a reference answer, rather than synthetic questions generated from the documents.

Trade-off: Writing reference answers takes time from people who know the domain, so the set grows slowly.
Decision

An LLM as the judge

RAGAS uses an LLM to decide whether each retrieved passage is relevant and whether each fact in the reference answer is covered, which scales far beyond manual review.

Trade-off: The judge can be wrong, so its verdicts need spot checks against human judgement, and every run costs tokens.
Decision

An append-only run history

Every run is appended to a history file, so scores can be compared over time and a change can be checked against the previous baseline.

Trade-off: A score without the configuration behind it is hard to explain later. Each run now needs to record what was switched on, such as the reranker.

Outcomes

50Real questions in the first golden set
~0.80Context precision on the latest run
~0.56Context recall: the next thing to improve
2Metrics that isolate the retriever
Related writingEvaluating RAG with context precision, recall and an LLM judgeRead →Next project →Multi-tenant utility billing platform