Overview
Once you’ve generated a PageIndex tree structure, you need effective strategies to search and retrieve relevant sections. Unlike traditional vector-based RAG (Retrieval Augmented Generation), PageIndex leverages hierarchical structure for more targeted retrieval.Why Tree-Based Search?
Advantages Over Vector Search
- Structural Awareness: Understand document hierarchy and relationships
- Explainable Results: Clear reasoning for why sections were selected
- Context Preservation: Retrieve parent/child sections together when needed
- Expert Knowledge Integration: Easily incorporate domain-specific search preferences
- No Embedding Drift: Structure is explicit, not dependent on embedding model semantics
When to Use Tree Search
Basic LLM Tree Search
The simplest strategy is to use an LLM to analyze the tree structure and select relevant nodes.Simple Tree Search Prompt
Retrieving Node Content
Once you have selected node IDs, retrieve their content:Advanced Search Strategies
1. Hierarchical Expansion
When a parent node is relevant, include its children:2. Multi-Level Search
Search at different granularity levels:1
Level 1: Top-Level Selection
First, identify relevant top-level sections:
2
Level 2: Subsection Selection
For each selected top-level section, search its subsections:
3
Level 3: Final Content Retrieval
Retrieve the most specific relevant content.
3. Similarity + Structure Hybrid
Combine embedding similarity with structural search:Integrating Expert Knowledge
Unlike vector-based RAG, PageIndex makes it easy to incorporate domain expertise and user preferences.Knowledge-Guided Search
1
Define Expert Knowledge
Create domain-specific search rules:
2
Match Query to Knowledge Domain
Identify which expert knowledge applies:
3
Enhanced Search with Preferences
Incorporate knowledge into the search prompt:
Example: Financial Document Search
Advanced: Monte Carlo Tree Search (MCTS)
PageIndex’s dashboard and retrieval API use a combination of LLM tree search and value function-based Monte Carlo Tree Search (MCTS). Full implementation details will be released soon.
MCTS Overview
MCTS is a search algorithm that:- Selection: Navigate the tree using a value function
- Expansion: Expand promising nodes
- Simulation: Evaluate node relevance
- Backpropagation: Update node values
Simplified MCTS Example
Retrieval Best Practices
Evaluation Metrics
Evaluate your search strategy:Precision and Recall
Mean Reciprocal Rank (MRR)
Complete Example: End-to-End Search
Next Steps
- Learn about generating trees from PDFs
- Learn about generating trees from Markdown
- Explore all configuration options
- Join the Discord community for help with retrieval strategies