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

推荐订阅源

Security Latest
Security Latest
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
量子位
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
T
Threatpost
T
Tenable Blog
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
C
Cisco Blogs
H
Heimdal Security Blog
Attack and Defense Labs
Attack and Defense Labs
A
About on SuperTechFans
Last Week in AI
Last Week in AI
N
News and Events Feed by Topic
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
I
Intezer
V
V2EX
Cyberwarzone
Cyberwarzone
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
B
Blog RSS Feed
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
PCI Perspectives
PCI Perspectives
P
Privacy International News Feed
D
Docker

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 vs vector RAG: when the knowledge graph pays for itself
saurabh naik · 2026-05-18 · via DEV Community

Ask your vector RAG pipeline "what are the main themes in this corpus?" and watch it return three random chunks that share a keyword. Flat vector retrieval is built for "find me the chunk that matches this query." It is not built for holistic, sense-making questions over a whole corpus.

GraphRAG, from Microsoft Research, was the headline fix for that gap. It builds an LLM-extracted knowledge graph plus hierarchical community summaries, then answers global queries by map-reducing over those summaries. The catch — which Microsoft itself published in their LazyGraphRAG benchmark — is that the indexing pipeline costs roughly 1000x more than a naive vector index. This post walks through what GraphRAG actually does, when it earns that cost, and what to reach for when it doesn't.

The failure mode flat vector RAG hides

Say you have 500 internal incident reports. A new hire asks: "What categories of incidents have we hit most often this year?"

Vector RAG embeds the question, retrieves the top-k chunks by cosine similarity, and stuffs them into the prompt. You get an answer based on whichever 5 chunks happened to score highest — usually the ones with the highest keyword overlap, not a representative sample of the corpus. The model can only summarize what it sees, and it never sees the whole picture.

This is the failure mode GraphRAG was built for: queries where the right answer requires reasoning over the whole corpus, not just retrieving the closest passage.

How GraphRAG fixes it

The indexing pipeline does four things:

  1. Chunk and extract. An LLM reads each chunk and extracts entities, relationships, and claims — with weighted edges and source provenance back to the original text.
  2. Build a typed graph. Entities become nodes, relationships become edges. Storage is usually Neo4j or LanceDB.
  3. Run Leiden community detection. This hierarchical clustering algorithm partitions the graph into nested communities — small tight clusters inside larger thematic ones.
  4. Generate community reports. For every community at every level, the LLM writes a natural-language summary. These summaries are what global queries actually answer against.

That last step is where the token bill explodes. You are paying an LLM to summarize every community at every hierarchy level, and you do it once at index time.

Local Search vs Global Search

GraphRAG ships two query modes, and the difference matters:

Local Search is for specific entity-centric questions ("what did we ship in the Q3 release?"). It matches the query to entities, expands to their neighborhoods (linked entities, relationships, source text), and feeds that subgraph as context.

Global Search is for thematic, aggregative questions ("what are the recurring failure modes across these incidents?"). It map-reduces over the precomputed community reports — each report contributes a partial answer, then a reducer combines them.

If you only need Local Search, you arguably do not need GraphRAG — entity-anchored hybrid retrieval gets you most of the way there. Global Search is the unique capability, and it is also the one that justifies the indexing cost.

A minimal run

pip install graphrag

Enter fullscreen mode Exit fullscreen mode

Initialize a workspace:

python -m graphrag.index --init --root ./ragtest

Enter fullscreen mode Exit fullscreen mode

That scaffolds a settings.yaml. The fields you will edit first:

llm:
  type: openai_chat
  model: gpt-4o-mini
  api_key: ${GRAPHRAG_API_KEY}

embeddings:
  llm:
    type: openai_embedding
    model: text-embedding-3-small

chunks:
  size: 1200
  overlap: 100

community_reports:
  max_length: 2000

Enter fullscreen mode Exit fullscreen mode

