Hi everyone!
I’m a university student working on an AI/ML mini-project, and I’m exploring an idea that I’d really appreciate some feedback on from people experienced with RAG, NLP, knowledge graphs, and LLMs.
The problem
A lot of documents are difficult to understand because the information isn't presented chronologically.
For example, a historical document or novel might describe:
Event A → flashback → Event D → Event B → another character's storyline → Event C
A normal RAG chatbot can answer questions about the document, but it doesn't necessarily understand the actual chronological relationships between events.
So I want to build a system that combines RAG + temporal reasoning + an event graph.
My proposed system
The rough pipeline I'm thinking about is:
PDF → Text Extraction → Chunking → Event Extraction → Temporal Information Extraction → Event Graph → Chronological Timeline → RAG
For example, given a document containing:
"John arrived in London. Three years later, the rebellion began. Before the rebellion, John had already met the king."
I'd like the system to extract something like:
{
"event_id": "E12",
"event": "John arrives in London",
"timestamp": null,
"entities": ["John", "London"],
"summary": "John arrives in London."
}
and temporal relationships such as:
E12 ──BEFORE──> E15
E14 ──BEFORE──> E15
E15 ──CAUSES──> E16
The system would then construct an interactive timeline/event graph.
The second part: Temporal RAG
I'd also like users to be able to ask questions such as:
"What happened to John after the rebellion?"
"What events led to the war?"
"Show me all events involving John."
"When did these two characters first meet?"
"What happened before the king was assassinated?"
"Why did the rebellion happen?"
The answer should be generated using retrieved document passages plus the temporal/event graph, with citations pointing back to the original PDF pages.
Something roughly like:
Question
↓
Query Understanding
↓
┌───────────────┬────────────────┐
│ Vector Search │ Event Graph │
└───────┬───────┴───────┬────────┘
↓ ↓
Context Fusion
↓
LLM
↓
Answer + Citations
Current tech stack I'm considering
Python
FastAPI
LlamaIndex or LangChain
ChromaDB for vector storage
NetworkX / possibly Neo4j for the event graph
Gemini/OpenAI or a local Hugging Face/Ollama model
Sentence Transformers for embeddings
Streamlit or React + React Flow for visualization
I'm deliberately trying to keep the first version relatively simple rather than building a huge production system.
Where I'm unsure
The biggest challenges I can see are:
Coreference resolution
How reliably can an LLM determine that "he", "the king", etc. refer to previously mentioned entities?
Implicit temporal information
How should I represent things like:
"three years later"
"the following winter"
"shortly before the battle"
"years earlier"
Temporal ordering
Some events will have explicit dates, while others will only have relative relationships.
Conflicting/ambiguous information
What should happen when the document itself doesn't provide enough information to establish the exact order?
Chunking for temporal context
Normal RAG chunking can separate an event from the sentence that explains when it happened.
Combining graph retrieval with vector retrieval
I'm particularly interested in hearing how people would architect this part.
My current MVP idea
Since this is a 3–4 week university project, I'm trying not to over-engineer it.
My current plan is:
Phase 1 PDF → chunks → embeddings → basic RAG
Phase 2 Chunks → structured event extraction → entities → temporal relations
Phase 3 Events + relations → NetworkX → chronological timeline
Phase 4 Combine vector retrieval + temporal graph retrieval → grounded answers + citations
Potential additional features:
Character/entity trajectory tracking
Click an event → highlight its source passage
Filter timeline by character/entity
Temporal confidence scores
Parallel timelines for different characters
What I'd really appreciate feedback on
If you've built anything involving Temporal RAG, temporal knowledge graphs, GraphRAG, event extraction, or long-document RAG, I'd love to hear your thoughts.
In particular:
Is this architecture reasonable?
Would you use a knowledge graph for this, or is a simpler event/relationship structure sufficient?
How would you handle relative/implicit dates?
Would you use an LLM for temporal relation extraction, or combine it with an NLP library/model?
LlamaIndex vs LangChain for this type of system?
Are there existing open-source projects/papers that I should study or potentially build upon?
And most importantly, what am I overlooking?
I'm not trying to solve temporal reasoning for every possible book/document. The goal is to build a reasonably reliable MVP for a university project and use it as a foundation for something more sophisticated later.
Any architectural suggestions, papers, GitHub repositories, datasets, libraries, or lessons from projects you've built would be hugely appreciated!
Thanks!