GraphRAG & MedGraphRAG

A survey of Graph Retrieval-Augmented Generation and its medical implementation for complex question answering

Based on Research Papers:

Vector Embeddings

What are Embeddings?

Language models convert words and sentences into mathematical representations that capture semantic meaning.

Key Concepts

  • Numerical Representations: Text converted to numbers that encode meaning
  • Semantic Space: High-dimensional space where similar concepts are positioned close together
  • Distance = Relationship: Closer positions indicate stronger semantic similarity
  • Model Training: Generated by language models trained on vast text corpora

Think of embeddings as a "semantic map" where related concepts cluster together, just like cities on a geographic map.

What is RAG?

Retrieval-Augmented Generation combines search with language models

Why Do We Need RAG?

Traditional language models have limitations when answering questions about specific, up-to-date, or domain-specific information. They can:

  • Hallucinate - make up facts that sound plausible but are incorrect
  • Be outdated - not know about recent events or information
  • Lack domain expertise - struggle with specialized knowledge

RAG solves these problems by:

  • Retrieving relevant information from a knowledge base
  • Augmenting the language model with this retrieved context
  • Generating accurate, grounded responses

This creates more reliable, factual, and up-to-date answers.

How RAG Works

See the RAG process in action with a real document and query

Limitations of Traditional RAG

Why simple vector search falls short for complex medical queries

Complex Query Understanding

Traditional RAG struggles with multi-step reasoning questions that require connecting multiple pieces of information.

Example: "What are the long-term complications of diabetes in patients who don't respond well to insulin therapy?"

This query requires understanding:

  • What diabetes complications exist
  • Which patients don't respond to insulin
  • How these two factors interact
  • The temporal aspect of "long-term"

Simple vector similarity might retrieve chunks about diabetes complications OR insulin resistance, but fails to connect these concepts or understand the conditional relationship.

Distributed Domain Knowledge

Medical information is often scattered across multiple documents, requiring the system to understand relationships between concepts that appear in different contexts.

Example: Understanding drug interactions requires connecting information from:

  • Individual drug monographs
  • Clinical trial reports
  • Case studies
  • Pharmacokinetic databases

A query about "warfarin and vitamin K interactions" might find relevant chunks in separate documents about anticoagulants, nutrition, and drug metabolism, but traditional RAG cannot establish the causal relationships between these isolated pieces of information.

Fixed Context Window Constraints

LLMs have limited "short-term memory" - their context window can only hold so much information at once. Traditional RAG often fills this precious space with irrelevant or redundant content.

Example: When answering "What's the recommended dosage for metformin in elderly patients with kidney disease?"

Vector search might retrieve:

  • General metformin information (relevant)
  • Dosage guidelines for healthy adults (partially relevant)
  • Kidney disease treatment protocols (relevant)
  • Diabetes management overview (redundant)
  • Metformin side effects in young patients (irrelevant)

This wastes context space on information that doesn't directly answer the specific question, reducing the model's ability to focus on the most relevant details.

Efficiency and Scalability Issues

Flat vector stores require searching through the entire document collection for every query, which becomes computationally expensive and slow as the knowledge base grows.

Example: In a medical knowledge base with 100,000 documents:

  • Every query must compute similarity with all 100,000 document chunks
  • No intelligent filtering or hierarchical organization
  • Search time grows linearly with database size
  • Cannot leverage domain-specific knowledge to narrow search scope

This brute-force approach becomes impractical for real-time medical applications where speed and accuracy are critical for patient care decisions.

Advanced RAG Solutions

How modern systems overcome traditional RAG limitations

Smarter Chunking & Indexing

Recursive Splits

Instead of fixed-size chunks, documents are split intelligently based on semantic boundaries and then further subdivided when needed.

Example: A medical research paper might be split into:

  • Abstract (high-level summary)
  • Introduction (background context)
  • Methods (procedural details)
  • Results (findings and data)
  • Discussion (interpretation and implications)

Each section can be further split into paragraphs or sentences based on topic shifts.

Advanced Retrieval Strategies

Query Expansion

Rephrase and expand the original query to capture related concepts and terminology.

Example: Original query: "heart attack symptoms"

Expanded to include:

  • "myocardial infarction signs"
  • "chest pain and cardiac events"
  • "acute coronary syndrome symptoms"
  • "cardiac emergency warning signs"

This captures medical terminology variations and related concepts that might not appear in the original query.

Contextual Refinements

Filtering Irrelevant Chunks

Remove or downweight information that doesn't directly contribute to answering the query.

Example: For "metformin dosage in kidney disease":

  • Keep: dosage guidelines, kidney function considerations, monitoring protocols
  • Filter out: general diabetes overview, metformin history, unrelated side effects
  • Result: Focused context that directly addresses the specific question

Integrating External Tools & APIs

Search Engine Integration

Augment local knowledge with current information from the web.

