GraphRAG: Improving global search via dynamic community selection

Bryan Li, Ha Trinh, Darren Edge, Jonathan Larson15 Nov 2024

Problem

Teams that run retrieval-augmented generation (RAG) over a private document collection struggle with "global" questions such as "Catch me up on the last two weeks of updates". These questions have no keywords and need the whole dataset, so retrieving a few passages fails. GraphRAG answers them by summarizing every community report at one fixed level of its knowledge graph. That static search is expensive because many reports have nothing to do with the question.

Example from the article: on an AP News dataset, static global search at level 1 pushes about 1,500 community reports through map-reduce for each question.

Solution in brief

Before the costly map-reduce step, a small LLM rates community reports top-down from the graph root. Irrelevant reports are dropped together with their sub-communities, relevant ones lead to their children, and only the surviving reports go to the final answering model. Cost falls by 77% at similar quality, and answers get more detailed if the search may go deeper.

Questions this case answers
  • How to answer holistic questions over a large document collection with map-reduce summarization without paying LLM tokens for every summary in the hierarchy
  • How to cut the LLM cost of answering corpus-wide questions with GraphRAG global search?
  • How to answer abstract questions that need the whole document collection when keyword retrieval fails?
  • How to choose the community level for global search without fixing it in advance?

Tools and methods

  • GraphRAG — indexes documents into hierarchical communities with LLM-written reports.
  • Dynamic community selection — keeps only reports an LLM rates as relevant.
  • GPT-4o-mini — cheap rater of report relevance.
  • GPT-4o — runs the map-reduce step that writes the final answer.
  • LLM evaluator — picks the better of two answers for win rates.
Continue reading — it's free

Google or a one-time email code. No password.