How surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation works
GraphTrace ingests technical-documentation Markdown into chunks, extracts and normalizes a provenance-bearing knowledge graph, and builds a shared vector index. For a question, its runtime entry point selects either baseline vector retrieval or GraphRAG retrieval, then generates a grounded answer with checked citations. The Streamlit interface exposes the system, while an evaluation subsystem compares retrieval methods on labeled questions. Offline and retrieval links follow the README; implementation links cite the sampled entry point or source-index references, so unsampled internals are not expanded into speculative call chains.
Main entry points: pipeline.py GraphTrace entry point · graph_retriever.py Graph retrieval · runner.py Evaluation runner · builder.py Knowledge graph
Components 24
Knowledge graph
- Document chunking
src/graphtrace/ingestion/chunker.py - Entity extraction
src/graphtrace/extraction/extractor.py - Extraction validation
src/graphtrace/extraction/validation.py - Entity normalization
src/graphtrace/extraction/normalizer.py - Knowledge graph
src/graphtrace/graph/builder.py - Graph integrity
src/graphtrace/graph/integrity.py
Retrieval and answers
- Local embeddings
src/graphtrace/retrieval/embedder.py - FAISS vector index
src/graphtrace/retrieval/vector_index.py - GraphTrace entry point
src/graphtrace/pipeline.py - Baseline retrieval
src/graphtrace/retrieval/baseline.py - Entity linking
src/graphtrace/retrieval/entity_linker.py - Graph retrieval
src/graphtrace/retrieval/graph_retriever.py - Graph traversal
src/graphtrace/graph/traversal.py - Grounded answerer
src/graphtrace/generation/answerer.py - Gemini client
src/graphtrace/generation/llm_client.py
User interface
- Streamlit interface
app/streamlit_app.py
Evaluation
- Evaluation questions
src/graphtrace/evaluation/dataset.py - Evaluation runner
src/graphtrace/evaluation/runner.py - LLM judge
src/graphtrace/evaluation/judge.py - Deterministic metrics
src/graphtrace/evaluation/metrics.py - Evaluation report
src/graphtrace/evaluation/report.py
Other components
- Markdown docs
- Questioner
- Gemini API
Connections 31
- Markdown docs → Document chunking: chunks
- Document chunking → Entity extraction: supplies chunks
- Entity extraction → Extraction validation: validates output
src/graphtrace/extraction/extractor.py - Extraction validation → Entity normalization: normalizes records
- Entity normalization → Knowledge graph: builds graph data
- Knowledge graph → Graph integrity: checks integrity
- Document chunking → Local embeddings: embeds chunks
- Local embeddings → FAISS vector index: builds index
src/graphtrace/retrieval/vector_index.py - Questioner → GraphTrace entry point: asks question
src/graphtrace/pipeline.py - GraphTrace entry point → FAISS vector index: loads index
src/graphtrace/pipeline.py - GraphTrace entry point → Knowledge graph: loads graph
src/graphtrace/pipeline.py - GraphTrace entry point → Baseline retrieval: dispatches baseline
src/graphtrace/pipeline.py - GraphTrace entry point → Graph retrieval: dispatches GraphRAG
src/graphtrace/pipeline.py - GraphTrace entry point → Grounded answerer: sends retrieval
src/graphtrace/pipeline.py - Baseline retrieval → Local embeddings: embeds question
src/graphtrace/retrieval/baseline.py - Baseline retrieval → FAISS vector index: searches vectors
src/graphtrace/retrieval/baseline.py - Graph retrieval → Local embeddings: embeds question
src/graphtrace/retrieval/graph_retriever.py - Graph retrieval → FAISS vector index: gets vector hits
src/graphtrace/retrieval/graph_retriever.py - Graph retrieval → Entity linking: links entities
src/graphtrace/retrieval/graph_retriever.py - Graph retrieval → Knowledge graph: queries graph
- Graph retrieval → Graph traversal: traverses graph
src/graphtrace/retrieval/graph_retriever.py - Grounded answerer → Gemini client: requests answer
src/graphtrace/generation/answerer.py - Gemini client → Gemini API: calls Gemini
src/graphtrace/generation/llm_client.py - Grounded answerer → GraphTrace entry point: checks citations
src/graphtrace/generation/answerer.py - Questioner → Streamlit interface: uses interface
app/streamlit_app.py - Streamlit interface → GraphTrace entry point: submits queries
app/streamlit_app.py - Evaluation questions → Evaluation runner: provides questions
src/graphtrace/evaluation/runner.py - Evaluation runner → GraphTrace entry point: compares methods
src/graphtrace/evaluation/runner.py - Evaluation runner → LLM judge: requests judgments
src/graphtrace/evaluation/runner.py - Evaluation runner → Deterministic metrics: computes metrics
src/graphtrace/evaluation/runner.py - Evaluation runner → Evaluation report: reports results
src/graphtrace/evaluation/report.py