Retrieval engineering: beyond document chat · Module 1: Retrieval engineering: beyond document chat in practice
Metadata filters and permission boundaries
Learning outcome: Distinguish relevance filtering from access control.
Metadata describes a document or chunk: owner, version, topic, effective date or permitted audience. Filters can narrow retrieval to suitable sources. However, a prompt asking the model to ignore restricted documents is not an access-control mechanism.
Enforce access before unauthorised content enters the model context. Test the same question using different fictional access roles. Separately test freshness: the newest upload is not necessarily the currently approved policy. Keep an explicit source of authority and a process for removing superseded material. Record which filters were applied when debugging a surprising answer.
Worked example
A fictional assistant has a public travel guide and restricted individual expense cases. A user asks a general reimbursement question. The general guide is sufficient; personal cases should not be retrieved just because they contain similar words. Filtering by the user's permitted source set must happen before those cases are passed to the model.
Try it yourself
Design metadata fields for three fictional policy documents. Include approval status, effective date and audience. Write a negative test proving a general user cannot retrieve the restricted document.
You can do this exercise on paper. If using an assistant, keep to the fictional material and an approved tool.
Compare your approach
The negative test must inspect retrieved source identifiers, not just the final wording. A model can omit private details from an answer while still having received material it should never have accessed.
Check your understanding
Where should a restricted-document boundary be enforced?
- Only after the answer has been shown
- Before the document enters the model context
- Only in the final writing prompt
Show the answer and explanation
Answer: Before the document enters the model context. Access controls should keep unauthorised material out of the retrieved context. Asking the model to hide it afterwards does not undo the exposure.
Workbook
Download the course workbook to record your answer and compare it after the knowledge check.