The Retriever Doesn’t Know What Time It Is
Summary
A new RAG system addresses the critical issue of temporal awareness in retrieval, where standard systems often return semantically relevant but temporally incorrect information for time-sensitive queries. Developed from a UW-Madison NLP project, this system employs a fine-tuned retriever and a re-ranker. It leverages a synthetic dataset of 15,000 question-passage pairs generated from 500,000 FineWeb-Edu passages using a T5 model ("valhalla/t5-base-qg-hl"). The core innovation involves hard negative mining with a "facebook/contriever-msmarco" encoder and FAISS "IndexFlatIP", fine-tuning with margin ranking loss over 14 epochs, and interleaving MS MARCO triplets. A re-ranker uses Sliding Window MaxSim combined with a multiplicative temporal-decay score. This approach improved Hit@1 on ChroniclingAmericaQA's year-explicit subset from 0.404 to 0.591. The full RAG system integrates Llama 3.1 8B for generation.
Key takeaway
For Machine Learning Engineers building RAG systems that handle time-sensitive queries, relying solely on semantic similarity is insufficient and leads to factual errors. You should implement explicit temporal awareness directly within your retrieval pipeline, rather than patching it downstream. Consider fine-tuning your retriever with hard negative mining and margin ranking loss, and integrate a re-ranking stage that applies multiplicative temporal decay to ensure accuracy for historical or evolving information.
Key insights
RAG retrievers must be explicitly trained to understand temporal context to avoid "right fact, wrong time" errors.
Principles
- Hard negative mining improves temporal discrimination.
- Margin ranking loss targets specific retrieval failure modes.
- Multiplicative fusion of scores enforces temporal constraints.
Method
Generate synthetic temporal question-passage pairs using T5. Mine hard negatives with "contriever-msmarco" and FAISS. Fine-tune retriever with margin ranking loss, interleaving MS MARCO triplets. Re-rank using Sliding Window MaxSim and multiplicative temporal decay.
In practice
- Create custom datasets for temporal RAG training.
- Implement margin ranking loss for targeted retriever fine-tuning.
- Use multiplicative score fusion for temporal re-ranking.
Topics
- Retrieval-Augmented Generation
- Temporal Retrieval
- Hard Negative Mining
- Margin Ranking Loss
- FAISS
- Llama 3.1 8B
- ChroniclingAmericaQA
Code references
Best for: AI Scientist, Machine Learning Engineer, NLP Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by NLP on Medium.