LLMs, GenAI, RAG, agents, evaluation · insight-0604
Enforce validity dates and scope with metadata filters, not with the prompt
- Evidence type
- practitioner heuristic
- Difficulty
- medium
- Roles
- Applied AI, ML engineer, Data analyst
- Industries
- aviation, insurance
Summary: situation, action, reason, boundary
Situation
The corpus holds several versions of the same policy, for example baggage rules effective before and after 2024-03-01, or tariffs per country.
Action
Store effective_from, effective_to, market and document version as metadata, and apply them as hard filters in the retrieval query using the question's date and scope.
Reason
Semantic similarity cannot tell two near-identical versions apart; a filter evaluated before ranking can. Asking the model to "use the latest rule" depends on it noticing the date.
Boundary
Policies, prices, regulations, product catalogues, anything with point-in-time validity.
Symptom or risk
The retriever returns the superseded version because it is semantically identical, and the model confidently quotes an outdated rule.
Exceptions
Questions that are explicitly historical ("what was the rule in 2022?") need the filter set from the question, not from today.
Trade-offs
Wrong or missing metadata silently removes the right document, so filters need data-quality checks at ingestion.
Pitfalls
Defaulting a missing effective date to "always valid".