Mental model
Module 07: Retrieve the right evidence for the right user- Use metadata to constrain retrieval by source, tenant, version, date, language or authorization boundary.
Use metadata to constrain retrieval by source, tenant, version, date, language or authorization boundary.
Engineering focus: Retrieve the right evidence for the right user
Use metadata to constrain retrieval by source, tenant, version, date, language or authorization boundary.
You are not expected to know the engineering vocabulary before using the idea. Formal terminology comes after the mental model.
Carry one evidence-grounded knowledge assistant through all 18 modules. Preserve source IDs, retrieval evidence, evaluation cases, authority decisions and security assumptions so every improvement is measurable.
Metadata is the guardrail around semantic search. It tells the retriever which tenant, version, language, source class or date is eligible.
Authorization must be enforced before restricted text can reach the model.
Vectors capture meaning; metadata captures explicit facts such as document type, owner, version, region and permissions.
A model must never receive chunks the user is not authorized to see.
Overly strict or incorrect metadata can hide relevant evidence. Test filters as part of retrieval evaluation.
Track effective dates or supersession relationships so older policies do not outrank current ones simply because their wording is similar.
Module 07: Retrieve the right evidence for the right useruser tenant=RED
ALL INDEX
red-vpn.md
blue-payroll.md
PRE-FILTER tenant=RED
red-vpn.md
SEMANTIC SEARCH
only authorized RED candidatesA user receives a semantically relevant document they should not see.
Authorization is deterministic application logic, not an LLM judgment.
Goal: Filter a corpus by tenant and version before ranking.
python3 - <<'PY2'
docs=[{'id':'a','tenant':'red','active':True},{'id':'b','tenant':'blue','active':True},{'id':'c','tenant':'red','active':False}]
visible=[d for d in docs if d['tenant']=='red' and d['active']]
assert [d['id'] for d in visible]==['a']; print(visible)
PY2Record the intermediate source IDs, ranks, metadata or state produced by the baseline. Explain which pipeline layer this evidence belongs to.
Pretend the query is from tenant red while the most semantically similar record belongs to tenant blue. Confirm the blue record is removed before ranking/exposure.
Authorization is deterministic application logic, not an LLM judgment. State the failing layer, change only that layer, then repeat the verification checks.
Record: hypothesis → evidence → change → observed result → remaining limitation. Keep this note with the running Evidence Desk project.
Production RAG improves when every change can be traced to evidence at a specific pipeline layer. In production, retain the before/after evidence so the same failure can become a regression test.
Authorization pre-filtered
Missing metadata fails safely
Cross-tenant negative tests pass
Semantic similarity does not encode application permissions.
Before restricted content is exposed to the model or user.
Incorrect or overly strict filters can remove relevant candidates.
To distinguish current authoritative sources from stale versions.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.