AWS Builder Center

Three checks before trusting a document Q&A assistant

A small test set for checking whether a document Q&A assistant cites the right evidence, handles missing information, and respects access rules.

A document assistant can return a convincing answer and still fail a simple test: can a reader find the evidence that supports it?
For a first RAG project, I would start with a small evaluation set before adding more features. Retrieval-augmented generation gives the model relevant source material to use, but the application still needs checks for evidence, missing information, and access.

1. Check what the citation actually supports

Imagine a student club assistant answering questions from an event handbook. Someone asks whether guests need to register. The answer says registration is required and cites a paragraph about ticket prices.
The citation exists, but it does not support the claim.
For each test question, record the expected answer and the passage that supports it. Review the retrieved passage separately from the generated answer. If the right passage was never retrieved, changing the answer prompt may leave the underlying problem unresolved.

2. Include questions the documents cannot answer

A useful test set needs some gaps. Ask about an event that is not in the handbook, or a policy that has not been decided.
The expected result should be an admission that the available documents do not answer the question. A plausible guess is still a failure.
Also test updates. Replace a policy, sync the source, and check both the new answer and whether the superseded policy still appears in results. Treat this as a verification task rather than assuming the update worked because the sync finished.

3. Test access before testing convenience

If the same system holds public announcements and committee-only notes, test the same question as users with different permissions.
Access restrictions should apply before private passages reach the model. A prompt asking the model not to reveal confidential text is not a substitute for enforcing access in the application. The server should determine a user's allowed scope from trusted identity information rather than trusting a client-supplied team name.

A small starting point

Try ten questions: six supported by the documents, two with no answer, and two that exercise access restrictions. That is a starting exercise, not a sufficient production evaluation.
Keep a short record of each result: question, user scope, expected passage, retrieved passage, generated answer, and pass or fail. Use harmless test documents and avoid putting private source text into broadly accessible logs.
Amazon Bedrock Knowledge Bases can provide retrieval and generation for this kind of assistant. The surrounding tests determine whether the application is ready to trust.
Inspired by  Building a Document Q&A Assistant with Amazon Bedrock Knowledge Bases . This is a proposed learning exercise, not a report of a deployed system.
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