Skip to main content
Instead of returning a fixed number of results (top-k), adaptive retrieval automatically determines how many results are truly relevant to your query. This prevents both information overload (too many irrelevant results) and information loss (cutting off relevant results).

The Problem with Fixed Top-K

Traditional search returns a fixed number of results:
This creates two problems:

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


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:
For browsing and discovery:

Performance Considerations

Adaptive retrieval adds minimal overhead: The algorithm runs on the score array after retrieval, so it doesn’t slow down the actual search.

Combining with Other Features

With Sketch Pre-filtering

With Time Filtering


Best Practices

Start with Defaults

The default combined strategy works well for most cases:

Tune Based on Feedback

If you’re getting too many results:
If you’re missing results:

Monitor with JSON Output

Check adaptive decisions to understand behavior:

Troubleshooting

”Adaptive returns too few results”

  1. Lower min-relevancy:
  2. Increase max-k:
  3. Try relative strategy:

“Adaptive returns too many results”

  1. Raise min-relevancy:
  2. Use cliff strategy:
  3. Consider if your query is too broad

”Results vary unexpectedly between queries”

This is expected - adaptive adjusts to each query’s score distribution. For consistent counts, use:

Next Steps

Search & Ask

Complete search command reference

Deduplication

How Memvid prevents duplicate content