Document context and retrieval solve different problems
Updated 20 Oct 2026
Lessons from EduAI Assistant and Automaton Auditor: supplying a document, selecting passages, and evaluating the answer.
Key ideas
- Evaluate retrieval separately from answer generation.
- Keep a keyword baseline and inspect the passages it selects.
- Use source attribution and missing-evidence cases in your evaluation set.
On this page
Begin with the question and source
A document-based assistant needs two things: relevant material and a response that stays grounded in that material. These are separate engineering problems.
In EduAI Assistant, document text is supplied as context to Gemini for questions, summaries, comparisons, and quizzes. This is a useful document-context workflow. It does not, by itself, imply a vector-search retrieval system.
Retrieval selects the material
Automaton Auditor extracts PDF text, splits it into overlapping chunks, and ranks passages using keyword overlap. This is a transparent retrieval baseline: a query and its selected passages are easy to inspect.
Keyword retrieval has limits. A relevant passage can use different words from the query, while an irrelevant passage can repeat the same words. Chunk boundaries can also split information that belongs together.
Improve one stage at a time
Before introducing embeddings or reranking, collect example questions and the passages that should support them. Check whether those passages appear among the retrieved results. Then evaluate whether the generated answer uses them correctly.
This separates retrieval quality from answer quality. Changing the model cannot reliably fix a pipeline that never supplies the needed evidence.
Plan for missing evidence
A useful assistant should be able to say that the available material does not support an answer. Source references, clear uncertainty, and a stable fallback are preferable to a confident unsupported response.
Documents can also contain instructions that should not control application behavior. Keep source content separate from system instructions and restrict any tools available to the answer-generation step.
Compare retrievers against the same evidence
Use the same questions, source set, and acceptance criteria to compare a keyword baseline with an alternative retriever. This makes differences easier to attribute to retrieval behavior rather than a changing dataset or prompt.
Track correctness and grounding alongside latency and cost. A more complex pipeline should justify itself through evidence.
Build a small evaluation record
Start with questions that have known supporting passages. Add questions that require more than one passage and questions the documents cannot answer. Keep a record of the query, relevant source identifiers, retrieved passages, generated answer, and review outcome.
| Stage | Question to inspect | Useful observation |
|---|---|---|
| Ingestion | Did extraction preserve the source meaning? | Missing text, broken tables, or unusable pages |
| Retrieval | Did the required evidence reach the context? | Relevant passages among the selected results |
| Generation | Does the answer follow the evidence? | Supported claims and accurate source references |
| User experience | Is missing evidence understandable? | A clear explanation or a useful fallback |
Do not collapse all four stages into a single model score. An excellent answer to one question can hide an ingestion error elsewhere, and a retrieved passage can be relevant without supporting every claim in the answer.
Keep source versions with the evaluation record. When documents change, the expected answer may change as well. Review a sample of results manually before using a metric to guide a larger comparison.