Example: For "latest COVID-19 treatment guidelines":

  • Local knowledge: General COVID-19 information from 2022
  • Web search: Current CDC, WHO, and FDA guidelines
  • Result: Combines foundational knowledge with up-to-date recommendations

Knowledge Graphs

What are Knowledge Graphs?

Knowledge graphs are structured representations of information that connect concepts through meaningful relationships. Unlike traditional databases that store isolated facts, knowledge graphs capture the rich web of connections between entities, enabling more sophisticated reasoning and discovery.

Core Components

Nodes (Entities): Represent real-world objects, concepts, or ideas. In medical contexts, these could be diseases, drugs, symptoms, procedures, or patients.

Edges (Relationships): Define how entities are connected. These relationships carry semantic meaning, such as "treats," "causes," "contraindicated for," or "monitored by."

Properties: Additional attributes that describe entities or relationships, such as dosage information, side effects, or evidence levels.

Medical Knowledge Graph

Interactive visualization of medical concepts and their relationships

GraphRAG Approaches

Different Ways to Build GraphRAG

GraphRAG isn't one-size-fits-all. Different approaches serve different needs, from simple knowledge lookup to complex reasoning systems.

Three Main Approaches

  • Knowledge-Based GraphRAG: The graph IS the knowledge
  • Index-Based GraphRAG: The graph helps FIND knowledge
  • Hybrid GraphRAG: Combines both approaches

Each approach has different strengths and is suited for different types of medical questions and data sources.

GraphRAG Advantages

Why GraphRAG Outperforms Traditional RAG

GraphRAG demonstrates clear advantages over traditional RAG systems across multiple dimensions, from efficiency to accuracy.

Key Performance Improvements

  • Token Efficiency: 26% to 97% fewer tokens used
  • Complex Query Answering: Superior multi-hop reasoning
  • Contextual Understanding: Richer, interconnected context
  • Scalability: Better performance at scale

Let's explore each advantage in detail to understand the real-world impact.

MedGraphRAG

Specialized Medical GraphRAG

Now let's explore a specialized application: MedGraphRAG, designed specifically for the medical domain.

Primary Goal

Enhance Large Language Models to generate evidence-based, safe, and reliable medical responses that healthcare professionals can trust.

Medical Domain Challenges

  • Precision: Medical decisions require exact accuracy
  • Terminology: Complex medical vocabulary and standards
  • Evidence: All responses must be traceable to credible sources
  • Safety: Incorrect information can have serious consequences

MedGraphRAG addresses these unique challenges through specialized techniques and medical knowledge integration.

Graph Construction

Step 1: Smart Chunking

We start with a sample document containing five paragraphs. The goal is to group similar paragraphs into coherent chunks for better downstream processing.

  • Paragraphs 1, 2, and 5 discuss infectious disease and treatment.
  • Paragraphs 3 and 4 discuss hormones and pharmacology.

On the left, see the original paragraphs. On the next slide, watch as similar paragraphs are grouped into chunks.

Covid-19 is a respiratory disease that can cause severe illness in some patients.
Remdesivir is an antiviral drug used to treat Covid-19 and has shown some effectiveness.
Glucocorticoids are hormones that help reduce inflammation in the body.
Dexamethasone is a pharmacologic substance classified as a glucocorticoid.
Respiratory diseases like Covid-19 may require antiviral and anti-inflammatory treatments.

Overall Graph Structure

Graph Tagging

Covid-19 is a respiratory disease that can cause severe illness in some patients.
Remdesivir is an antiviral drug used to treat Covid-19 and has shown some effectiveness.
Respiratory diseases like Covid-19 may require antiviral and anti-inflammatory treatments.
Glucocorticoids are hormones that help reduce inflammation in the body.
Dexamethasone is a pharmacologic substance classified as a glucocorticoid.

Question Answering with Tag Tree

Medical Question

Q: "What are the general approaches to managing infectious diseases?"

Extracted Tags:

DISEASE: Covid-19 TREATMENT_TYPE: Options QUERY_TYPE: Treatment

Performance Results

Outperforms Baselines

MedGraphRAG demonstrates consistent accuracy gains across multiple benchmarks:

  • 9 medical Q&A benchmarks + 2 fact-checking benchmarks
  • ~10% gain vs. no retrieval (fact-checking)
  • ~8% gain vs. no retrieval (medical Q&A)
  • ~8% gain vs. GraphRAG (fact-checking)
  • ~5% gain vs. GraphRAG (medical Q&A)

Results validated across multiple models: Llama2, Llama3, Gemini-pro, GPT-4

Conclusion

Traditional RAG's Limitations

Standard retrieval-augmented generation faces significant challenges in complex domains:

  • Complex Query Understanding: Struggles with multi-step reasoning and conditional relationships
  • Distributed Knowledge: Cannot connect information scattered across multiple documents
  • LLM Constraints: Limited context windows waste space on irrelevant content
  • Scalability Issues: Linear search time growth with knowledge base size

These limitations make traditional RAG inadequate for specialized, knowledge-intensive domains like medicine.