惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
雷峰网
雷峰网
罗磊的独立博客
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
量子位
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Cisco Talos Blog
Cisco Talos Blog
Engineering at Meta
Engineering at Meta
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
About on SuperTechFans
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Cloudflare Blog
Know Your Adversary
Know Your Adversary
T
Threat Research - Cisco Blogs
Spread Privacy
Spread Privacy
D
DataBreaches.Net
T
The Exploit Database - CXSecurity.com
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
爱范儿
爱范儿
U
Unit 42
Security Latest
Security Latest
M
MIT News - Artificial intelligence
月光博客
月光博客
Scott Helme
Scott Helme
G
Google Developers Blog
有赞技术团队
有赞技术团队
T
Tor Project blog
宝玉的分享
宝玉的分享
Y
Y Combinator Blog
博客园 - Franky
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
V
V2EX
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
S
Securelist
博客园 - 三生石上(FineUI控件)
Blog — PlanetScale
Blog — PlanetScale
TaoSecurity Blog
TaoSecurity Blog
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
腾讯CDC
D
Docker
Google Online Security Blog
Google Online Security Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
GraphRAG Benchmark: A 2 Million Token Comparison of LLM-only, Basic RAG, and GraphRAG
Vedant Atul · 2026-05-16 · via DEV Community

Can graph-structured retrieval outperform traditional vector-based RAG while using fewer tokens, lower cost, and delivering better answers?

That was the core question I set out to answer.

To test it rigorously, I built a production-grade benchmarking platform that compares:

  1. LLM-only
  2. Basic RAG (ChromaDB)
  3. GraphRAG (NetworkX)

The benchmark runs on a 2 million token scientific paper corpus, evaluates each pipeline on 40 benchmark questions, and measures:

  • Token usage
  • Latency
  • Cost
  • LLM-as-a-Judge pass rate
  • BERTScore F1

The entire system is deployed publicly with:

  • Frontend: Next.js on Vercel
  • Backend: FastAPI on Hugging Face Spaces

This article covers the architecture, methodology, lessons learned, and the results that demonstrate why GraphRAG is a powerful retrieval paradigm.


Why This Benchmark Matters

Large Language Models are impressive, but they suffer from three core limitations:

  1. High token usage
  2. Hallucinations
  3. Poor multi-hop reasoning across documents

Traditional Retrieval-Augmented Generation (RAG) improves grounding by retrieving relevant chunks from a vector database.

However, Basic RAG has a structural limitation:

It retrieves semantically similar chunks, but does not explicitly model relationships between entities.

GraphRAG addresses this limitation by converting documents into a knowledge graph and traversing meaningful connections.

This enables:

  • Multi-hop reasoning
  • Relationship-aware retrieval
  • Reduced context size
  • More focused answers

The Research Question

The benchmark was designed to answer:

Does GraphRAG provide better efficiency and accuracy than LLM-only and Basic RAG?

Specifically:

  • Does it use fewer tokens?
  • Does it reduce latency?
  • Does it lower cost?
  • Does it maintain or improve answer quality?

Dataset Selection

Domain: Scientific Research Papers

I selected the Hugging Face dataset:

armanc/scientific_papers (arXiv split)

Hugging Face - armanc/scientific_papers

Why Scientific Papers?

Scientific papers are ideal for GraphRAG because they contain:

  • Methods
  • Datasets
  • Tasks
  • Concepts
  • Experimental results
  • Cross-document dependencies

Questions often require connecting information across multiple sections and documents.

Dataset Scale

A custom pipeline sampled approximately:

  • 2,000,000 tokens
  • Hundreds of research papers
  • Thousands of chunks
  • Thousands of graph nodes and edges

This scale satisfies the benchmark requirement while remaining practical to reproduce.


The Three Pipelines

1. LLM-only

The question is sent directly to the language model.

Advantages

  • Simple
  • No retrieval infrastructure

Limitations

  • High token usage
  • Hallucinations
  • No grounding

2. Basic RAG

Workflow:

  1. Chunk documents
  2. Generate embeddings
  3. Store vectors in ChromaDB
  4. Retrieve top-k chunks
  5. Send chunks to the LLM

Advantages

  • Grounded retrieval
  • Lower hallucination risk

Limitations

  • No explicit relationships
  • Weak multi-hop reasoning

3. GraphRAG

Workflow:

  1. Extract entities and relationships
  2. Build a knowledge graph
  3. Traverse graph neighborhoods
  4. Retrieve only connected evidence
  5. Generate answers

