UltraSafe AI needed answers pulled out of regulated healthcare documents: clinical PDFs where a dropped table row changes a dosage. I built the system that runs every document through six extraction engines in parallel, reconciles them by vote, and retrieves over the result in four stages: recall, reranking, knowledge-graph expansion and redundancy filtering.

  • 6Extraction engines reconciled by vote
  • <200Retrieval latency, in milliseconds
  • <2End-to-end latency, in seconds

The problem

Clinical PDFs do not parse cleanly. Scanned pages, multi-column layouts, tables that carry dosages, and abbreviations that change meaning between specialities each defeat a single extractor in a different way, and it fails quietly. Downstream, nothing can tell a sentence that was missed from one that was never written.

Semantic search alone is the wrong instrument. Dense embeddings blur the exact tokens clinicians search on, like a drug name, a contraindication or a numeric threshold, while keyword search misses the paraphrase. In a regulated setting the near-miss passage is worse than no passage, because it still reads like an answer.

The system I built

Seven extraction layers, three vector representations per chunk, four retrieval stages.

What it is made of

  • A seven-layer PDF extraction pipeline running six engines in parallel and reconciling them by vote, with OCR enhancement, coherence scoring and hierarchical chunking on the reconciled output.
  • A multi-vector embedding framework: dense medical embeddings for meaning, SPLADE sparse vectors for exact clinical terms, and ColBERT late interaction for fine matching, fused by weighted scoring over HNSW.
  • A four-stage retrieval pipeline: BM25 and semantic recall, cross-encoder reranking, expansion across a medical knowledge graph scored by PageRank, then redundancy filtering.
  • A production deployment on Kubernetes with Redis caching, a managed vector store and OpenTelemetry across the request path, with contraindication validation, dosage checks and abbreviation expansion built into the pipeline.

Five months, remote, as the applied AI engineer on the system. I built the extraction pipeline and its reconciliation layer, the multi-vector embedding framework, the four-stage retrieval path and the knowledge-graph integration behind it, and took the result into production with the caching, vector store and tracing around it. The medical validation runs inside the pipeline, not after the answer, because in this class of system the point of failure is always upstream.

Key decisions

Six extractors and a vote, not one good parser. The usual answer is to pick the strongest PDF parser and tune it hard: cheaper per page, one code path. Six engines cost six times the compute and made reconciliation the most intricate code in the system. What they buy is disagreement as a signal: where the engines diverge, the pipeline knows the page is hard instead of quietly emitting one engine's guess.

Three representations per chunk instead of one embedding. Every chunk is indexed dense, sparse and late-interaction, and the scores are fused behind approximate search. Indexing and storage multiply per document, and the fusion weights need calibrating. In exchange, an exact drug name the dense arm blurs is recovered by the sparse arm.

The outcome

The system went to production as Kubernetes services over more than two hundred clinical documents: retrieval under 200 ms and answers under 2 seconds, with contraindication validation, dosage checks and abbreviation expansion running alongside retrieval.