Cloud AI Evaluation & Azure AI Foundry QE Β· Day 4 Β· 25 min
Hybrid Vector Search & RAG Assurance
Cloud AI Evaluation & Azure AI Foundry QE β Day 4
Validate BM25 + dense cosine hybrid retrieval with Reciprocal Rank Fusion (RRF), Recall@K / MRR / NDCG@K metrics, index freshness SLAs, and document-level ACL/RBAC filtering.
About this lab
Even the best LLM hallucinates if retrieval misses critical policy chunks, serves stale fee schedules, or leaks restricted executive documents to support agents. Today you will test BM25 + cosine hybrid search with RRF, compute Recall@K, MRR, and NDCG@K, enforce freshness SLAs, and verify zero ACL leaks.
π¦Sample Codebase & Working Solution (Day 4)Available Now
View on GitHubThe official reference codebase for Day 4 is hosted in the repository. Clone the repository and navigate to day-4-hybrid-vector-rag/test_hybrid_rag.py to run the working solution.
Git Clone β Working Solution
git clone https://github.com/777abhi/cloud-ai-eval-roadmap.git
cd cloud-ai-eval-roadmap/day-4-hybrid-vector-rag/test_hybrid_rag.pyπProduction Context & Enterprise Implementation
π‘ Why We Are Doing This: Enterprise RAG indices aggregate documents across security tiers; without pre-retrieval ACL filtering, vector similarity will surface confidential chunks into LLM prompts.
π’ Real-World Production Usecase: Quality and security verification for Azure AI Search hybrid indices powering regulated customer support.
βοΈ How Implemented in Production: HybridSearchIndex filters by allowed_roles before fusing BM25 and dense cosine rankings via RRF; check_index_freshness flags chunks older than SLA.
Phase 1
Run Hybrid RAG Retrieval & ACL Security Tests
Step 1.1: Execute Day 4 Suite
Terminal β Day 4 Lab
npm run test:day4Step 1.2: ACL-Filtered Hybrid RRF Search
cloudaieval/rag.py
results = index.hybrid_search_rrf(
query="billing disputes unauthorized chargebacks",
query_embedding=(0.94, 0.18, 0.05, 0.0),
user_roles=("support_agent",),
top_k=3,
)Day 4 Key Learnings
- Combined lexical BM25 and dense cosine similarity using Reciprocal Rank Fusion (RRF).
- Measured retrieval quality with Recall@K, Mean Reciprocal Rank (MRR), and NDCG@K.
- Enforced document-level ACL/RBAC filtering so restricted chunks never enter unauthorized prompts.
π§ Knowledge Check
Where must document-level ACL/RBAC filtering be enforced in an enterprise RAG pipeline?