BXUP Track progress & test yourself — free
Forward Deployed AI Engineer · Hands-on lab · ~1 min read
FORWARD DEPLOYED AI ENGINEER · HANDS-ON LAB

Lab 02 · Multi-Tenant Hybrid Vector Retrieval with RRF Ranking

Construct a dual-channel retrieval engine combining BM25 exact keyword matching and dense vector embeddings, fused via Reciprocal Rank Fusion (RRF), while enforcing cryptographic multi-tenant metadata isolation.

Time & Tier

~120 minutes hands-on · FDE Track, Core Production difficulty.

The Scenario

A legal tech client complains that their pure vector search misses exact statutory clause references (e.g. Section 43A) and accidentally leaks confidential documents between subsidiary tenants. You will stand up a Qdrant vector store and implement an RRF hybrid search pipeline with mandatory tenant pre-filters.

Deliverables

  1. hybrid_search.py: Hybrid search engine combining BM25 and vector embeddings.
  2. rrf_fusion.py: Mathematical Reciprocal Rank Fusion blending logic.
  3. benchmark.py: Test harness proving 100% tenant isolation and >90% recall@5.

Step-by-Step Instructions

  1. Install Dependencies:

    pip install qdrant-client==1.9.1 rank-bm25==0.2.2 numpy==1.26.4
    
  2. Implement Reciprocal Rank Fusion (RRF): Write the mathematical rank fusion function that takes ranked IDs from BM25 and vector search, calculates $1 / (60 + \text{rank})$, and sorts descending.

  3. Enforce Tenant Isolation: In hybrid_search.py, ensure that every Qdrant query filter contains a mandatory {"key": "tenant_id", "match": {"value": authenticated_tenant}}.

  4. Verify It Works: Execute 50 cross-tenant adversarial queries. Assert that zero results from Tenant B ever appear in searches initiated by Tenant A.

This is the free reading view. Open BXUP to track your progress, run the hands-on labs, and prove it with original, exam-pattern assessments.
© Anvi Innovate · BXUP — Be Exponentially Upskilled · BXUP is an independent learning platform, not affiliated with or endorsed by AWS, Microsoft, Google, NVIDIA, IBM, Salesforce, Databricks, Oracle or Anthropic. All trademarks belong to their respective owners. · bxup.in