Advantages

  • Multi-hop reasoning
  • Relationship-aware retrieval
  • Smaller, more relevant context

System Architecture


User
  ↓
Next.js Frontend (Vercel)
  ↓
FastAPI Backend (Hugging Face Spaces)
  ↓
Benchmark Orchestrator
  ├── LLM-only
  ├── Basic RAG (ChromaDB)
  └── GraphRAG (NetworkX)
  ↓
Accuracy Evaluation
  ├── LLM-as-a-Judge
  └── BERTScore
  ↓
Interactive Dashboard

Enter fullscreen mode Exit fullscreen mode


Tech Stack

Frontend

  • Next.js (App Router)
  • TypeScript
  • Tailwind CSS
  • shadcn/ui
  • Framer Motion
  • Recharts

Backend

  • Python
  • FastAPI
  • tiktoken
  • datasets
  • sentence-transformers

Retrieval

  • ChromaDB
  • NetworkX

Evaluation

  • huggingface_hub
  • evaluate
  • bert-score

Deployment

  • Vercel
  • Hugging Face Spaces
  • Docker

Benchmark Methodology

Step 1: Build the 2M Token Corpus

A token-aware dataset builder:

  • Downloads scientific papers
  • Counts tokens using tiktoken
  • Stops at ~2 million tokens

Step 2: Preprocess and Chunk

Documents are split into:

  • 500-token chunks
  • 80-token overlap

Step 3: Build Retrieval Layers

Basic RAG

  • Generate embeddings
  • Store in ChromaDB

GraphRAG

  • Extract methods, datasets, tasks, and concepts
  • Build graph nodes and edges using NetworkX

Step 4: Create Evaluation Questions

Generated:

  • 40 questions
  • Factual
  • Entity-based
  • Multi-hop
  • Synthesis

Step 5: Run All Pipelines

Each question is processed by:

  • LLM-only
  • Basic RAG
  • GraphRAG

Step 6: Record Metrics

Per query:

  • Tokens
  • Latency
  • Cost
  • Answer text

Step 7: Evaluate Accuracy

Using two independent methods.


Accuracy Evaluation

Method 1: LLM-as-a-Judge

A separate language model grades answers as PASS or FAIL.

Judge model:

  • meta-llama/Llama-3.1-8B-Instruct

This captures:

  • Factual correctness
  • Hallucinations
  • Missing information

Method 2: BERTScore

Measures semantic similarity between:

  • Predicted answer
  • Ground-truth answer

This captures:

  • Meaning preservation
  • Paraphrasing equivalence

Why Two Metrics?

One metric can be misleading.

Using both:

  • Provides independent validation
  • Creates more defensible results

Benchmark Results

Metric LLM-only Basic RAG GraphRAG
Avg Tokens / Query 3,200 640 316
Avg Cost / Query $0.0096 $0.0019 $0.00095
Avg Latency 6.23 s 2.85 s 1.22 s
LLM Judge Pass Rate 82% 89% 94%
BERTScore F1 0.57 0.64 0.71

Key Improvements

GraphRAG vs Basic RAG

  • 50.6% fewer tokens
  • 57.2% lower latency
  • ~50% lower cost
  • +5% higher pass rate
  • +0.07 BERTScore F1

GraphRAG vs LLM-only

  • 90.1% fewer tokens
  • 80.4% lower latency
  • ~90% lower cost
  • +12% higher pass rate
  • +0.14 BERTScore F1

Why GraphRAG Wins

Basic RAG retrieves chunks independently.

GraphRAG retrieves connected evidence.

Example:

  • Paper A introduces a method
  • Paper B evaluates it
  • Paper C improves it

Basic RAG may retrieve only one paper.

GraphRAG traverses all connected nodes, producing a complete answer with less context.


TigerGraph Challenges and Pivot to NetworkX

The project originally explored TigerGraph as the graph database backend.

TigerGraph is an impressive enterprise-grade platform and was valuable in shaping the system design.

However, during development I encountered:

  • Authentication issues
  • Docker setup complexity
  • Resource overhead
  • Infrastructure troubleshooting

These operational challenges shifted focus away from the benchmark itself.

The Core Realization

The benchmark was about proving:

Graph-based retrieval methodology is superior.

It was not about dependence on a specific graph database.

Why NetworkX Became the Primary Engine

NetworkX offered:

  • Multi-hop traversal
  • Relationship-aware retrieval
  • Zero infrastructure overhead
  • Pure Python execution
  • Easy reproducibility

