Did Your Search Find All the Big Evidence? Testing Retrieval Completeness
High semantic similarity scores are deceitful: they can be 0.95 while leaving out the pivotal paragraph that changes everything. Here is how to audit retrieval completeness.
The Reality Check
Are you running RAG evaluations without testing whether key evidence was fetched in the first place? If search missed the primary evidence, no prompt engineering on earth will save your answer.
The Illusion of High Retrieval Scores
Teams often celebrate because their vector database returned 5 chunks with high cosine similarity. But if the single most definitive document was ranked #6 or filtered out by chunking boundaries, your system fails silently.
Real-World Scenario
"In an insurance claim appraisal RAG, an adjuster asks whether water damage from roof leaks is covered. The system retrieves 4 chunks describing general water damage coverage, but misses the crucial policy rider exclusion for deferred roof maintenance. The insurer erroneously approves a $30,000 ineligible claim."
The Hidden Costs of Leaving This Unchecked:
- False sense of security from high vector similarity metrics that ignore recall.
- Costly downstream errors in legal, insurance, medical, and mission-critical workflows.
- Endless prompt engineering cycles when the actual defect is in search recall.
Guaranteed Evidence Retrieval for Critical Workflows
Retrieval Completeness tests whether search successfully brought back all core pieces of evidence needed for an authoritative verdict.
Prevented
Missing policy exclusions, critical riders, and safety prerequisites.
Prevented
Under-retrieval caused by improper chunk sizes or poor embedding models.
Prevented
Silent regression after rebuilding search indices or upgrading embedding versions.
Add RetrievalCompleteness to Your CI/CD & Regression Suite
Run golden benchmark evaluations with RetrievalCompleteness in your test pipeline (`pytest`). Whenever someone tweaks chunk size, overlap, embedding models, or reranking weights, verify that all core evidence continues to be retrieved.
04 · Value Proposition
The LayaEval Advantage
Advantage 01
Native CI/CD Integration
Simple python assertion: `assert result.passed` in your GitHub Actions or GitLab pipelines.
Advantage 02
Sub-10ms Speed
Run 500 regression test cases in seconds, not hours.
Advantage 03
Clear Pass/Fail Criteria
Passes when nothing big is missing; fails immediately when key evidence is absent.
Run This Check in 4 Lines of Python
By including the exclusion clause in the retrieved context, the check passes with flying colors, guaranteeing your system will not overlook crucial exclusions.
1import pytest2from layaeval import RetrievalCompleteness3
4evaluator = RetrievalCompleteness(threshold=3.0)5
6def test_water_damage_claim_retrieval():7 query = "Is interior ceiling damage from a neglected roof leak covered?"8 9 # Simulate your retrieval pipeline output10 retrieved_chunks = (11 "Section 4: Water damage from sudden burst pipes is fully covered. "12 "Section 9.2 Exclusion: Water penetration resulting from lack of normal "13 "roof maintenance, aging shingles, or deferred repairs is explicitly excluded."14 )15 16 result = evaluator(query=query, retrieved_context=retrieved_chunks)17 18 # Assert in CI/CD pipeline19 assert result.passed, f"Retrieval failed completeness: {result.value}/5.0"20 print(f"Completeness verified! Score: {result.value}")API Payload & Evaluation Response
Automate retrieval quality audits via API in your data ingestion pipelines:
Request (cURL / POST)
1curl -X POST https://api.yourdomain.com/v1/eval/retrieval-completeness \2 -H "Content-Type: application/json" \3 -d '{4 "query": "Is interior ceiling damage from a neglected roof leak covered?",5 "retrieved_context": "Section 4: Water damage... Section 9.2 Exclusion..."6 }'Instant Sub-10ms JSON Response
1{2 "metric": "RetrievalCompleteness",3 "passed": true,4 "score": 4.9,5 "threshold": 3.0,6 "confidence": 0.97,7 "evidence_complete": true8}- 1Create a golden dataset of your 50 most critical business queries.
- 2Run RetrievalCompleteness in CI on every knowledge base deployment.
- 3Never deploy a new embedding model without benchmarking against this check.
Interactive Playground
Test Retrieval Completeness in our visual demo
Tweak query and context sliders to see live pass/fail scoring in real time.
Continue Reading