Your team built a knowledge base search. Someone asks a question.
The system returns 10 results. All of them are vaguely related.
The AI uses all 10 to craft an answer. The answer is confidently wrong.
The system found stuff. It just found the wrong stuff.
The problem is not the search. The problem is that no one told the system when to stop.
INTERMEDIATE - Requires search results. Controls what reaches your AI.
Every search returns results with similarity scores. A score of 0.92 means 'very similar.' A score of 0.47 means 'sort of related.' Without a threshold, you're feeding everything to the AI, including the garbage.
A relevance threshold is your quality gate. You decide: only results above 0.75 make the cut. Everything else gets filtered out before the AI sees it. The AI works with three highly relevant passages instead of ten mediocre ones.
Set the threshold too low and the AI hallucinates from bad context. Set it too high and the AI says "I don't know" when the answer exists. The art is finding the right cutoff for your use case.
Every decision system needs a quality gate. Without a clear threshold, you process everything equally and get overwhelmed by noise. The pattern is universal: define "good enough" before you act.
Set a measurable cutoff. Anything above the line gets processed. Anything below gets filtered or escalated. This prevents low-quality inputs from polluting downstream decisions.
Move the slider to see which results pass or fail your quality gate. Green results are actually relevant. Red ones would pollute your AI's context.
Enterprise customers receive 90-day refund window with full credit...
Standard refund policy allows 30 days for all customers...
Enterprise pricing starts at $10,000/year with volume discounts...
All support tickets should reference the customer ID...
Updated data retention policies for compliance...
New enterprise customers should complete these steps...
Q4 customer satisfaction survey results...
Remote work policies for all employees...
One number for everything
You pick a number (e.g., 0.75) and apply it universally. Simple to implement, easy to understand. Works well when your queries are consistent and your embedding model is stable.
Adjust based on context
Different query types get different thresholds. Technical questions might need 0.85 (high precision). General inquiries might accept 0.65 (broader recall). The system learns what works for each category.
Take the best N, but only if good enough
Return the top 5 results, but only if they exceed 0.6. This guarantees you never get more than 5 (context limits) and never get junk (quality floor). Common in production RAG systems.
An employee asks your knowledge base. Without relevance thresholds, the search returns everything vaguely related to 'refund' or 'enterprise' or 'policy.' The AI weaves them into a confidently wrong answer. With thresholds, only the three most relevant passages get through. The AI gives the actual policy.
Hover over any component to see what it does and why it's neededTap any component to see what it does and why it's needed
Animated lines show direct connections | Hover for detailsTap for details | Click to learn more
You guessed 0.8 because it "sounds right." But your embedding model returns 0.6-0.7 for genuinely relevant content. Now your AI says "I don't know" to questions that have answers in your knowledge base.
Instead: Run test queries. See what scores your good matches actually get. Set threshold based on real data, not gut feeling.
A technical question about your API needs precision. A general question about company culture can be broader. Using 0.85 for everything means the culture question returns nothing.
Instead: Categorize your queries. Set different thresholds by category. Or use Top-K with minimum for more flexibility.
Everything fell below threshold. Now what? The system returns an empty context. The AI hallucinates an answer anyway because you didn't handle the edge case.
Instead: Detect when all results are below threshold. Return 'I don't have information on this' rather than letting the AI guess.
You've learned how to filter search results before they reach your AI. The natural next step is understanding how to reorder the results that make it through.