Overview of retrieval methods
Unlike traditional RAG systems that rely solely on semantic similarity, GraphRAG offers four distinct search approaches:Global search
Local search
DRIFT search
Basic search
Global search
Global search addresses a critical weakness in baseline RAG: answering questions that require holistic understanding of an entire dataset.When to use global search
- Ideal queries
- Why baseline RAG fails
- “What are the top 5 themes in this data?”
- “What are the main trends discussed?”
- “Summarize the overall narrative”
- “What are the most significant findings?”
- “What patterns emerge across the dataset?”
- “What are the key takeaways?”
- “What are the major differences between X and Y?”
- “How do various perspectives compare?”
- “What are the competing viewpoints?”
How global search works
Select community level
- Root level: Fastest, most abstract (2-5 communities)
- Mid level: Balanced detail and coverage
- Leaf level: Most comprehensive, slowest (hundreds of communities)
Map phase
- Chunk reports: Split reports into token-sized chunks
- Generate intermediate responses: Each chunk produces a list of points with importance ratings
- Rate points: LLM assigns 1-10 importance scores to each point
Reduce phase
- Rank points: Sort all points by importance rating
- Filter: Keep only highest-rated points that fit in context window
- Synthesize: LLM generates final response from aggregated points
Configuration
Core parameters
Core parameters
Advanced options
Advanced options
- True: LLM can incorporate external knowledge beyond dataset
- False (default): Responses strictly from indexed data
Performance vs quality trade-offs
Performance vs quality trade-offs
- Lower (4000-8000): Faster, less comprehensive
- Higher (12000-16000): Slower, more comprehensive
- Higher (20-50): Faster map phase, more API load
- Lower (5-10): Slower but more stable
Local search
Local search excels at answering questions about specific entities by combining structured graph knowledge with unstructured text.When to use local search
- Ideal queries
- Advantages over baseline RAG
- “What are the healing properties of chamomile?”
- “Who is Satya Nadella and what is his role?”
- “Describe the relationship between X and Y”
- “What does the research say about [specific topic]?”
- “What are the characteristics of [entity]?”
- “How is [entity] connected to [other entities]?”
- “How are A and B related through C?”
- “What do A’s connections say about B?”
How local search works
Entity extraction
- Embed query: Convert query to vector embedding
- Search entity embeddings: Find semantically similar entities
- Rank by similarity: Top-k entities become entry points
Graph traversal
- Direct neighbors (1-hop)
- Optionally: 2-hop neighbors
- Ranked by relationship strength and centrality
- All edges connected to seed entities
- Edges between gathered entities
- Ranked by weight and relevance
- Reports for communities containing seed entities
- Reports for related entities’ communities
- Provides thematic context
Text unit retrieval
- Entity-text mappings: Text units mentioning extracted entities
- Rank by relevance: Score text units by:
- Entity importance
- Number of relevant entities mentioned
- Semantic similarity to query
- Filter by token budget: Keep top-ranked units that fit
Covariate retrieval
- Entity-claim mappings: Claims about extracted entities
- Rank by relevance: Score claims by entity importance and claim type
- Include in context: Add to structured context
Context assembly
Response generation
- Answers drawn from multiple sources
- Maintains provenance (can cite entities, relationships, text units)
- Balances graph structure with text details
Configuration
Core parameters
Core parameters
Context builder parameters
Context builder parameters
Ranking and filtering
Ranking and filtering
- Embedding similarity to query
- Graph centrality (degree, PageRank)
- Community membership importance
- Connected to high-ranked entities
- Relationship weight
- Description relevance to query
- Contains high-ranked entities
- Number of relevant entities
- Semantic similarity to query
- Contains seed entities
- Community size and importance
- Summary relevance
DRIFT search
DRIFT (Dynamic Reasoning and Inference with Flexible Traversal) combines the breadth of global search with the depth of local search through iterative refinement.How DRIFT search works
DRIFT search creates a hierarchical exploration tree with three phases: Primer (global), Follow-up (local), and Output (ranked hierarchy)
Primer phase
- Retrieve top-k community reports: Most relevant to query
- Generate initial answer: Broad response addressing the query
- Generate follow-up questions: Questions for deeper exploration
- Confidence scoring: Rate each follow-up question’s potential
Follow-up phase
- Select highest-confidence question: From pending follow-ups
- Execute local search: Detailed entity-based search
- Generate intermediate answer: Specific response to follow-up
- Generate new follow-ups: Further refinement questions
- Update confidence: Re-score based on information gain
- Repeat: Until budget exhausted or confidence threshold not met
Output hierarchy
When to use DRIFT search
- Ideal scenarios
- Advantages
- “Tell me about [broad topic]”
- “What should I know about [domain]?”
- “Explain [complex concept]”
- User doesn’t know specific entities to ask about
- Investigating unfamiliar dataset
- Discovery-oriented exploration
- Need both overview and details
- Want multiple perspectives
- Seeking comprehensive understanding
Configuration
Key hyperparameters
Key hyperparameters
- Higher → more comprehensive initial coverage
- Lower → faster primer phase
- Higher → more detailed exploration
- Lower → faster, less thorough
- Higher (0.8-0.9) → only high-value follow-ups
- Lower (0.5-0.7) → more exploratory
Basic search
Traditional top-k vector similarity search over text units.When to use basic search
- Simple fact lookup questions
- Queries with direct semantic matches in text
- When graph structure doesn’t add value
- Baseline comparison for other methods
Choosing the right method
- Decision tree
- By use case
- By characteristics
Performance considerations
Speed
- Basic search
- Local search
- Global search (root level)
- Global search (leaf level)
- DRIFT search
Cost
- Basic: Minimal (generation only)
- Local: Moderate (one generation call)
- Global: High (map-reduce = many calls)
- DRIFT: Highest (global + multiple local)
Quality
- Global: Excellent for themes
- Local: Excellent for entities
- DRIFT: Excellent for exploration
- Basic: Good for simple facts
Scalability
- Basic: Scales well (vector search)
- Local: Scales moderately (graph size)
- Global: Depends on hierarchy level
- DRIFT: Resource-intensive
Best practices
Start with the right method
Start with the right method
- Analyze the query type
- Consider information needs
- Choose appropriate method
- Evaluate results
Tune for your use case
Tune for your use case
- Global: Adjust community level based on detail needs
- Local: Tune context proportions for your data
- DRIFT: Balance exploration depth with cost
- All: Optimize token budgets
Combine methods
Combine methods
- Try local first, fall back to global
- Use basic search for filtering, then local for details
- DRIFT for exploration, local for follow-up
Monitor performance
Monitor performance
- Query latency
- Token usage and cost
- Result quality (user feedback)
- Adjust parameters accordingly