Drop your text files in ./ragtest/input/, then run the index:

python -m graphrag.index --root ./ragtest

Enter fullscreen mode Exit fullscreen mode

Issue a global query:

python -m graphrag.query \
  --root ./ragtest \
  --method global \
  "What are the main themes across these documents?"

Enter fullscreen mode Exit fullscreen mode

The first run on a small corpus is illuminating — you can watch the token meter while the LLM summarizes communities.

Warning: Run this on a 5MB corpus before you point it at a 5GB one. The indexing cost scales with the LLM work, not with disk size, and that work is not cheap.

The cost wall

This is the part most blog posts skip. Microsoft Research's own LazyGraphRAG benchmark on AP News measured the original GraphRAG indexing cost at ~$1,544 per million tokens versus ~$1.45 per million tokens for vector RAG. That is roughly 1000x.

The same paper introduced LazyGraphRAG, which defers graph construction to query time and uses cheaper NLP for entity extraction plus on-the-fly LLM ranking. On the same benchmark, LazyGraphRAG matched or beat GraphRAG's answer quality at ~0.1% of the indexing cost — and at its highest query budget, it outperformed GraphRAG Global Search by 16.96% on comprehensiveness and 25.7% on diversity win rates for local queries.

The authors of that LazyGraphRAG paper, Darren Edge and Ha Trinh, are also the authors of the original GraphRAG paper. Microsoft is telling you the upfront graph is overkill for most workloads.

The cheaper default: hybrid + rerank

When the corpus is not heavily reused, the practical pattern is:

  1. Hybrid retrieval. BM25 for lexical recall + dense embeddings for semantic recall, union the candidates.
  2. LLM reranker. Pass the top ~50 candidates to a small cheap LLM with a relevance prompt, keep the top 5–10.
  3. Generate. Feed those into the answer LLM.

This recovers most of the gain GraphRAG offers for entity-anchored queries, with no indexing-time graph build. The tradeoff is that you do pay more per query — every question runs the rerank step. For corpora that are queried rarely, that economics is correct. For corpora that are queried thousands of times a day on the same content, GraphRAG amortizes better.

When the graph still wins

Three signals say "build the graph upfront":

  • Reuse. The same corpus is queried heavily — knowledge bases, support docs, contract repositories — so the indexing cost amortizes over thousands of queries.
  • Provenance. Regulated domains where every answer needs a citation trail back to source documents. The graph's edge-level source tracking is the cleanest way to deliver that.
  • Repeatable thematic queries. Same kinds of "what are the patterns across X" questions, over and over. Community reports are precisely the precomputation that makes those cheap at query time.

If your workload misses all three, LazyGraphRAG or hybrid+rerank is almost certainly the right default.

A three-question decision

Before you pip install graphrag in production:

  1. Will you reissue similar queries against the same corpus more than ~1000 times? If no, defer the graph.
  2. Do answers need an auditable citation trail? If no, defer the graph.
  3. Are your hardest queries thematic ("what are the main X across the whole corpus")? If no, hybrid retrieval is likely enough.

Three nos means hybrid retrieval plus an LLM reranker. Three yeses means GraphRAG earns its index cost. Mixed answers mean LazyGraphRAG is probably the right middle.

Wrapping up

GraphRAG is real engineering, not hype. It solves a problem flat vector RAG genuinely cannot solve. But the cost profile is severe enough that Microsoft itself shipped a 1000x-cheaper variant a year later. Treat the choice as an economics question, not a capability question: does your query-to-index ratio amortize a $1,500 indexing job, and do your answers need the provenance the graph gives you?

If you want to go deeper, the LazyGraphRAG announcement on the Microsoft Research blog has the full benchmark numbers, and the microsoft/graphrag repo has reference settings for several backends. Both are worth reading before you commit to a path.

What query-to-index ratio made GraphRAG worth it in your stack? Or did you end up landing on hybrid retrieval instead?