Skip to content
← All projects

Case study · Deployed on AWS · portfolio

Enterprise Advanced RAG

One question-answering system over documents and a SQL database, with governed query generation, human approval, nine guardrail checkpoints, and a release evaluated against a deliberately noisy corpus.

The problem

Most RAG demos stop at upload, embed, retrieve and answer. Real questions mix document knowledge with operational data, such as “How many P1 incidents breached SLA last month, and what is our escalation policy?” A useful system has to answer both halves, show its evidence, refuse unsafe operations, and prove its quality on more than a few hand-picked examples.

Architecture

  • Routing

    Each question is routed to document retrieval, Text-to-SQL, or a hybrid of both, and LangGraph orchestrates the chosen path.

  • Retrieval

    Dense, sparse and hybrid search with reranking, plus HyDE, corrective RAG and self-reflective RAG as conditional policies. Hybrid search with reranking proved the strongest default.

  • Governed SQL

    Generated SQL is parsed with sqlglot and only safe, read-only, single-statement queries are allowed. Execution pauses until a person approves it.

  • Guardrails

    Nine checkpoints: request validation, JWT auth, rate limits, token budgets, input restructuring, prompt-injection checks, moderation and redaction, isolated retrieved context, and output validation.

  • Caching and ingestion

    Five query-time cache tiers with saved-cost telemetry. Ingestion hashes each document so the same file is never indexed twice.

  • Deployment

    FastAPI services on AWS ECS Fargate behind load balancers, with RDS PostgreSQL, S3, Qdrant Cloud, Route 53, ACM, autoscaling and CloudWatch alarms.

How it was evaluated

Pull requests are blocked by deterministic checks that need no judge model: expected route, forbidden answers, forbidden sources, and exact source precision and recall. LLM-judged RAGAS metrics run at release. Holdout sets are checksummed and run once; after their results influence a change, they move into regression.

Corpus
363 sources: 49 authoritative documents and 314 noisy distractors
Vector points
34,420 chunks in Qdrant Cloud
Embedding model
text-embedding-3-small
Answer model
gpt-4o
LLM judge
gpt-4o-mini
Release
Cloud-v2, retrieval cache schema 52, evaluated July 12–13, 2026

Results

Metric40-question challenge12-question regression
Faithfulness0.9650.963
Context precision0.9920.965
Context recall0.9760.986
Answer relevancy0.9780.983
Source precision0.9751.000
Source recall0.9441.000
Forbidden-answer, forbidden-source and route violations00

Source: Cloud-v2 evaluation summary. The codebase also passes 178 automated tests in CI.

Known limitations

  • Two retrieval edge cases remain open by design rather than being tuned against a dataset that has already been seen. In one, retrieval can prefer a related but less specific source. In the other, an answer can be correct while citing only one of two expected sources.
  • LLM-judged scores vary from run to run. Some correct answers scored just under their per-question threshold and passed on a focused rerun; this is recorded as judge variance, not counted as a deterministic pass.
  • Prompt-injection, PII and output checks are mainly pattern-based. They are defensive checkpoints, not a complete security product.
  • The corpus is enterprise IT operations content, not scientific literature. The project demonstrates the retrieval, evaluation and governance approach used for scientific work.
  • This is a portfolio system deployed on AWS, not a client production deployment.

Need this level of evidence for your data?

We apply the same evaluation discipline to scientific and clinical systems.

Book a call