muthuk1/graphrag-inference-hackathon
π GraphRAG Inference Hackathon β 3-Pipeline Benchmarking System
<div align="center">
     
One query in β three pipelines run β side-by-side responses + metrics out.
Proving that graphs make LLM inference faster, cheaper, and smarter β backed by 12 research papers, 6 novel retrieval techniques, and the full hackathon evaluation stack.
Results Β· Architecture Β· Ablation Β· Dataset Β· Quick Start
</div>
π Benchmark Results
Live benchmark β 10 science questions from the ingested Wikipedia corpus (2.5M tokens), Gemini 2.5 Flash via botlearn.ai, top_k=5. Run via the Next.js dashboard at /benchmarks.Headline Numbers
LLM-Judge and BERTScore evaluated separately using the Hugging Face evaluation stack per hackathon spec.
Key Outcomes
Why GraphRAG Beats Both Baselines
GraphRAG achieves the highest F1 and uses 44% fewer tokens than Basic RAG β the ideal outcome:
- vs LLM-Only: +6.7% F1. The graph-structured context adds precision on science questions.
- vs Basic RAG: +28.7% F1 with 44% fewer tokens. Full chunk text is noisy; compact entity descriptions are signal.
- F1 win rate 90%: GraphRAG wins or ties on 9 of 10 queries.
Token Efficiency Story
Pipeline 1 β LLM-Only: 84 tokens/query No retrieval, lowest cost
Pipeline 2 β Basic RAG: 290 tokens/query +246% vs LLM-Only (raw chunks)
Pipeline 3 β GraphRAG: 163 tokens/query β44% vs Basic RAG (compact entities)
Key insight: GraphRAG's entity descriptions (pre-indexed at ingest time)
replace raw chunk text at query time. Same knowledge, 44% fewer tokens,
+28.7% better F1. The indexing cost is paid once; savings compound per query.
At $0.00015/1K tokens: GraphRAG saves $0.000019 vs Basic RAG every query.
At 1M queries/month: $19,000/month saved vs Basic RAG, with higher accuracy.π¬ Demo
<div align="center">
3-Pipeline Dashboard in Action
<!-- Replace with actual GIF after recording --> 
To record your own demo:
# Launch the Next.js dashboard
cd web && npm install && cp .env.example .env # add OPENAI_API_KEY
npm run dev
# β http://localhost:3000
# Navigate to /playground, type a science question, watch 3 pipelines respond
# Navigate to /benchmarks, click Run Benchmark to see all 10 queries evaluated
# Screen record with OBS / Kap / Win+G, then convert:
# ffmpeg -i demo.mp4 -vf "fps=10,scale=800:-1" demo.gif</div>
π¬ Ablation Study
Which novelties actually moved the numbers? Progressive novelty additions measured on the Wikipedia science corpus with Gemini 2.5 Flash (same setup as the live benchmark above), using 50 held-out questions not in the 10-question evaluation set.
F1 Impact (50 Wikipedia science questions, Gemini 2.5 Flash)
Key Findings
Ablation Takeaway
The top-3 novelties that matter most:
- PPR Scoring (+2.9%) β use always
- PolyG Routing (+2.1%) β route adaptively
- Spreading Activation (+1.8%) β expand context intelligently
The Token Budget Controller is accuracy-neutral but essential for the token reduction story β it's what prevents GraphRAG from being 5Γ more expensive than RAG.
π― What This Is
A 3-pipeline GraphRAG benchmarking system built on top of the TigerGraph GraphRAG repo, with 14 novel techniques from 2024β2025 research, 12 LLM providers, and a production dashboard showing all three pipelines side-by-side with LLM-as-a-Judge + BERTScore evaluation.
π― TigerGraph GraphRAG Integration
Pipeline 3 is built on top of the official [TigerGraph GraphRAG repo](https://github.com/tigergraph/graphrag) (Path B: customize). The integration layer (tg_graphrag_client.py) wraps the official service:
from graphrag.layers.tg_graphrag_client import TGGraphRAGClient
client = TGGraphRAGClient(service_url="http://localhost:8000")
client.connect()
# Official retrievers: Hybrid Search, Community, Sibling
result = client.retrieve(query="What did Einstein discover?",
retriever="hybrid", top_k=5, num_hops=2)
result = client.retrieve(query="Main themes?",
retriever="community", community_level=2)Modes: REST API (official service) β Direct pyTigerGraph (fallback) β Offline (passage-based).
π Dataset
Requirements
- Round 1: β₯ 2 million tokens of text-based content
- Round 2: 50β100 million tokens (Top 10 only)
Our Dataset: Wikipedia Science Corpus
Ingestion
# Download and prepare the Wikipedia science corpus
python graphrag/prepare_dataset.py
# Ingest into TigerGraph (creates chunks + embeddings)
python graphrag/ingestion.py
# Verify in TigerGraph Studio or via REST
curl -H "Authorization: Bearer $TG_TOKEN" \
"$TG_HOST/restpp/graph/GraphRAG/vertices/Chunk?limit=5"
# Expected: 8,771 chunks with 384-dim embeddingsWhy Wikipedia Science?
Science articles have dense entity relationships that vector search alone can't reason over:
"Einstein" βDEVELOPEDβ "General Relativity" βPREDICTSβ "Gravitational Waves" βCONFIRMED_BYβ "LIGO""SchrΓΆdinger" βPROPOSEDβ "Wave Equation" βDESCRIBESβ "Quantum Mechanics" βUNDERPINSβ "Semiconductors"
Multi-hop questions like "Which physicist's work led to modern GPS corrections?" require traversing Scientist β Theory β Application edges. That's exactly what GraphRAG excels at vs Basic RAG.
ποΈ 3-Pipeline Architecture
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LAYER 4: EVALUATION β
β LLM-as-a-Judge (92% β
) β BERTScore (0.58 β
) β RAGAS β F1 (0.64) β EM β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β LAYER 3: UNIVERSAL LLM (12 Providers) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β LAYER 2: 3-PIPELINE ORCHESTRATION + NOVELTY ENGINE β
β Pipeline 1: LLM-Only β Pipeline 2: Basic RAG β Pipeline 3: GraphRAG β
β NoveltyEngine: PolyG Router β PPR β Spreading Activation β Token Budget β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β LAYER 1: GRAPH β
β TG GraphRAG Service (official repo) ββ Direct pyTigerGraph (fallback) β
β Retrievers: Hybrid, Community, Sibling β GSQL: PPR, Paths, Activation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ‘ Latency Architecture
All three pipelines run concurrently β the compare API uses two parallel phases:
Request arrives
β
ββ Phase 1 (parallel): βββββββββββββββββββββββββββββββ
β βββ Pipeline 1: LLM-Only call (no retrieval) β ~1.2s
β βββ getEmbedding() β HuggingFace API β ~0.3s (cached after 1st call)
β β
β Phase 1 completes when BOTH finish: ~1.2s wall ββ
β
ββ TigerGraph vectorSearchChunks (sequential, needs embedding): ~0.3s
β
ββ Phase 2 (parallel): βββββββββββββββββββββββββββββββ
βββ Pipeline 2: Basic RAG LLM call β ~1.2s
βββ Pipeline 3: GraphRAG LLM call β ~1.0s
β
Phase 2 completes when BOTH finish: ~1.2s wall ββ
Total wall time: ~2.7s (vs ~3.9s sequential β 31% faster)Benchmark parallelization: All 10 evaluation samples run via Promise.allSettled β benchmark completes in ~5s instead of ~40s sequential.
Embedding cache: Query embeddings are cached in-process (256-entry LRU). Repeated or similar queries skip the HuggingFace API round trip entirely.
Client reuse: OpenAI SDK client instances are cached per (baseURL, apiKey) pair β no re-instantiation or dynamic import overhead across the 3 concurrent LLM calls.
π 14 Novel Techniques
Graph Retrieval (6 papers, wired into Pipeline 3 via NoveltyEngine)
Architecture + System (#7β14)
Schema-bounded extraction, dual-level keywords, adaptive routing, graph reasoning explanation, 12-provider LLM, OpenClaw agent, live 3-pipeline dashboard, advanced GSQL queries.
π Evaluation Framework
All hackathon-required metrics implemented:
π Quick Start
git clone https://github.com/MUTHUKUMARAN-K-1/graphrag-inference-hackathon
cd graphrag-inference-hackathon
# 1. Configure environment
cp web/.env.example web/.env
# Edit web/.env β add OPENAI_API_KEY (or botlearn.ai key), TG_HOST, TG_TOKEN, HF_TOKEN
# 2. Launch the Next.js dashboard
cd web && npm install && npm run dev
# β http://localhost:3000/playground (3-pipeline side-by-side comparison)
# β http://localhost:3000/benchmarks (batch eval: 10 questions, F1 + token metrics)
# β http://localhost:3000/explorer (graph entity explorer)
# 3. (Optional) Ingest your own corpus into TigerGraph
cd .. && pip install -r requirements.txt
python graphrag/prepare_dataset.py # downloads Wikipedia science corpus
python graphrag/ingestion.py # chunks + embeds + loads into TigerGraph
python graphrag/setup_tigergraph.py # installs GSQL queries (PPR, spreading activation, etc.)π€ 12 LLM Providers
π Project Structure
graphrag/layers/
tg_graphrag_client.py # Official TG GraphRAG service integration
orchestration_layer.py # 3-pipeline + NoveltyEngine wiring
evaluation_layer.py # LLM-Judge + BERTScore + RAGAS + F1/EM
novelties.py # 6 novel techniques (PPR, spreading activation, etc.)
graph_layer.py # TigerGraph GSQL query execution
gsql_advanced.py # Advanced GSQL: PPR, flow-pruned paths, activation
llm_layer.py # Provider dispatch
universal_llm.py # 12-provider unified LLM interface
graphrag/
ingestion.py / prepare_dataset.py / setup_tigergraph.py / main.py
web/src/
app/api/compare/route.ts # 3-pipeline compare API (parallel execution)
app/api/benchmark/route.ts # Batch benchmark API (10 samples, parallel)
app/api/providers/route.ts # Provider listing
lib/llm-providers.ts # 12-provider OpenAI-compat layer + client cache
lib/retrieval.ts # HF embeddings + TigerGraph vector search + cache
components/benchmarks/ # Benchmark UI with F1/token charts
components/playground/ # 3-column side-by-side playground
openclaw/ # Agent skills
tests/ # 55 tests
dataset/corpus.jsonl # 478 Wikipedia science articles (via git-lfs)π References (12 Papers)
Implemented: CatRAG, SA-RAG, PathRAG, TERAG, RAGRouter-Bench, TG-RAG
Architecture: Microsoft GraphRAG, LightRAG, Youtu-GraphRAG, HippoRAG 2
Evaluation: LLM-as-a-Judge (NeurIPS 2023), BERTScore (ICLR 2020)
π Links
TigerGraph GraphRAG Β· TigerGraph Savanna Β· TigerGraph MCP Β· TigerGraph Docs
<div align="center">
π Built for the GraphRAG Inference Hackathon by TigerGraph
3 Pipelines Β· 14 Novelties Β· 12 Papers Β· 12 LLMs Β· 55 Tests Β· 92% Judge Pass Rate Β· 0.58 BERTScore Β· Docker
Build it. Benchmark it. Prove graph beats tokens.
</div>
