The Problem with Fixed Top-K
Traditional search returns a fixed number of results:| Scenario | Fixed Top-K | Result |
|---|---|---|
| Few relevant docs | Returns 10 | Noise in results |
| Many relevant docs | Returns 10 | Missing relevant content |
How Adaptive Retrieval Works
Adaptive retrieval analyzes the score distribution of results to find natural cutoff points:CLI Usage
Adaptive retrieval is enabled by default:Tuning Adaptive Behavior
Adaptive Strategies
Five strategies are available for different use cases:Combined (Default)
Balances multiple signals for best overall performance:- Uses both relative and absolute thresholds
- Applies cliff detection as secondary signal
- Best for general-purpose search
Relative
Cuts off at a percentage of the top score:- Default threshold: 50% of top score
- Good for consistent corpora
- Example: Top score 0.92 → cutoff at 0.46
Absolute
Uses a fixed score cutoff:- Cuts at specified minimum score
- Good when you know your quality threshold
- Predictable behavior across queries
Cliff
Detects sharp drops in score distribution:- Looks for score drops > 30% between consecutive results
- Best for distinct topic clusters
- Works well when relevant docs are clearly separated
Elbow
Finds the inflection point in the score curve:- Uses curve analysis to find natural groupings
- Good for gradual score distributions
- Mathematically principled approach
Strategy Comparison
| Strategy | Best For | Behavior |
|---|---|---|
combined | General use | Balanced, adaptive |
relative | Consistent corpora | % of top score |
absolute | Known thresholds | Fixed cutoff |
cliff | Clustered topics | Sharp drop detection |
elbow | Gradual distributions | Curve inflection |
SDK Usage
Python
Node.js
Understanding Results
Adaptive retrieval adds metadata to help you understand decisions:When to Disable Adaptive
Some scenarios work better with fixed top-k:Pagination
When paginating through results:Comparison
When comparing result counts across queries:RAG Context Building
When you need a specific context window:Tuning for Your Data
High-Precision Needs
For applications where false positives are costly:High-Recall Needs
For applications where missing results is costly:Exploratory Search
For browsing and discovery:Performance Considerations
Adaptive retrieval adds minimal overhead:| Operation | Time Added |
|---|---|
| Score analysis | < 1ms |
| Cutoff detection | < 1ms |
| Total overhead | < 2ms |
Combining with Other Features
With Sketch Pre-filtering
With Hybrid Search
With Time Filtering
Best Practices
Start with Defaults
The defaultcombined strategy works well for most cases:
Tune Based on Feedback
If you’re getting too many results:Monitor with JSON Output
Check adaptive decisions to understand behavior:Troubleshooting
”Adaptive returns too few results”
-
Lower
min-relevancy: -
Increase
max-k: -
Try
relativestrategy:
“Adaptive returns too many results”
-
Raise
min-relevancy: -
Use
cliffstrategy: - Consider if your query is too broad