← all work

DocuMind AI — Grounded Multimodal Document Q&A at Scale

System design for a 1M-user document Q&A product: async multimodal ingestion, hybrid retrieval, a deterministic confidence gate that refuses instead of hallucinating, and hot/warm/cold session tiering.

role: System designer

View code ↗
1M
users designed for
5–10k
concurrent sessions
~21 GB
hot store (sized by concurrency)
~928 TB/yr
cold archive

Problem

~1M users upload mixed documents per session (50–60 page PDFs, Word docs, scanned payslips/bills) and ask questions that must be answered strictly from that content — "not found" is preferred over a wrong answer. Sessions resume up to a year later.

Architecture

Key decisions

  • Refusal is code, not a prompt. Below a retrieval-confidence threshold the LLM is skipped entirely and a deterministic "not found" + clearly labelled closest passage is returned — the accuracy guarantee doesn't depend on the model behaving.
  • Size hot storage by concurrency, not headcount. An early "5 warm sessions per user" estimate gave ~10.5 TB; sizing by 5–10k concurrent sessions × ~2.1 MB gives ~10.5–21 GB — a 500–1000× correction.
  • Retention policy — raw files discarded ~30 days after parsing; only text + embeddings kept → ~928 TB/yr instead of ~6.2 PB/yr.
  • Layout-aware multimodal ingestion for financial documents, with a shared multimodal embedding space so text queries retrieve image-derived chunks.
  • Replicas for availability, snapshots for recoverability — rebuilding the index is cheap in dollars but expensive in recovery time.

Capacity (per session ≈ 152 pages ≈ 99k tokens)

MetricValue
Chunks / session~283 (400-token chunks, 50 overlap)
Embeddings / session~1.7 MB (1536-dim)
Sessions / year~442M across 3 user cohorts

What I'd revisit

Confidence-threshold calibration needs an offline eval set of answerable vs. unanswerable questions; cold storage needs a deep-archive/deletion policy agreed with product & legal.

nearest neighbours