Inspiration

Enterprise compliance auditing for frameworks like PCI-DSS and the DPDP Act is notoriously slow, heavily manual, and prone to catastrophic human error. Legal and security teams spend hours reviewing dense, multi-page vendor agreements, searching for tiny clauses that violate strict data privacy regulations. We were inspired to build AuditRag—an automated, AI-driven compliance engine—to replace this manual fatigue with instant, hallucination-free legal reasoning. We wanted to prove that with a finely tuned RAG architecture, we could detect deeply hidden adversarial compliance violations (like prohibited CVV storage or missing verifiable consent) in seconds rather than days.

What it does

AuditRag is an automated compliance evaluation platform. Users simply upload a technical policy or vendor agreement (PDF) into our React dashboard and query it against specific regulatory frameworks. Behind the scenes, our AI engine ingests the document, cross-references it against a vectorized statutory rulebook, and instantly flags hidden adversarial violations—such as illegal post-authorization CVV storage or missing verifiable user consent. In under 25 seconds, it returns a strict audit report displaying a definitive "Pass/Fail" verdict, exact rulebook citations, and a 100% faithful explanation of the violation without hallucinating legal advice.

How we built it

AuditRag is built on a full-stack architecture optimized for high-speed document retrieval and evaluation.Backend: We developed a robust FastAPI server to orchestrate the ingestion and auditing pipelines.RAG Pipeline & AI: We utilized LlamaIndex to process legal documents and rulebooks, storing the vector embeddings in a cloud-hosted Qdrant database. Our core reasoning engine is powered by Gemini 3.8 Flash, with an environment-driven fallback to Groq's Llama-3.3-70B-versatile to guarantee uptime.Frontend: A responsive React dashboard that visualizes the audit results, displaying clear "Pass/Fail" verdicts alongside exact statutory citations.To ensure our semantic search accurately matched complex legal claims against document chunks, we optimized the vector similarity search using standard cosine similarity. Given a query vector $Q$ and a document chunk vector $D$, the similarity score is computed as:$$\text{similarity}(Q, D) = \frac{Q \cdot D}{\Vert{}Q\Vert{} \Vert{}D\Vert{}} = \frac{\sum_{i=1}^{n} Q_i D_i}{\sqrt{\sum_{i=1}^{n} Q_i^2} \sqrt{\sum_{i=1}^{n} D_i^2}}$$By coupling this with a precision reranker, we achieved ~380ms reranking latency, ensuring the LLM only received the most relevant legal context.

Challenges we ran into

The "Giant Chunk" Blindspot: Initially, our pipeline failed to detect violations hidden on page 2 of our adversarial test PDF. We discovered the extraction engine was ingesting 4-page PDFs as a single, massive vector chunk, causing the embedding model to silently truncate the text. We resolved this by explicitly injecting a SentenceSplitter (configured with chunk_size=512 and chunk_overlap=50), which successfully mapped the document across 15+ distinct nodes.

API Rate Limits and Quota Exhaustion: While testing concurrent RAG queries, we hit hard 429 rate limits and 24-hour lockouts on the Gemini 3.1 Pro free tier. We engineered our way out of this by migrating to the high-throughput Gemini 3.8 Flash model and writing an agile, multi-LLM fallback configuration in our backend to route traffic to Groq when primary quotas were exhausted.

The Keyword Trap: Early versions of our retriever suffered from "context blindness"—it would fetch PCI-DSS statutory definitions based on keyword overlap but completely miss the uploaded target document. We solved this by wrapping queries in LlamaIndex QueryBundle objects, increasing our similarity_top_k threshold, and writing debug loops to strictly verify the payload text being fed to the LLM.

Accomplishments that we're proud of

24.4s Review Latency: We successfully reduced the time it takes to audit a multi-page enterprise vendor policy from several hours to under 25 seconds.

100% Faithfulness Score: Our system does not hallucinate legal advice. By tightening our context recall and enforcing strict JSON output schemas on the LLM, every violation flagged by AuditRag is grounded directly in the provided text.

Zero-Cost Deployment: We successfully architected a production-ready system utilizing entirely free-tier, zero-cost cloud hosting—combining Vercel for the frontend, Koyeb/Render for the FastAPI backend, and Qdrant Cloud for the vector database.

What we learned

We gained hands-on, first-principles experience in architecting RAG pipelines from scratch. We learned that the secret to a successful LLM application isn't just picking the smartest model, but obsessing over the data ingestion strategy. Mastering document chunking, optimizing vector payload extraction, and handling cross-origin resource sharing (CORS) across distributed cloud deployments transformed our theoretical knowledge into practical, production-level engineering skills.

What's next for AuditRAG

Our immediate next step is expanding our vector rulebook to support localized frameworks like the EU's GDPR and California's CCPA. We also plan to integrate a document generation feature that not only flags compliance violations but automatically drafts a remediated, legally compliant version of the uploaded document for direct download.

Built With

Share this project:

Updates

Submission history