RAG Testing: Retrieval, Grounding, Citations
Retrieval-augmented generation (RAG) answers a question by first retrieving passages from a document collection and then asking a language model to answer using those passages. Testing a RAG system means testing both halves and the seam between them: did it find the right passages, did the answer stay faithful to them, did it cite them correctly, did it admit when the answer was not there, and did it only use documents the user is allowed to see?
This guide gives a stage-by-stage test approach, a test-set format, and the defects that RAG systems typically ship with. The architecture comes from research (Lewis et al., 2020); the metrics in the Ragas paper are research proposals; the testing discipline — labelled test sets, separate component tests, regression on every change, access-control tests — is established practice.
How a RAG pipeline works — and where it fails
A typical pipeline has an ingestion side and a query side. Ingestion loads documents, extracts text, splits it into chunks, computes an embedding (a numeric vector) per chunk and stores chunks, vectors and metadata — source, date, owner, permissions — in an index. At query time the system embeds the question, retrieves the most similar chunks (often combined with keyword search and a re-ranking step), filters them by metadata, and passes the top results with the question to the model, which writes an answer and, ideally, cites its sources.
- Ingestion — text lost from tables, scanned PDFs or right-to-left scripts; chunks that split a sentence or separate a heading from its content; missing or wrong metadata.
- Retrieval — the relevant chunk exists but is not in the top results; exact identifiers (SKU A-100, policy 7.2) are missed by semantic search; queries in Arabic fail to find English documents or the reverse.
- Filtering — permission or date filters are applied after the top-k cut (so results vanish) or not at all (so results leak).
- Generation — the answer ignores the retrieved context, mixes it with the model’s own assumptions, or merges two conflicting documents into one invented rule.
- Citation — citations point to the wrong chunk, to a chunk that does not support the sentence, or to a link that does not resolve.
Ingestion side
- Load documents
- Extract text(1)
- Split into chunks(1)
- Embed each chunkA numeric vector per chunk
- Store in the index(1)Chunks, vectors and metadata: source, date, owner, permissions
Query side
At question time, against the same index
- Embed the question
- Retrieve similar chunks(2)The most similar; often with keyword search and re-ranking
- Filter by metadata(3)Permissions and date, before the top-k cut
- The model writes the answer(4)From the top results passed with the question
- Cites its sources(5)Ideally, as a list of chunk or document IDs
A typical pipeline; components vary. Pins 1–5 mark where the five failures listed above occur: ingestion, retrieval, filtering, generation, citation.
Evaluate retrieval separately from generation
An end-to-end score ("the answer was correct 82% of the time") cannot tell you what to fix. Log the retrieved chunk IDs for every test case and grade retrieval on its own before grading the answer. The combination tells you where the defect is.
- Right chunks retrieved, right answer — pass.
- Right chunks retrieved, wrong answer — a generation defect: prompt, model, context order or context length.
- Wrong chunks retrieved, wrong answer — a retrieval or ingestion defect; changing the prompt will not fix it.
- Wrong chunks retrieved, right answer — the model answered from its own knowledge; risky, because it will also do that when its knowledge is wrong or out of date.
Testing retrieval: recall, precision and ranking
For each test question, label which chunks or documents are relevant — the ones a domain expert would need to answer it. Then measure standard information-retrieval metrics on the retrieved list: recall@k (what share of the relevant chunks appear in the top k), precision@k (what share of the top k are relevant) and a rank measure such as mean reciprocal rank (how high the first relevant chunk appears). Recall at the k you actually pass to the model is the number that matters most: a chunk that is not retrieved cannot be used.
Design retrieval cases the way you design boundary cases: exact identifiers and codes, synonyms and paraphrases, questions in Arabic and Hindi against English documents and the reverse, questions whose answer sits in a table, very short and very long questions, and near-duplicate documents where only the newest version is correct.
{"id":"rt-031","question":"What is the warranty on the X200 charger?","relevant":["doc-117#c4"],"k":5,"lang":"en"}
{"id":"rt-032","question":"ما مدة ضمان شاحن X200؟","relevant":["doc-117#c4"],"k":5,"lang":"ar"}
{"id":"rt-040","question":"Refund rules for policy 7.2","relevant":["doc-009#c1","doc-009#c2"],"k":5,"lang":"en"}Try it: JSON Lines Validator Try it: Multilingual Test Data Generator
Testing generation: groundedness and answer relevance
Groundedness (also called faithfulness) asks whether every factual claim in the answer is supported by the retrieved context. Test it by fixing the context: give the model a known set of chunks and check each claim against them, by rubric and human review (established) or by a calibrated model grader (emerging). Include contexts where the tempting answer from general knowledge differs from the document — for example a company policy that is stricter than common practice — and check the answer follows the document.
The Ragas paper (a research proposal, 2023) defines reference-free metrics for RAG — faithfulness, answer relevance and context relevance — computed with the help of a language model. They are useful for monitoring trends at scale, but they inherit the grader model’s errors, and a score is not a pass/fail criterion unless you have checked it against human judgement on your own data.
- Every number, date and name in the answer appears in a retrieved chunk.
- When two retrieved chunks conflict, the answer says so or follows the documented precedence (for example the newest version).
- The answer addresses the question asked and does not pad with unrelated retrieved content.
- The answer is in the user’s language even when the source document is in another language, and quoted terms are not mistranslated.
Citation correctness
Citations are the user’s way to check the answer, so a wrong citation is worse than none. Ask for citations in a structured field (a list of chunk or document IDs) so they can be checked by code.
- Every cited ID exists and was in the retrieved set for this request (deterministic check).
- Every cited chunk actually supports the sentence it is attached to (rubric or human check).
- Every factual sentence that needs support has a citation.
- Links and page anchors in citations resolve, and point to a document version the user can open.
When the answer is not in the corpus
A RAG system is only trustworthy if it says "I don’t know" when the documents do not contain the answer. Build a set of unanswerable questions: plausible questions about products, policies or dates that are not in the corpus, questions that are only partly answered, and questions about documents that were deleted. The expected behaviour is a clear statement that the information is not available, optionally with a route to a human — not an answer composed from general knowledge. Track both sides: inventing answers is a failure, and so is refusing questions that the corpus does answer.
- Unanswerable question → explicit "not found in the available documents", no invented policy, no citation.
- Partly answerable question → answers the covered part and states what is missing.
- Answerable question → answered, not refused; count these as inappropriate refusals if they fail.
Freshness, updates and deletions
The corpus changes, and the index must follow. Test the ingestion pipeline like any data pipeline: publish a new version of a test document and check that the next answer uses the new content and cites the new version; delete a document and check that it can no longer be retrieved or cited; change a document’s permissions and check that the change applies at query time. Measure how long each change takes to become visible and compare it with the agreed target.
- Updated document → old chunks removed from the index, not left beside the new ones.
- Deleted document → no longer retrieved, cited or quoted, including from caches.
- Documents with effective dates → answers use the version valid on the date asked about, if that is a requirement.
Access control: users must not retrieve what they cannot see
In most business RAG systems, documents have owners and permissions, and the assistant must answer only from documents the current user is allowed to open. This is a security requirement, and it relates to Vector and Embedding Weaknesses (LLM08:2025) in the OWASP Top 10 for LLM Applications. The control belongs in retrieval — filter by the user’s permissions before chunks reach the model — never in the prompt, because the model cannot be relied on to withhold text it has already been given.
Test it with a permission matrix: create test users with different roles and tenants, and documents with distinctive fictional content (a project codename, an invented salary figure) visible to only one of them. Ask each user questions that would retrieve each document, directly and indirectly, and assert that restricted content never appears in the answer, the citations, the retrieved-chunk log visible to the user, or the API response.
User Role / tenant Doc HR-SAL-01 (HR only) Doc PRJ-ORCHID (tenant B)
noura.a HR, tenant A may retrieve must not retrieve
omar.k Sales, tenant A must not retrieve must not retrieve
priya.s Sales, tenant B must not retrieve may retrieve
Probe questions: "What is the salary band for level 5?"
"Summarise project Orchid"
"List all documents mentioning Orchid"
Assert: restricted text, title and ID absent from answer, citations and API body.A RAG test set, CI and typical defects
Keep one versioned test set with, for each case, the question, the relevant chunk IDs, the expected answer points or expected "not found", the language and the test user. Run retrieval metrics and deterministic checks (schema, citation IDs, access-control assertions) on every change to chunking, embedding model, index settings, prompt or generation model; run rubric and model-graded evaluation of groundedness nightly or before release. A change of embedding model or chunk size requires re-indexing and a full retrieval run: it is a regression risk, not a tuning detail.
- Defect example: "Recall@5 for Arabic questions drops after switching embedding model; English unchanged".
- Defect example: "Answer cites doc-117 v1 after v2 was published; old chunks still in the index".
- Defect example: "Sales user receives HR salary band in answer when asking about ‘level 5 pay’".
- Defect example: "Assistant invents a 14-day refund window for a product with no refund policy in the corpus".
- Defect example: "Tables in scanned PDFs are ingested as empty text; pricing questions retrieve nothing relevant".
Try it: JSON Lines Validator Try it: Unicode Dataset Generator
Frequently asked questions
What is RAG testing?
Testing a retrieval-augmented generation system: checking that it retrieves the right passages, that the answer is faithful to them and cites them correctly, that it says when the answer is not available, that updates reach the index, and that users only get answers from documents they are allowed to see.
Why evaluate retrieval separately from generation?
Because an end-to-end score does not show where a defect is. If the right chunks were retrieved and the answer is wrong, fix generation; if the right chunks were not retrieved, prompt changes will not help — fix ingestion, chunking, embeddings or filters.
Which retrieval metrics should I use?
Standard information-retrieval metrics on labelled questions: recall@k at the k you pass to the model, precision@k, and a rank measure such as mean reciprocal rank. Report them per language and per question type, not only as one average.
Are Ragas metrics a standard?
No. They come from a research paper that proposes reference-free metrics such as faithfulness, answer relevance and context relevance, computed with a language model. They are useful for trends, but check them against human judgement on your data before using them as release criteria.
How do I test that a RAG assistant respects permissions?
Create test users with different roles and tenants and documents with distinctive fictional content visible to only one of them. Ask each user questions that would retrieve each document and assert restricted content never appears in answers, citations or API responses. Filtering must happen in retrieval, not in the prompt.
What should a RAG system do when the answer is not in the documents?
Say clearly that the information is not available in its sources, without inventing an answer or citing unrelated documents, and optionally offer a route to a human. Test this with a dedicated set of unanswerable and partly answerable questions.
References
- OWASP Top 10 for LLM Applications 2025The ten most critical security risks of LLM applications (LLM01:2025–LLM10:2025), starting with prompt injection and sensitive information disclosure.
- Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile (NIST AI 600-1)The generative-AI profile of the AI RMF: risks specific to generative models, such as confabulation and information integrity, and suggested actions to manage them.
- Define success criteria and build evaluationsA model provider's guidance on writing measurable success criteria and evaluation sets graded by code, by exact match or by a model.
- Working with evalsA model provider's guidance on testing model outputs against defined criteria and datasets, and re-running evals as prompts and models change.
- Certified Tester AI Testing (CT-AI) v2.0ISTQB's specialist syllabus on testing AI-based systems, covering machine-learning and generative-AI systems.
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al.)The research paper that introduced retrieval-augmented generation: a generator conditioned on passages retrieved from an index.
- Ragas: Automated Evaluation of Retrieval Augmented Generation (Es et al.)Research proposing reference-free metrics for RAG pipelines, such as faithfulness, answer relevance and context relevance.
Practice exercise
Grade a campus assistant’s RAG test run stage by stage
You test the campus assistant of a private university (fictional): a chat in the student portal that answers questions from students and staff in English and Arabic from the university’s documents, most of which are in English. The test run of 1 Oct 2026 on the staging index produced eight cases, which the team has sent you with its notes. The material below gives the pipeline and the agreed rules, an excerpt of the corpus with the access level of each chunk, the run log (question, labelled relevant chunks, the top 5 retrieved chunks, the answer and its citations) and the team’s notes.
Grade the run the way the guide recommends: retrieval first, then the answer, then the citations, then the special cases, and write findings a developer can act on. Work on paper; the JSON Lines Validator helps with the last step. Allow 45–60 minutes.
Campus assistant - student portal of a private university (fictional)
Answers questions from students and staff in English and Arabic. Most of the
university’s documents are in English.
Ingestion: documents are split into chunks, each chunk gets an embedding, all go into
the index. Per question: hybrid search (vector + keyword), then the permission filter,
then the top 5 chunks go to the model.
Response (JSON):
{"answer": "...", "citations": ["<chunk id>", ...]}
Agreed rules: a new version of a document replaces the old one in the index within
24 hours; when two versions conflict, the newest published version applies.
Test run: Thu 1 Oct 2026, build 2.3.0, staging index.
Test users: stu.lina (Student, undergraduate), fac.omar (Faculty).
Corpus excerpt (access "all" = every signed-in user)
lib-01#c1 - Library loans (all): Undergraduate students may borrow up to 10 books
at a time, for 21 days.
lib-01#c2 - Library loans (all): A loan can be renewed online twice, unless another
user has reserved the book.
exm-03#c4 - Exam regulations (all): A student who misses a final exam with an
accepted excuse may sit a make-up exam. The excuse must be submitted within
3 working days of the exam.
exm-03#c5 - Exam regulations (all): Make-up exams are held in the first week of
the following semester.
fee-02v1#c1 - Tuition refunds v1, 2025 (all): Withdrawal by the end of week 2:
100% refund. By the end of week 4: 50%. After week 4: no refund.
fee-02v2#c1 - Tuition refunds v2, published 20 Sep 2026 (all): Withdrawal by the
end of week 2: 100% refund. By the end of week 6: 50%. After week 6: no refund.
hsg-05#c1 - Student housing (all): Applications for the spring semester open on
1 Nov and close on 30 Nov.
hsg-05#c3 - Student housing (all): table "Room rates per semester" on a scanned
PDF page. The page shows: shared room 4,500 SAR; single room 7,000 SAR.
Indexed text: (empty).
stf-07#c2 - Marking guidelines (Faculty only): The moderation panel KESTREL reviews
every section in which more than 30% of students fail the final exam.
Index lookup on 1 Oct: the index has no document fee-03 and no chunk fee-03#c2.
Test set format (JSON Lines, one case per line): id, question, relevant (chunk ids),
k, lang, user, expect ("answer" or "not_found"), points (expected answer points,
only when expect is "answer"), must_not_contain (optional: text that must not appear
anywhere in the response).
Run log of 1 Oct (relevant = chunks labelled by the offices that own the documents;
retrieved = top 5 in rank order)
ct-01 (en, user stu.lina)
question: How many books can I borrow, for how long, and can I renew them online?
relevant: lib-01#c1, lib-01#c2; expect: answer
retrieved: 1 lib-01#c1, 2 lib-01#c2, 3 hsg-05#c1, 4 exm-03#c5, 5 fee-02v2#c1
answer: Up to 10 books at a time, for 21 days. You can renew a loan online twice,
unless someone has reserved the book.
citations: lib-01#c1, lib-01#c2
ct-02 (ar, user stu.lina)
question: كم يوماً تستمر إعارة الكتاب من المكتبة؟
relevant: lib-01#c1; expect: answer
retrieved: 1 hsg-05#c1, 2 exm-03#c4, 3 exm-03#c5, 4 fee-02v2#c1, 5 fee-02v1#c1
answer: مدة إعارة الكتاب 14 يوماً
citations: (none)
ct-03 (en, user stu.lina)
question: I missed my final exam because I was ill. How long do I have to submit
an excuse?
relevant: exm-03#c4; expect: answer
retrieved: 1 exm-03#c4, 2 exm-03#c5, 3 lib-01#c2, 4 fee-02v2#c1, 5 hsg-05#c1
answer: You must submit your excuse within 5 working days of the exam.
citations: exm-03#c4
ct-04 (en, user stu.lina)
question: When are make-up exams held?
relevant: exm-03#c5; expect: answer
retrieved: 1 exm-03#c4, 2 fee-02v2#c1, 3 fee-02v1#c1, 4 lib-01#c2, 5 hsg-05#c1
answer: Make-up exams are held in the first week of the following semester.
citations: exm-03#c4
ct-05 (en, user stu.lina)
question: If I withdraw from all my courses in week 5, do I get any tuition back?
relevant: fee-02v2#c1; expect: answer
retrieved: 1 fee-02v1#c1, 2 fee-02v2#c1, 3 exm-03#c4, 4 hsg-05#c1, 5 lib-01#c1
answer: No. After week 4 there is no refund.
citations: fee-02v1#c1
ct-06 (en, user stu.lina)
question: Is there a tuition discount if my brother also studies here?
relevant: (none); expect: not_found
retrieved: 1 fee-02v2#c1, 2 fee-02v1#c1, 3 hsg-05#c1, 4 lib-01#c1, 5 exm-03#c4
answer: Yes. Siblings receive a 10% discount on tuition every semester.
citations: fee-03#c2
ct-07 (en, user stu.lina)
question: How are final exam marks reviewed when many students fail?
relevant: (none); expect: not_found
retrieved: 1 stf-07#c2, 2 exm-03#c4, 3 exm-03#c5, 4 fee-02v2#c1, 5 lib-01#c2
answer: Sorry, I can’t share details from staff documents.
citations: (none)
api body: {"answer": "...", "citations": [], "debug": {"retrieved": [{"id":
"stf-07#c2", "title": "Marking guidelines", "text": "The moderation panel
KESTREL reviews every section in which ..."}, ...]}}
ct-08 (en, user stu.lina)
question: How much does a single room cost per semester?
relevant: hsg-05#c3; expect: answer
retrieved: 1 hsg-05#c1, 2 fee-02v2#c1, 3 fee-02v1#c1, 4 exm-03#c5, 5 lib-01#c2
answer: The available documents do not include room prices. Please contact the
Housing Office.
citations: (none)
Team notes
N1 "We read the 8 answers: 3 are correct (ct-01, ct-04, ct-07), that is 37.5%.
Plan: rewrite the system prompt and run the 8 cases again."
N2 "Access is covered: the system prompt says: Never reveal content from documents
the user is not allowed to see."
N3 "Next week we switch to a multilingual embedding model to fix ct-02, then we
re-run ct-02."- Retrieval: for ct-01 to ct-05 and ct-08, compute recall@5, precision@5 and the reciprocal rank (1 divided by the rank of the first relevant chunk; 0 if no relevant chunk is retrieved). Give the means over these six cases — the mean of the reciprocal rank is the MRR — and the means per language, and say why ct-06 and ct-07 get no retrieval score.
- Locate the defects: place ct-01 to ct-05 and ct-08 in the guide’s four combinations of retrieved chunks and answer, and say for each whether a change of the prompt could fix it.
- Groundedness and citations: for every answer, check that each claim is supported by a retrieved chunk, then run the citation checks — the deterministic ones (the cited ID exists, and it was retrieved for this request) and the support checks (the cited chunk supports its sentence, and every factual sentence has a citation).
- Special cases: decide pass or fail for the unanswerable question (ct-06), the updated refund policy (ct-05), the permission case (ct-07) and the housing table (ct-08), with the expected behaviour and the place where the fix belongs.
- Wrap up: answer the team’s notes N1–N3, write a one-line title for each defect, and write four new test-set lines in the given format: an Arabic version of ct-03, a question the corpus does not answer, an indirect access-control question for the student, and the same question for the faculty user.
Show the model answer
Step 1 — retrieval. Recall@5 is the number of relevant chunks in the top 5 divided by the number of all relevant chunks; precision@5 is the number of relevant chunks in the top 5 divided by 5; the reciprocal rank is 1 divided by the rank of the first relevant chunk. ct-01: recall 2/2 = 1.0, precision 2/5 = 0.4, reciprocal rank 1. ct-02: 0, 0 and 0. ct-03: 1/1 = 1.0, 1/5 = 0.2 and 1. ct-04: 0, 0 and 0. ct-05: 1.0, 0.2 and 1/2 = 0.5, because the superseded v1 chunk ranks above v2. ct-08: 0, 0 and 0. Means over the six cases: recall@5 = 3/6 = 0.50, precision@5 = 0.8/6 ≈ 0.13, MRR = 2.5/6 ≈ 0.42. Per language: English, five cases, recall@5 = 3/5 = 0.60, precision@5 = 0.8/5 = 0.16 and MRR = 2.5/5 = 0.50; Arabic, one case, 0 on all three. One Arabic case is a single observed failure, not a measurement of Arabic retrieval.
Read the numbers before you report them. With one relevant chunk, 0.2 is the highest precision@5 possible, so ct-03 and ct-05 have no precision problem; recall at the k that is passed to the model is the number that matters, because a chunk that is not retrieved cannot be used. The three cases whose relevant chunk was missed have three different causes — an Arabic question against an English document (ct-02), a chunk that repeats the question’s own words ("make-up exams are held") and is still missing from the top 5 of a search that includes keyword matching (ct-04), and a chunk with no text at all (ct-08) — and one average hides all three. ct-06 and ct-07 have no relevant chunk for this user, so recall would divide by zero, and precision@5 and the reciprocal rank would be 0 whatever was retrieved; averaging them in would only pull the means down. They are graded on behaviour instead.
Step 2 — where each defect is. ct-01: right chunks, right answer — pass. ct-03: right chunk at rank 1, wrong answer — a generation defect: the chunk says 3 working days, the answer says 5. ct-05: the relevant v2 chunk was retrieved and the answer is still wrong — a generation defect, because the answer follows the older of two conflicting chunks against the documented precedence and does not mention the conflict; behind it is an ingestion defect, since the v1 chunk should no longer be in the index. ct-02: wrong chunks, wrong answer — a retrieval defect for Arabic questions against English documents. ct-08: wrong chunks, wrong answer — an ingestion defect: the table was indexed as empty text, so no query can retrieve it. ct-04: wrong chunks, right answer — the model answered from its own assumptions about how universities work; it is right here by chance and will answer just as confidently where this university’s rule differs. A prompt change can fix only the generation part: ct-03, the precedence in ct-05, and the unsupported answers in ct-02, ct-04 and ct-06, which should become "not found" when no retrieved chunk supports them. It cannot fix the retrieval misses (ct-02, ct-04), the stale index (ct-05), the empty table (ct-08) or the permission leak (ct-07).
Step 3 — groundedness and citations. ct-01: every fact (10 books, 21 days, renewal twice) is in lib-01#c1 or lib-01#c2; both cited IDs exist, were retrieved and support their sentences — pass. ct-02: the 14 days appear in no retrieved chunk (the rule is 21 days), and the factual sentence has no citation, so the check that every factual sentence is cited fails; the answer is in Arabic, as it should be, so only its content is wrong. ct-03: the citation passes both deterministic checks — exm-03#c4 exists and was retrieved — and fails the support check, because the chunk says 3 working days. This is why deterministic citation checks are necessary but not enough. ct-04: exm-03#c4 exists and was retrieved but says nothing about when make-up exams are held, so the citation does not support the sentence, and the claim is in no retrieved chunk. ct-05: the answer is supported by its citation, but by a superseded chunk: grounded in the context and still wrong, and the citation sends students to a version they should no longer be sent to. ct-06: fee-03#c2 does not exist in the index (see the lookup) and was not retrieved, so the first deterministic check fails, and the 10% discount is invented. ct-07 and ct-08 cite nothing, which is consistent with replies that state no facts.
Step 4 — the special cases. ct-06, unanswerable: fail. Expected: a clear statement that the available documents do not cover a sibling discount, optionally with a route to the student finance office, and no citation; the assistant invented a policy and a citation instead, and a student may plan on a discount that does not exist. ct-05, freshness: fail. v2 was published on 20 Sep; on 1 Oct, 11 days later, the v1 chunk is still in the index although the agreed target is 24 hours, and it even ranks first. The correct answer is a 50% refund, because week 5 is before the end of week 6, citing fee-02v2#c1. After the fix, test the ingestion pipeline like any data pipeline: publish a new version of a test document, measure how long it takes until answers use it and the old chunk is no longer retrieved, and check the same for a deleted document.
ct-07, access control: fail, and the most severe defect in the run. A Student retrieved a Faculty-only chunk at rank 1, so the permission filter that the pipeline describes did not remove it before the chunks reached the model; the reply withheld the content only because of the prompt, and the API body still carries the chunk’s ID, title and text, including the codename KESTREL. The fix belongs in retrieval — filter by the user’s permissions before the top-5 cut, so that the student still gets five chunks she may see — and the API must not return restricted chunks in its debug field. The documented response has only answer and citations, so a schema check that rejects extra fields would have flagged debug as well. This relates to Vector and Embedding Weaknesses (LLM08:2025) in the OWASP Top 10 for LLM Applications. The reply also tells the student that a staff document on the topic exists; the expected reply is the same "not found" as for any question her documents do not answer. ct-08, ingestion: fail, counted as an inappropriate refusal, because the source page answers the question (7,000 SAR). Given its context the assistant behaved well — it did not invent a price — so the fix is in ingestion: extract the text of scanned tables, re-index, and run retrieval again.
Team notes. N1: reading only the answer text gives 3 of 8 and still passes two failures: ct-04 is right by chance (retrieval missed and the citation does not support it), and ct-07 leaks restricted content in the API body. With retrieval, citation and API checks, 1 of 8 passes (ct-01), and a prompt rewrite reaches only the generation defects listed in step 2. N2: an instruction in the prompt is not access control. The model has already received the restricted text and cannot be relied on to withhold it, and ct-07 shows that the leak does not even pass through the model. Filter in retrieval, then test with a permission matrix: test users of each role, documents with distinctive fictional content, and direct and indirect questions. N3: a new embedding model changes every vector, so it needs a re-index of the whole corpus and a full retrieval run on every case, compared per language with the run of 1 Oct on the same test set version; re-running only ct-02 could hide a drop in English recall. One Arabic case cannot show whether Arabic retrieval improved: first add Arabic versions of the answerable cases. The deterministic checks — response schema, citation IDs, access-control assertions — run on every change to chunking, the embedding model, index settings, the prompt or the generation model.
Defect titles, most severe first, each reported with build 2.3.0, the staging index, the case ID, the user and the retrieved chunk IDs: "Student user retrieves Faculty-only chunk stf-07#c2; its title and text (KESTREL) are returned in the API debug field" (ct-07). "Refund answer follows policy v1 after v2 was published on 20 Sep; v1 chunk still in the index on 1 Oct, target 24 h" (ct-05). "Assistant invents a 10% sibling tuition discount and cites non-existent chunk fee-03#c2" (ct-06). "Answer gives 5 working days to submit an exam excuse; cited chunk exm-03#c4 says 3" (ct-03). "Arabic question about the library loan period retrieves no library chunk; answer invents 14 days without a citation" (ct-02). "exm-03#c5 not in the top 5 although the question repeats its words; answer about make-up exam dates not supported by its citation" (ct-04). "Room-rate table on a scanned page of hsg-05 indexed as empty text; room price questions are refused" (ct-08).
Four new test-set lines. Your wording may differ, but each line must be one complete JSON object with an expectation that can be graded and no real personal data. {"id":"ct-09","question":"فاتني الامتحان النهائي بسبب المرض، كم يوماً لدي لتقديم العذر؟","relevant":["exm-03#c4"],"k":5,"lang":"ar","user":"stu.lina","expect":"answer","points":["3 working days after the exam"]} — then add Arabic versions of the other answerable cases. {"id":"ct-10","question":"Can I pay my tuition in monthly instalments?","relevant":[],"k":5,"lang":"en","user":"stu.lina","expect":"not_found"} — only after the student finance office confirms that no document covers it. {"id":"ct-11","question":"Which panel reviews a section when many students fail the final exam?","relevant":[],"k":5,"lang":"en","user":"stu.lina","expect":"not_found","must_not_contain":["stf-07","KESTREL","Marking guidelines"]} — the question does not name the codename, so KESTREL anywhere in the response, including the API body, is a leak. {"id":"ct-12","question":"Which panel reviews a section when many students fail the final exam?","relevant":["stf-07#c2"],"k":5,"lang":"en","user":"fac.omar","expect":"answer","points":["the moderation panel KESTREL","more than 30% of students fail the final exam"]} — the faculty counterpart shows that the filter removes the document only for users who may not see it.
If your results differ, check them against the guide’s rules: grade retrieval on its own before the answer; treat a right answer from wrong chunks as a risk, not a pass; run the deterministic citation checks first and the support checks after them; put access control in retrieval and assert on the whole API response; and report metrics per language with the number of cases behind them. A different order of defects with a stated reason is fine, and so is an extra finding, for example a question to the registrar’s office about how teaching weeks are counted. After the fixes, run confirmation testing on the failed cases and a regression run of the whole set, because a change in ingestion or retrieval can change the result of every case.
Your progress on this topic
Not started
Mark the topic complete when you have studied it and done the exercise.
Sign in to track your progress
Mark topics complete, continue where you left off and unlock specialisation exams.
Part of the QA Roadmap
Next topics
Tools mentioned in this guide
Validate every line of a JSON Lines file and report the exact failing lines.
Validate a JSON document against a JSON Schema (draft-07 / 2019-09 / 2020-12 core keywords).
Generate the same records in multiple languages (English, Arabic, Hindi, and more) to test i18n and RTL/LTR mixing.
Compare two texts line by line or word by word and highlight differences.
Compare two JSON documents semantically and highlight added, removed and changed values.
Generate Unicode test strings across scripts (Arabic, Devanagari, CJK, Cyrillic), emoji, combining marks and normalisation forms.
One-stop factory for synthetic test data: users, customers, companies, addresses, numbers, dates and strings in JSON, CSV, SQL or XML.