AWS Builder Center
How to Test Your RAG App with 20 Questions: A Student’s Evaluation Checklist

How to Test Your RAG App with 20 Questions: A Student’s Evaluation Checklist

Most RAG apps are never tested, only demoed. Here is a simple way to measure retrieval quality with a small question set, including a short Python script and a per-language breakdown.

A RAG demo that answers three questions well proves very little. When I worked on NyayaGPT, a multilingual legal assistant over 34,000+ Indian legal records, the biggest lesson was that I could not improve what I did not measure. You do not need a big benchmark to start. Twenty good questions are enough.

Why demos fool you

You tend to test with questions you already know the answer to, phrased the way you would phrase them. Real users ask differently, in other words, and in other languages. A system can look great in a demo and still miss the right document half the time.

Test retrieval first

When a RAG answer is wrong, there are two possible causes:
  1. Retrieval failed: the right passage never reached the model.
  1. Generation failed: the passage was there, but the model misused it.
Check retrieval first. If the right passage is missing, no model can fix it. Retrieval is also cheaper and faster to test, because you do not need to call a language model at all.

The 20-question test loop

Step 1: Write 20 real questions

  • Use questions a real user would ask, not copies of your document text.
  • Mix easy and hard ones.
  • If you support several languages, write some in each language.
  • Include 2 or 3 questions your documents cannot answer. The system should say it does not know.

Step 2: Mark the right passage

For each question, record which document or chunk contains the answer. This is the slow step, and it is the most valuable one.

Step 3: Run your search

Run each question through your retrieval step and record which passages come back in the top 3.

Step 4: Score it

The simplest useful score is the hit rate: the share of questions where the correct passage appears in the top results.
def hit_rate(test_set, search, k=3):
results = {}
for item in test_set:
ids = [r["id"] for r in search(item["question"], k=k)]
results.setdefault(item["language"], []).append(
item["expected_id"] in ids
)
return {lang: sum(h) / len(h) for lang, h in results.items()}

test_set = [
{"question": "What is bail?", "expected_id": "doc_7", "language": "en"},
# add the rest of your 20 questions here
]

# search(question, k) must return a list like [{"id": "doc_7"}, ...]
print(hit_rate(test_set, search, k=3))
The result is a score for each language, for example  {'en': 0.9, 'ta': 0.6} . Those numbers are made up to show the format. Yours will differ.

Step 5: Read the failures

Do not just look at the score. Open each failed question and ask why:
  • Was the answer split across two chunks?
  • Did the question use different words from the document?
  • Did a keyword, such as a section number, fail to match?
  • Was the question in a language your embedding model handles poorly?
Each reason points to a fix: better chunking, hybrid search, or a different embedding model.

Per-language scores matter

An average hides weak spots. A system that scores well in English and poorly in Tamil can still show a respectable overall number. Always report scores separately for each language you support.

Rules that keep the test honest

  • Change one thing at a time, then rerun the same questions. Otherwise you cannot tell what helped.
  • Do not tune on your test questions only. Keep a few questions aside that you never look at while fixing problems.
  • Keep the test set. Rerun it after every change so you catch regressions.
  • Test "I don't know" cases. A good system refuses when the documents do not contain the answer.

Common mistakes

  1. Testing only the generated answer and never the retrieved passages
  1. Using questions copied word for word from the documents
  1. Reporting one average across all languages
  1. Changing three things, then guessing which one worked
  1. Never rerunning the tests after a change

Takeaways

  • Test retrieval before blaming the model.
  • Twenty real questions beat a polished demo.
  • Score each language separately.
  • Read the failures, because they tell you what to fix next.
How do you evaluate your RAG apps? I would love to hear your approach in the comments.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article