Before you start
Initial testing strategy
Start with a small dataset
Use affordable models for testing
Enable caching
Run dry-run first
Prompt tuning
When to tune prompts
- New domain: Medical, legal, scientific, business data
- Specialized terminology: Industry-specific jargon or concepts
- Non-English content: Different language or mixed languages
- Specific entity types: You know what entities matter for your use case
Tuning workflow
Prepare representative data
Run prompt tuning
--selection-method auto with k-means clustering.Review generated prompts
./project/prompts/ for:- Entity types discovered
- Example extractions
- Domain-specific language
Customize if needed
- Add missing entity types
- Adjust extraction instructions
- Improve examples
Test on sample data
Prompt tuning parameters
Selection methods
Selection methods
- Fast and simple
- Good for uniform datasets
- Use with
--limit 15-20
- Uses first N documents
- Good when documents are pre-sorted
- Use with
--limit 15-20
- Uses k-means clustering
- Selects representative documents
- Use with
--n-subset-max 300and--k 15
Domain specification
Domain specification
- “medical research papers”
- “corporate financial reports”
- “legal contracts and agreements”
- “science”
- “business”
- “phase 3 clinical trials for oncology drugs”
Language settings
Language settings
Configuration optimization
Model selection
Choose models based on your requirements:- Development
- Production
- High-end
Chunking configuration
Optimize chunking for your document structure:Entity extraction settings
- 0: Fastest, cheapest, lower recall
- 1: Recommended balance (default)
- 2+: Highest quality, expensive, diminishing returns
Community detection
- 500-1000: Brief summaries, lower cost
- 1500: Recommended default, balanced detail
- 2000-3000: Comprehensive reports, higher cost
Rate limiting
Set appropriate rate limits to avoid throttling:- OpenAI
- Azure OpenAI
- 3 RPM, 40,000 TPM (GPT-4)
- 5 RPM, 100,000 TPM (GPT-3.5)
- 500 RPM, 80,000 TPM (GPT-4o)
- 3,500 RPM, 200,000 TPM (GPT-3.5)
Cost management
Estimate costs before indexing
Run a test with a small sample and extrapolate:Cost reduction strategies
Enable caching
Larger chunks
Reduce gleanings
Use cheaper models
Cost tracking
Monitor spending:- OpenAI: Check usage at platform.openai.com/usage
- Azure: Monitor costs in Azure Portal → Cost Management
- Local logs: Track token counts in GraphRAG logs
Query optimization
Choose the right search method
- Global Search
- Local Search
- DRIFT Search
- Basic Search
- Dataset-wide questions
- Theme identification
- Summarization
- Trend analysis
- “What are the main themes?”
- “Summarize the key findings”
- “What trends appear across documents?”
Community level selection
- Level 0: Entire dataset (very broad, expensive)
- Level 1: Major themes (broad summaries)
- Level 2: Recommended default (balanced granularity)
- Level 3+: Fine-grained details (more specific)
Response type optimization
Guide the format of responses:Data preparation
Document formatting
Supported formats
Supported formats
- Plain text (
.txt) - Markdown (
.md) - CSV (
.csv) - Other formats via custom loaders
Document structure
Document structure
- No headings or sections
- Mixed formatting
- Excessive special characters
- Malformed text from PDF extraction
Metadata inclusion
Metadata inclusion
Data cleaning
Clean your data before indexing:Storage and scalability
Local vs. cloud storage
- Local (File)
- Cloud (Azure Blob)
- Development
- Small datasets (<10K documents)
- Testing
Large dataset handling
For datasets with >10,000 documents:Partition your data
Optimize chunking
Use cloud storage
Implement incremental updates
graphrag update for new documents:Workflow best practices
Development workflow
Initial setup
Small sample test
Prompt tuning
Validation
Iterate
- Adjust configuration
- Refine prompts
- Test again
Scale up
Version control
Track your GraphRAG configuration:Monitoring and debugging
Enable verbose logging during development:- Token usage
- API errors
- Extraction quality
- Processing time
Common pitfalls
Not running prompt tuning
Not running prompt tuning
graphrag prompt-tune for domain-specific dataSkipping small-scale testing
Skipping small-scale testing
Ignoring rate limits
Ignoring rate limits
Disabling cache
Disabling cache
Using wrong search method
Using wrong search method
Poor document quality
Poor document quality