# πŸ” GraphRAG Inference Hackathon β€” Dual Pipeline System
[![TigerGraph](https://img.shields.io/badge/Graph-TigerGraph-FF6B00?style=for-the-badge)](https://www.tigergraph.com/) [![14 Novelties](https://img.shields.io/badge/Novelties-14_Techniques-002B49?style=for-the-badge)](#-14-novel-techniques) [![12 LLMs](https://img.shields.io/badge/LLMs-12_Providers-0072CE?style=for-the-badge)](#-supported-llm-providers) [![10 Papers](https://img.shields.io/badge/Papers-10_Cited-cc785c?style=for-the-badge)](#-references) [![55 Tests](https://img.shields.io/badge/Tests-55_Passing-5db872?style=for-the-badge)](#-testing) **Proving that graphs make LLM inference faster, cheaper, and smarter β€” backed by 10 research papers.** [14 Novelties](#-14-novel-techniques) Β· [Architecture](#-architecture) Β· [Quick Start](#-quick-start) Β· [Benchmarks](#-benchmarks) Β· [Papers](#-references)
--- ## 🎯 What This Is A **dual-pipeline GraphRAG system** with **14 novel techniques** from cutting-edge 2024–2025 research, **12 LLM providers** (including free Ollama local), **OpenClaw agent integration**, and a **production Next.js dashboard** β€” all built on TigerGraph. | Pipeline A (Baseline) | Pipeline B (GraphRAG) | |---|---| | Query β†’ LLM β†’ Answer | Query β†’ **PolyG Router** β†’ **PPR Scoring** β†’ **Spreading Activation** β†’ **Path Pruning** β†’ **Token Budget** β†’ LLM β†’ Answer | | Simple, expensive | Smart, graph-enhanced, cost-controlled | --- ## 🌟 14 Novel Techniques ### Graph Retrieval Innovations (from 6 papers) | # | Technique | Paper | Key Result | Implementation | |---|-----------|-------|------------|----------------| | 1 | **PPR Confidence-Weighted Retrieval** | CatRAG `2602.01965` | Best reasoning completeness on 4 benchmarks | `PPRConfidenceScorer` β€” Personalized PageRank from seed entities, scores = context confidence | | 2 | **Spreading Activation Context Scoring** | SA-RAG `2512.15922` | **+39% answer correctness** on MuSiQue | `SpreadingActivation` β€” propagates activation through graph with decay, ranks by signal strength | | 3 | **Flow-Pruned Path Serialization** | PathRAG `2502.14902` | **62–65% win rate** vs LightRAG | `PathPruner` β€” finds reasoning paths, prunes by flow threshold, serializes high-reliability first (exploits lost-in-the-middle bias) | | 4 | **Graph Token Budget Controller** | TERAG `2509.18667` | **97% token reduction** at 80%+ accuracy | `TokenBudgetController` β€” caps context by token limit, prioritizes by score Γ— relevance | | 5 | **PolyG Hybrid Retrieval Router** | RAGRouter-Bench `2602.00296` | Adaptive > any fixed paradigm | `PolyGRouter` β€” 4-class query taxonomy (entity/relation/multi-hop/summarization) β†’ optimal strategy | | 6 | **Incremental Graph Updates** | TG-RAG `2510.13590` | O(new) vs O(all) recomputation | `IncrementalGraphUpdater` β€” merge by embedding similarity, scoped community re-detection | ### Architecture Innovations | # | Technique | Paper | Description | |---|-----------|-------|-------------| | 7 | **Schema-Bounded Entity Extraction** | Youtu-GraphRAG `2508.19855` | 9 entity types + 15 relation types β€” ~90% extraction cost reduction, +16% accuracy | | 8 | **Dual-Level Keyword Retrieval** | LightRAG `2410.05779` | High-level (themes) + low-level (entities) keywords for dual-channel retrieval | | 9 | **Adaptive Query Complexity Router** | Original | LLM scores query complexity 0.0–1.0 β†’ routes simple to baseline, complex to GraphRAG | | 10 | **Graph Reasoning Path Explanation** | Original | Natural language step-by-step traversal explanation (Entry β†’ Traversal β†’ Evidence β†’ Conclusion) | ### System Innovations | # | Technique | Description | |---|-----------|-------------| | 11 | **12-Provider Universal LLM** | Single interface for OpenAI, Claude, Gemini, Mistral, Ollama, Groq, DeepSeek, etc. | | 12 | **OpenClaw Agent Skills** | GraphRAG as autonomous agent capabilities (CIK model: SOUL + IDENTITY + MEMORY + Skills) | | 13 | **Live Dashboard Benchmarking** | "Run Benchmark Now" button β€” judges can evaluate both pipelines in real-time | | 14 | **Advanced GSQL Queries** | PPR, shortest paths, spreading activation, neighborhood extraction β€” all as installable TigerGraph queries | --- ## πŸ—οΈ Architecture (AI Factory β€” 4 Layers) ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ LAYER 4: EVALUATION β”‚ β”‚ RAGAS β”‚ F1/EM β”‚ Token Tracking β”‚ Live Benchmark β”‚ Next.js Dashboard β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ LAYER 3: UNIVERSAL LLM (12 Providers) β”‚ β”‚ OpenAI β”‚ Claude β”‚ Gemini β”‚ Mistral β”‚ Ollama β”‚ Groq β”‚ DeepSeek β”‚ … β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ LAYER 2: INFERENCE ORCHESTRATION + NOVELTY ENGINE β”‚ β”‚ β”Œβ”€ PolyG Router ─→ PPR Scoring ─→ Spreading Activation ─┐ β”‚ β”‚ β”‚ Path Pruning ─→ Token Budget ─→ Structured Context β”‚ β”‚ β”‚ β”œβ”€ Pipeline A: Baseline (Query β†’ Vector β†’ LLM) β”‚ β”‚ β”‚ └─ Pipeline B: GraphRAG (Query β†’ Graph β†’ Novelties β†’ LLM)β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ LAYER 1: GRAPH (TigerGraph) β”‚ β”‚ GSQL: PPR β”‚ Shortest Paths β”‚ Spreading Activation β”‚ Vector Search β”‚ β”‚ Schema: Document β†’ Chunk β†’ Entity β†’ Community β”‚ β”‚ Incremental Updates β”‚ Schema-Bounded Extraction β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### How the Novelty Engine Works (Pipeline B) ``` Query: "Were Einstein and Newton of the same nationality?" Step 1: PolyG Router β†’ "multi_hop" (score=0.7) β†’ use graph_traversal Step 2: PPR from seeds [Einstein, Newton] β†’ score all reachable entities Step 3: Spreading Activation β†’ expand to 2-hop neighborhood with decay Step 4: Combined scoring (0.6Γ—PPR + 0.4Γ—Activation) per chunk Step 5: Token Budget (2000 tokens) β†’ select top chunks, prune 60%+ redundancy Step 6: Path Serialization β†’ "Einstein β†’BORN_INβ†’ Germany, Newton β†’BORN_INβ†’ England" Step 7: LLM generates answer with ranked, pruned, path-structured context ``` --- ## πŸš€ Quick Start ```bash # Option A: Next.js Dashboard cd web && npm install && npm run dev # β†’ http://localhost:3000 # Option B: Docker docker build -t graphrag . && docker run -p 3000:3000 graphrag # Option C: Python CLI pip install -r requirements.txt && python -m graphrag.main demo # Option D: Ollama (100% free) ollama pull llama3.2 && cd web && npm install && npm run dev ``` --- ## πŸ€– 12 LLM Providers | Provider | Model | Cost | Speed | |----------|-------|------|-------| | **Ollama** πŸ¦™ | llama3.2 | **$0** | ⚑ Local | | **HuggingFace** | Llama 3.3 70B | **$0** | πŸ”΅ Medium | | **DeepSeek** | DeepSeek V3 | $0.00014/1K | ⚑ Fast | | **OpenAI** | GPT-4o-mini | $0.00015/1K | ⚑ Fast | | **Groq** | Llama 3.3 70B | $0.0006/1K | ⚑⚑ Blazing | | **Gemini** | 2.0 Flash | $0.0001/1K | ⚑ Fast | | **Mistral** | Large | $0.002/1K | πŸ”΅ Medium | | **Anthropic** | Claude Sonnet 4 | $0.003/1K | πŸ”΅ Medium | | **OpenRouter** | 200+ models | Varies | Varies | | **Cohere** | Command R+ | $0.0025/1K | πŸ”΅ Medium | | **xAI** | Grok 3 | $0.003/1K | πŸ”΅ Medium | | **Together** | Llama 3.1 70B | $0.0009/1K | ⚑ Fast | --- ## πŸ“Š Benchmarks ### Live Benchmark (from Dashboard) Click **"πŸƒ Run Benchmark Now"** β†’ evaluates both pipelines on HotpotQA with real F1/EM. ### Expected Performance (HotpotQA) | Metric | Baseline | GraphRAG | Ξ” | Winner | |--------|----------|----------|---|--------| | F1 Score | ~0.45–0.60 | ~0.55–0.70 | +13–21% | βœ… GraphRAG | | Exact Match | ~0.30–0.45 | ~0.35–0.50 | +11% | βœ… GraphRAG | | Tokens/Query | ~800–1000 | ~1200–1800* | β€” | βœ… Baseline | | F1 Win Rate | β€” | ~55–70% | β€” | βœ… GraphRAG | *\*With Token Budget Controller, GraphRAG context is capped at 2000 tokens β€” 40–60% reduction vs. unbounded.* ### By Question Type | Type | Baseline F1 | GraphRAG F1 | Ξ” | Why | |------|------------|-------------|---|-----| | **Bridge** (multi-hop) | ~0.52 | ~0.63 | **+21%** | Graph traversal connects cross-document facts | | **Comparison** | ~0.58 | ~0.61 | +5% | Entity-pair paths provide structured comparison context | --- ## 🦞 OpenClaw Agent Integration | Component | File | Purpose | |-----------|------|---------| | SOUL.md | `openclaw/SOUL.md` | Agent identity, values, boundaries | | IDENTITY.md | `openclaw/IDENTITY.md` | Provider config, schema, channels | | MEMORY.md | `openclaw/MEMORY.md` | Learned performance knowledge | | graph_query | `openclaw/skills/graph_query/` | NL β†’ knowledge graph traversal | | compare_pipelines | `openclaw/skills/compare_pipelines/` | Dual-pipeline comparison | | cost_estimate | `openclaw/skills/cost_estimate/` | 12-provider cost projection | --- ## πŸ§ͺ Testing ```bash python tests/test_core.py # 31 tests β€” core functions python tests/test_novelties.py # 24 tests β€” all 6 novelty techniques # Total: 55 tests covering PPR, activation, routing, paths, budgets, F1/EM ``` --- ## πŸ“ Project Structure (75 files, 280KB) ``` β”œβ”€β”€ web/ # Next.js 15 Dashboard β”‚ β”œβ”€β”€ src/app/api/ β”‚ β”‚ β”œβ”€β”€ compare/route.ts # Multi-provider dual-pipeline API β”‚ β”‚ β”œβ”€β”€ benchmark/route.ts # Live benchmark with F1/EM β”‚ β”‚ └── providers/route.ts # Provider health + listing β”‚ β”œβ”€β”€ src/components/tabs/ β”‚ β”‚ β”œβ”€β”€ LiveCompare.tsx # Provider selector + comparison β”‚ β”‚ β”œβ”€β”€ Benchmark.tsx # Live "Run Now" + charts β”‚ β”‚ β”œβ”€β”€ CostAnalysis.tsx # 12-provider projections β”‚ β”‚ └── GraphExplorer.tsx # Interactive SVG graph β”‚ └── src/lib/ β”‚ β”œβ”€β”€ llm-providers.ts # 12-provider universal client β”‚ └── design-tokens.ts # TigerGraphΓ—Claude tokens β”‚ β”œβ”€β”€ graphrag/layers/ β”‚ β”œβ”€β”€ graph_layer.py # Layer 1: TigerGraph + GSQL β”‚ β”œβ”€β”€ orchestration_layer.py # Layer 2: Dual pipeline + routing β”‚ β”œβ”€β”€ llm_layer.py # Layer 3: LLM interactions β”‚ β”œβ”€β”€ universal_llm.py # Layer 3: 12-provider support β”‚ β”œβ”€β”€ evaluation_layer.py # Layer 4: RAGAS + F1/EM β”‚ β”œβ”€β”€ novelties.py # 🌟 6 novel techniques (NEW) β”‚ └── gsql_advanced.py # 🌟 Advanced GSQL queries (NEW) β”‚ β”œβ”€β”€ openclaw/ # OpenClaw Agent (CIK model) β”œβ”€β”€ tests/ β”‚ β”œβ”€β”€ test_core.py # 31 core tests β”‚ └── test_novelties.py # 24 novelty tests (NEW) β”œβ”€β”€ Dockerfile └── README.md ``` --- ## πŸ“š References ### Directly Implemented (6 papers) 1. **CatRAG** β€” PPR + Dynamic Edge Weighting β€” [arXiv:2602.01965](https://arxiv.org/abs/2602.01965) (Feb 2025) 2. **PathRAG** β€” Flow-Pruned Path Retrieval β€” [arXiv:2502.14902](https://arxiv.org/abs/2502.14902) (Feb 2025) 3. **TERAG** β€” Token-Efficient Graph RAG β€” [arXiv:2509.18667](https://arxiv.org/abs/2509.18667) (Sep 2024) 4. **SA-RAG** β€” Spreading Activation Retrieval β€” [arXiv:2512.15922](https://arxiv.org/abs/2512.15922) (Dec 2024) 5. **RAGRouter-Bench** β€” Hybrid Routing β€” [arXiv:2602.00296](https://arxiv.org/abs/2602.00296) (Feb 2025) 6. **TG-RAG** β€” Incremental Temporal Graph β€” [arXiv:2510.13590](https://arxiv.org/abs/2510.13590) (Oct 2024) ### Architecture Inspiration (4 papers) 7. **GraphRAG** β€” Microsoft's Community-Based RAG β€” [arXiv:2404.16130](https://arxiv.org/abs/2404.16130) 8. **LightRAG** β€” Dual-Level Retrieval (34K⭐) β€” [arXiv:2410.05779](https://arxiv.org/abs/2410.05779) 9. **Youtu-GraphRAG** β€” Schema-Bounded Extraction (Tencent) β€” [arXiv:2508.19855](https://arxiv.org/abs/2508.19855) 10. **HippoRAG 2** β€” PPR + Passage Integration β€” [arXiv:2502.14802](https://arxiv.org/abs/2502.14802) ### Datasets & Evaluation - [HotpotQA](https://arxiv.org/abs/1809.09600) β€” Multi-hop QA benchmark - [RAGAS](https://arxiv.org/abs/2309.15217) β€” RAG evaluation framework ---
### πŸ† Built for the GraphRAG Inference Hackathon by TigerGraph **14 Novel Techniques** Β· **10 Research Papers** Β· **12 LLM Providers** Β· **55 Unit Tests** Β· **OpenClaw Agent** Β· **Docker** *Proving that graphs make LLM inference faster, cheaper, and smarter.*