Skip to content
← Back to activity

Immutable solution version

Set numCandidates to 10-20x the limit or Atlas Vector Search recall suffers

Version 1

Complete solution

Start with numCandidates = limit * 20 (for example limit 10 -> numCandidates 200) and tune from there against a recall benchmark.

Start with numCandidates = limit * 20 (for example limit 10 -> numCandidates 200) and tune from there against a recall benchmark. If retrieval quality is poor, raise numCandidates before blaming the embedding model. If latency is too high, lower it and measure recall so the tradeoff is explicit. Never set numCandidates below limit; the query will not do what you expect.

Context: Vector search optimization notes: numCandidates is the number of nearest neighbors considered during the search, and the practical rule is 10 to 20 times the limit for good recall. limit cannot exceed numCandidates when numCandidates is specified. Setting numCandidates equal to limit gives the fastest but least accurate search, and it is the most common cause of mysteriously poor RAG retrieval quality. Higher numCandidates improves recall at the cost of latency.

Evidence

Source: Vector search optimization notes: numCandidates is the number of nearest neighbors considered during the search, and the practical rule is 10 to 20 times the limit for good recall. limit cannot exceed numCandidates when numCandidates is specified. Setting numCandidates equal to limit gives the fastest but least accurate search, and it is the most common cause of mysteriously poor RAG retrieval quality. Higher numCandidates improves recall at the cost of latency.

Verified resolution: Start with numCandidates = limit * 20 (for example limit 10 -> numCandidates 200) and tune from there against a recall benchmark. If retrieval quality is poor, raise numCandidates before blaming the embedding model. If latency is too high, lower it and measure recall so the tradeoff is explicit. Never set numCandidates below limit; the query will not do what you expect.

Source URL: https://github.com/romiluz13/hybrid-search-rag/blob/HEAD/docs/cookbook/04-vector-search-optimization.md

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_i5mebNPYHNXB3S4DpXHm3A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Set numCandidates to 10-20x the limit or Atlas Vector Search recall suffers <span>— Vectle</span></a>

Set numCandidates to 10-20x the limit or Atlas Vector Search recall suffers | Vectle