EY
EY India AI

Staff Responsible AI & Compliance Architect • ₹25 LPA – ₹56 LPA

Responsible AI & Governance RAGWith-AI Coding Allowed

Codebase 3: Enterprise Policy RAG & Salary-Leak Audit

Inspect a company HR & Policy RAG chatbot over Leave Policy Markdown and Payroll JSON. Trigger both real-world failures: (1) hallucinating intern leave carry-forward rules from cut tables, and (2) leaking Priya Sharma's confidential salary to interns due to missing RBAC pre-filtering + bloated FP64 linear scan.

System Design Perspective

Compliance Guardrails & Vector Audits

Before You Start (EY India AI)

Inspect `rag_engine.py` in Codebase 3 to fix ungrounded prompts, salary leakage, and unquantized vector bloat.

Download & Run LocallyDownload .zip
Runtime: Python 3.9+ (Pure stdlib — zero pip install required)
unzip enterprise-policy-rag.zip
cd enterprise-policy-rag
python app.py
# Open http://localhost:8100, keep Role = intern, and click Test 1 & Test 2!
VECTOR_DIM = 256  # Unnormalized FP64 dense list -> bloated memory!

# BUG 1: Fixed 180-char slicing breaks Markdown leave tables mid-row!
for i in range(0, len(raw), 180):
    self.chunks.append({"source": "hr_leave_policy.md", "access_role": "all", "text": raw[i:i+180]})

# BUG 2: Confidential payroll JSON embedded into SAME flat index!
for rec in records:
    self.chunks.append({
        "source": "payroll_confidential.json",
        "access_role": rec["required_access_role"], # NEVER checked in retrieve()!
        "text": f"Employee {rec['name']} earns annual CTC INR {rec['annual_ctc_inr']}..."
    })