Session 1 of 15 · System design

Private RAG for Healthcare

Prompt

"A healthcare organization with 50M documents wants a private AI search system for their clinical staff. They have HIPAA constraints, on-prem infrastructure preferences, and their data is in 12 different source systems. Design it."

This tests system design — and whether you reach for the FDE answer structure: scope the customer first, then a week-one walking skeleton, then production hardening, then trade-offs and rollout. Traps: jumping straight to a perfect architecture, and forgetting trust boundaries, evals, and cost.

Attempt first

Whiteboard your answer — scope → skeleton → production → trade-offs → rollout — before opening the worked solution. Then ask the AI panel to interrogate your assumptions.

Worked solution (open after attempting)

1. Scope — start with the customer, not the tech

  • Users: 5,000 clinicians, ~20 queries/day → 100K queries/day.
  • What's broken: 4–5 minutes hunting for a clinical guideline manually.
  • Success metric (agreed with the customer): the right clinical guideline in under 30 seconds.
  • Regulations: HIPAA → PHI never leaves their environment, audit logging mandatory, any cloud provider needs a BAA.
  • Constraints: on-prem preferred (or VPC with BAA), no data leaves their region.
  • Data: 50M documents across 12 source systems — EMR, claims, policies, guidelines, labs, imaging, discharge summaries.

2. Walking skeleton — week one

One source system only: clinical guidelines (highest value, cleanest data). ~10K documents → chunk → embed with an open-source model on-prem → vector store → simple search UI → LLM answer with citations. Deploy on their existing Kubernetes cluster. Five pilot clinicians, qualitative feedback. Goal: one "oh, this is useful" moment.

3. Production architecture

Data pipeline: 12 sources → per-system connectors → text extraction + OCR → PHI detection and de-identification before any processing → structure-aware chunking → self-hosted embeddings → on-prem Elasticsearch. Every document carries metadata: source, type, department, date, access level. Incremental sync every 6 hours; full re-index weekly off-hours.

Retrieval + generation: query → hybrid search (BM25 + vector, RRF fusion) → access-control filter before reranking → cross-encoder reranker (50 → 5–8) → LLM (self-hosted Llama 3 70B, or Azure OpenAI with BAA) → output guardrails (PHI scan, hallucination check) → cited response. Latency budget: <5s p99.

Evaluation: offline golden set of 500 clinical questions (recall@5, faithfulness) — run before every deployment, block on regression. Online: thumbs up/down + "wrong source" flag → weekly review → failures become new golden-set entries. Compliance: every query/response logged (HIPAA audit trail, 7-year retention).

Security: SSO via their IdP, department-level RBAC, TLS + AES-256, PHI de-identified before embedding and re-identified only at response time for authorized users, no external egress.

4. Capacity and cost — the business-value close

  • Embed 50M docs × ~500 tokens ≈ 7,000 GPU-hours ≈ ~$14K one-time.
  • Storage ≈ 2TB → 3-node Elasticsearch cluster is comfortable.
  • Inference at 100K queries/day: $15–30K/month operating cost.
  • ROI: $150/hr clinician time × 4 min saved × 100K queries ≈ ~$1M/month. That sentence is what makes the VP say yes.

5. Trade-offs, stated as judgments

  • Self-hosted LLM vs cloud API with BAA: self-hosted = full data control, higher upfront cost and ops burden. Recommendation: cloud API + BAA for deployment speed; re-evaluate self-hosting at 3 months.
  • Single embedding model vs hybrid retrieval: clinical queries are full of ICD-10/CPT codes that embeddings garble. Recommendation: hybrid from day one.

6. Rollout

5 users → 50 → 500 → all. Train their team, write runbooks, joint on-call initially, then hand off operations.

What separates a staff-level answer

  • The metric and the $1M/month ROI come before the architecture.
  • The ACL filter sits before the reranker — auth is structural, not bolted on.
  • PHI is stripped before embedding, not just at output.
  • Eval is a deployment gate, not an afterthought.
  • Every trade-off ships with a "revisit when" date.

Rapid-fire

60s

Why hybrid retrieval here instead of pure vector?

60s

What changes if the customer insists on fully air-gapped, no cloud at all?

60s

A 13th source system arrives mid-engagement. What breaks?

60s

What does the "wrong source" flag teach you that thumbs-down doesn't?

60s

Estimate the embedding cost again, but for 200M documents.

Explore with your LLM

  • Ask the panel to challenge your ACL-before-rerank decision — when would you do it differently?
  • Have it re-scope this design for a bank (FINRA instead of HIPAA) and spot what changes.
  • Ask what a walking skeleton looks like if you only get 3 days, not a week.

Senior signal: lead with the customer's metric and the money. Architecture without a business case is a hobby project.

← PreviousThe 15-session sequence Next →FDE prep hub