Overview of retrieval methods
Unlike traditional RAG systems that rely solely on semantic similarity, GraphRAG offers four distinct search approaches:Global search
Best for: Dataset-wide questions requiring holistic understandingUses community summaries to reason about themes, trends, and high-level patterns across the entire corpus.
Local search
Best for: Entity-specific questions requiring detailed informationCombines knowledge graph structure with text chunks to gather comprehensive information about specific entities.
DRIFT search
Best for: Exploratory queries needing both breadth and depthDynamically combines global and local approaches through iterative question refinement.
Basic search
Best for: Simple semantic similarity queriesTraditional top-k vector search over text units when graph structure isn’t needed.
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
Thematic questions:
- “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
Choose which hierarchy level to use based on desired granularity:
- Root level: Fastest, most abstract (2-5 communities)
- Mid level: Balanced detail and coverage
- Leaf level: Most comprehensive, slowest (hundreds of communities)
Map phase
Community reports are processed in parallel:
- 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
Aggregate intermediate responses:
- 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
General knowledge integration:
- 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
Hierarchy level selection:
Token budget:
| Level | Communities | Speed | Detail | Cost |
|---|---|---|---|---|
| Root (top) | 2-5 | Fastest | Lowest | Lowest |
| Mid | 10-50 | Medium | Medium | Medium |
| Leaf (0) | 100-1000 | Slowest | Highest | Highest |
- 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
Entity-specific questions:
- “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
Identify entities relevant to the query:
- 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
Fan out from seed entities to gather related information:Connected entities:
- 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
Gather source text:
- 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
If claims are available:
- 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
Configuration
Core parameters
Core parameters
Context builder parameters
Context builder parameters
Fine-tune what gets included:
Ranking and filtering
Ranking and filtering
How candidates are prioritized:Entity ranking:
- 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
Start with global community context:
- 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
Iteratively refine through local search:
- 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
When to use DRIFT search
- Ideal scenarios
- Advantages
Exploratory queries:
- “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
primer_folds: Number of community report batches
- 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
DRIFT automatically balances exploration depth with computational cost using confidence scoring.
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
Basic search is included primarily for comparison and simple use cases. Most queries benefit from local or global search.
Choosing the right method
- Decision tree
- By use case
- By characteristics
Performance considerations
Speed
Fastest to slowest:
- Basic search
- Local search
- Global search (root level)
- Global search (leaf level)
- DRIFT search
Cost
LLM token usage:
- Basic: Minimal (generation only)
- Local: Moderate (one generation call)
- Global: High (map-reduce = many calls)
- DRIFT: Highest (global + multiple local)
Quality
For appropriate query types:
- Global: Excellent for themes
- Local: Excellent for entities
- DRIFT: Excellent for exploration
- Basic: Good for simple facts
Scalability
Large datasets:
- 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
Don’t default to one 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
Consider hybrid approaches:
- 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
Track metrics:
- Query latency
- Token usage and cost
- Result quality (user feedback)
- Adjust parameters accordingly
Next steps
Get started guide
Set up GraphRAG and run your first queries
Configuration
Configure retrieval parameters for your use case