DEPLOYEDAI-era interview training
RankBootstrapping
XP 0 / 250
0
0%
Ready
AI System Design · Reliability, Safety & Observability · Lesson 3 of 3

Worked case study: HIPAA doc-QA over 50M records

10 min

Let's run the whole framework on one prompt: "Design a clinical document Q&A assistant. Staff ask natural-language questions and get cited answers over ~50M patient documents. It must be HIPAA-compliant." This ties every module together.

1. Clarify & assumptions

  • Users: clinicians; ~2,000 concurrent, ~50 QPS peak; interactive, target <2s TTFT.
  • Task: grounded Q&A with citations over PHI; wrong/unsourced answers are high-cost.
  • Data: 50M docs, growing; strict per-patient/role access control; HIPAA (BAA, audit, residency).

2. Success & evals

  • Primary: groundedness + citation correctness + retrieval recall@k on a clinician-labeled golden set.
  • Guardrails: p95 latency, cost/query, zero cross-patient leakage, refusal-when-unsure rate.

3. Architecture & AI core

AI core = RAG (grounded, citable, fresh) — not fine-tuning. Path: auth'd query → permission-filtered hybrid retrieval → rerank → grounded generation with citations → PHI-safe logging. Offline: ingestion/chunking/embedding with ACLs as metadata.

4. RAG at 50M scale, safely

  • ANN (HNSW) index, sharded by facility/tenant, replicated for QPS; metadata pre-filter by patient/role ACL so forbidden docs never enter candidates.
  • Hybrid search + cross-encoder rerank; recheck permissions on final chunks before the prompt.
  • Incremental indexing for new records; quantization to control memory at 50M vectors.

5. Production: cost, latency, safety, observability

  • Latency: stream tokens; cap output; tight retrieved-context budget for low TTFT.
  • Cost: route easy queries to a small model, escalate hard ones; prefix-cache the stable system prompt; tenant-scoped semantic cache.
  • Safety/PHI: retrieval-time ACLs, redact PII in logs, VPC deployment + BAA, audit log every access, treat retrieved notes as data (injection defense).
  • Reliability: timeouts, backoff retries, provider fallback, graceful "insufficient evidence" answer over guessing.
  • Observability: full tracing, offline evals gating deploys, online groundedness sampling + clinician thumbs feeding the feedback loop.

6. Tradeoffs (the close)

"I'm optimizing for groundedness and zero leakage over raw latency — reranking and permission rechecks add ~100-200ms I'm willing to pay in a clinical setting. If usage or cost spikes, I'd lean harder on caching and routing. I'd trust this once the golden-set groundedness and the leakage test both pass in CI."

Why this answer winsIt's structured (framework), quantified (QPS, latency, scale), safety-first (ACLs + HIPAA + injection), and honest about tradeoffs. That combination — not any single clever component — is what gets the hire.

◆ Lock it in

  • Run the full framework: clarify → evals → architecture/core → deep-dive → production → tradeoffs.
  • For private, cited, huge-corpus Q&A: RAG + hybrid/rerank + ANN sharding + retrieval-time ACLs.
  • Win on structure + quantification + safety + honest tradeoffs, not one clever component.
Feynman drill — say it out loudIn five sentences, deliver the whole design for HIPAA doc-QA over 50M records, hitting clarify, core, scale, safety, and tradeoff.
Step 1 rate your confidence · Step 2 pick your answer
In the HIPAA 50M-doc case study, what is the load-bearing design decision for compliance?
Step 1 — how sure are you?