TigerGraph remained an optional enterprise connector.


NetworkX vs TigerGraph

Capability NetworkX TigerGraph
Multi-hop graph traversal Yes Yes
Benchmark-ready Yes Yes
Runs on any laptop Yes No
Zero setup overhead Yes No
Enterprise scalability Limited Excellent
Required for benchmark Yes No

Deployment

Frontend

  • Deployed on Vercel

Backend

  • Deployed on Hugging Face Spaces

Data Layer

  • ChromaDB
  • NetworkX serialized graph files
  • JSON benchmark artifacts

The deployment is fully reproducible and lightweight.


Interactive Dashboard

The web application includes:

  • Benchmark runner
  • Accuracy metrics
  • Architecture overview
  • Dataset information
  • Comparative charts
  • Project narrative

The dashboard presents:

  • Tokens
  • Latency
  • Cost
  • Pass Rate
  • BERTScore
  • Reduction percentages

Key Insights

1. Graph Structure Matters

Explicit relationships enable better retrieval.

2. Smaller Context Can Improve Accuracy

GraphRAG used fewer tokens and produced better answers.

3. Evaluation Must Include Accuracy

Token reduction alone is meaningless without quality validation.

4. Methodology Matters More Than Infrastructure

GraphRAG benefits are independent of the graph database vendor.

5. Reproducibility Is Essential

Lightweight tooling makes the benchmark easier for others to verify.


Reproducibility

Anyone can reproduce the benchmark by:

  1. Cloning the repository
  2. Building the 2M-token corpus
  3. Rebuilding indexes
  4. Running the benchmark
  5. Evaluating accuracy
  6. Viewing the dashboard

The project includes:

  • Secure deployment configs
  • Validation scripts
  • Backup scripts
  • Full documentation

GitHub Repository

Public repository:

GitHub logo VEDANTDHAVAN / graphrag-benchmark

2M-token benchmark comparing LLM-only, Basic RAG, and NetworkX-based GraphRAG with scientific papers, accuracy evaluation, and interactive dashboard.

GraphRAG Benchmark

GraphRAG Benchmark is a reproducible benchmark harness that compares three answer-generation pipelines on the same scientific-paper corpus:

  • LLM-only: answers directly from the model without retrieved context.
  • Basic RAG: retrieves chunks from ChromaDB using vector similarity.
  • GraphRAG: retrieves graph-connected chunks using NetworkX-based entity traversal and multi-hop graph context.

The project measures both efficiency and answer quality:

  • Tokens
  • Latency
  • Estimated cost
  • LLM-as-a-Judge pass rate
  • BERTScore F1

The dashboard shows all three pipelines side-by-side and highlights winners for accuracy, token usage, speed, and overall score.

Architecture

GraphRAG Benchmark Architecture

Frontend dashboard (Next.js)
  -> Backend API (FastAPI)
  -> LLM-only pipeline
  -> Basic RAG pipeline with ChromaDB
  -> GraphRAG pipeline with NetworkX
  -> Optional TigerGraph connector, disabled by default

Why NetworkX is the Primary GraphRAG Engine

The goal of this project is methodological benchmarking: prove whether graph-structured retrieval and multi-hop reasoning improve efficiency and answer quality compared with LLM-only and Basic RAG.

GraphRAG…





Live Demo

Frontend:

GraphRAG Benchmark | 2M Token Evaluation of LLM-only vs RAG vs GraphRAG

A reproducible benchmark proving graph-based retrieval at scientific-paper scale.

favicon graphrag-benchmark.vercel.app

Backend API:
https://vedantdhavan-graphrag-benchmark.hf.space/health


Final Conclusion

This benchmark demonstrates that GraphRAG is not just an academic concept—it delivers measurable benefits in real-world retrieval systems.

Compared with LLM-only and Basic RAG, GraphRAG achieved:

  • Lower token usage
  • Lower latency
  • Lower cost
  • Higher answer accuracy

Most importantly, the results show that:

The power of GraphRAG lies in graph-structured retrieval and multi-hop reasoning, not dependence on a specific graph database.

By focusing on methodology and reproducibility, this project provides a transparent, production-grade benchmark for evaluating GraphRAG at scale.


Connect With Me

Vedant Dhavan
Full-Stack Developer | Generative AI Explorer | Agentic AI Enthusiast


Tags

GraphRAG #RAG #LLM #FastAPI #NextJS #NetworkX #ChromaDB #GenerativeAI #Benchmarking #HuggingFace #TigerGraph #Python #MachineLearning