Back to all work
Sovereign AI & document intelligence

CARAG — Compliance-Aware RAG over a 1.2M-document enterprise corpus

EU enterprise · 2025–2026 · production RAG build + research paper

RAGComplianceHNSWAudit logRead the CARAG paper

Problem

An enterprise client needed retrieval-augmented generation over a 1.2M-document internal corpus where retrieval-time eligibility — who is allowed to see what, for which purpose — matters as much as relevance. Off-the-shelf RAG breaks here: the most relevant passage may be the most legally inadmissible.

Approach

Built a five-stage architecture treating compliance as a first-class property of the index, retriever, generator, and audit log. Each chunk carries a 27-bit policy bitmask packed in a single 32-bit word. Bitwise admissibility checks evaluated inside the HNSW inner loop, before the result heap updates. Generator gets admissible and inadmissible buckets explicitly separated, with a refusal head when no admissible evidence exists. Every query commits a Merkle-anchored audit log sufficient for Article 12 of the EU AI Act.

Stack

Qdrant with custom HNSW patches · FastAPI · Claude / GPT-4 · Python audit-log substrate

Outcome

Sub-300 ms p95 retrieval latency on a 2.5M-node graph. Production-grade compliance posture, audit-defensible by design. The architecture was independently validated on a public 26,595-chunk benchmark from real SEC EDGAR filings — published as a working draft, demonstrating the same architecture cuts constraint violations from 81.12% to 0.00% and output disclosures from 21.29% to 0.00% at a 4.8 F1 cost.

Want a similar engagement on your stack?

Most engagements like this started with a 60-minute scoping call.

More work

Aru Bhardwaj

Fractional CTO architecting sovereign AI systems for startups and scale-ups across Europe. Custom ML, agentic RAG, and secure LLM infrastructure. 7+ years turning complex data into production intelligence.

Malt
Upwork

Contact

Services

  • Fractional CTO & AI Strategy
  • MVP Development & Rapid Prototyping
  • Sovereign LLM Deployment (OVHcloud, Scaleway)
  • Multi-Cloud AI (AWS Bedrock, Vertex AI, Azure)
  • RAG Pipelines & Autonomous Agents
  • GDPR & EU AI Act Compliance
  • Generative AI & Prompt Engineering
  • Machine Learning & Predictive Analytics

Monthly playbook

Practical AI essays for founders and tech leaders. One email a month.

Tactical AI essays, monthly.

© 2026 Insightrix SASU. All rights reserved.Aru Bhardwaj, Fractional CTO & AI Strategist

60 Rue François Ier, 75008 Paris, France · SIRET 989 236 856 00013 · TVA FR42989236856