# From Notebook to Production: An Extraction Model You Could Trust Source: https://customlabs.io/case-studies/extraction-notebook-to-production/ Updated: 2026-11-30 Case studies June 30, 2026 · 7 min read · A mid-market healthtech [evals](https://customlabs.io/topics/evals-observability/) extraction [production](https://customlabs.io/topics/shipping-to-production/) healthtech 12% → 3% Field hallucination rate On a held-out sample of intake documents 8 wks Notebook → production -60% Manual review queue Only low-confidence extractions routed to a human ~1,200 Engineer-hours saved / yr vs. the manual re-keying baseline The client is anonymised, and these figures are not independently audited. ## At a glance The extraction pipeline. Only low-confidence fields go to a person. The eval harness checks every change. We ruled out - Wrapping the notebook code in an API as it was - A rules-based extractor Reference shape [Document extraction with a human review loop](https://customlabs.io/architectures/document-extraction-pipeline/) Key takeaways - On the long tail, the model did not fail loudly. It filled in a plausible value where the real one was unclear. The value looked as confident as a correct one. - Confidence gating sent only the uncertain field to a human reviewer. It did this when the model's confidence fell below a calibrated threshold. The whole document stayed in the pipeline. - The eval harness ran in CI on every change. The team saw a number for "is this update better or worse" before merging, and no longer found out after deployment. ## The problem A mid-market healthtech had built a model to pull structured fields out of clinical intake documents. The fields were patient demographics, referring provider, diagnosis codes and insurance details. The source was whatever a referring office sent: PDFs, faxes and scanned referral forms. In a data scientist’s notebook, on a clean sample of well-formatted documents, the model looked ready to ship. Accuracy on that sample was high. Clinical operations was already planning to retire the manual re-keying process the model would replace. Real intake traffic looked different from the notebook sample. Faxes came in skewed and at low resolution. Referral forms varied by sending office, and some used field labels the model had never seen. On that long tail, the model did not fail loudly. It filled in a plausible value where the real one was unclear or missing. A wrong diagnosis code or a swapped date of birth throws no error. It enters the clinical record and looks as confident as a correct value. Nobody had measured how often this happened, because there was no eval harness. There was only the one notebook sample that everyone had already seen. The documents also carried protected health information (PHI). The team could not send them to an external extraction API to buy time. Whatever they built had to keep PHI inside their own infrastructure. ## What we ruled out, and what we built The fastest option was to wrap the existing notebook code in an API and ship it as it was. We ruled it out. There was no eval harness, so nobody measured or managed the [hallucination](https://customlabs.io/glossary/hallucination/) rate on real traffic. With no regression safety net, a later model or prompt change could make the long tail worse. Nobody would know until a clinician found a wrong value. The other option was a rules-based extractor. It is deterministic and easy to audit, which appeals to a compliance-minded team. We ruled that out too. The fax-format long tail was too varied for hand-written rules. Each new referring office’s layout would need another round of rule-writing, and the rules would never catch up. We built a production extraction pipeline with three parts. First, an eval harness built from a labeled sample of real intake documents. The sample came from actual traffic: faxes, scans and edge-case layouts. Clinical operations labeled each document by hand with the correct field values. This sample became the yardstick for every later change. A prompt tweak, a model swap or a preprocessing fix was measured against the same held-out set before it touched production. Second, confidence gating on every extracted field. When the model’s confidence on a field fell below a calibrated threshold, that field went to a human reviewer. The whole document did not. Third, we kept every document and every model call inside the healthtech’s own VPC. No PHI left their infrastructure to reach an external API. The extraction model ran on infrastructure they controlled. This mattered to their security team as much as the accuracy numbers did. The eval harness ran in CI on every change, the same way a test suite gates a code change. The question “is this update better or worse” used to get an eyeball check after deployment. Now it got a number that the team saw before merging. ## The outcome The field-level hallucination rate on the held-out real-document sample dropped from 12% to 3%. Most of the gain came from seeing where the model was wrong and gating on that. The underlying model mattered less. The confidence threshold caught the fields the model was unsure about. The eval harness caught the changes that would have made things worse, before they shipped. The system went from notebook to production traffic in eight weeks. Only low-confidence fields went to a human, so the manual review queue shrank 60% against the fully manual re-keying process it replaced. A human still reviewed the cases where the model’s own confidence said a review was needed. Clinical operations put the saved re-keying work at roughly 1,200 engineer-hours a year, which they freed up for other intake work. For the CFO, the math is simple. Set the engineer-hours saved against the manual re-keying baseline, then set that against the eight-week build cost. Payback falls inside a single quarter. The number comes from a documented, repeatable eval process. It does not rest on a black-box accuracy claim. The finance team could walk through it with clinical operations. For IT and security, PHI staying inside the VPC mattered as much as the accuracy gain. The pipeline fit into the existing EHR intake flow. It needed no new external data-sharing agreement and no new HIPAA risk assessment, because no new external party touched the data. For operations, confidence gating plus an [eval suite](https://customlabs.io/glossary/eval-suite/) in CI means a failure degrades in steps and stays visible. The eval harness catches a bad model update before it reaches production. A human reviewer catches the residual 3% of uncertain extractions before they enter the clinical record. Nobody has to find a wrong code downstream. The Head of Clinical Operations said the win was a model that the team could finally measure. For the first time, they could see when the model was wrong, at the field level, on real documents. That turned a notebook demo into something the clinical intake process could depend on. > “The difference wasn't a better model. It was finally being able to measure when the model was wrong.” Head of Clinical Operations Related services [Custom Development](https://customlabs.io/services/custom-development/) [AI Integrations](https://customlabs.io/services/ai-integrations/) A model that fails with no alert is worse than one that fails loudly. A Ship Audit checks whether your extraction feature has a calibrated confidence threshold. It also checks for the eval harness that cut this hallucination rate from 12 percent to 3. [Book a Ship Audit →](https://customlabs.io/diagnostic/ship-audit/) [Read the Eval Stack →](https://customlabs.io/evals/) Written by [CustomLabs Engineering](https://customlabs.io) Agentic AI engineering team CustomLabs is a small, senior-only studio that embeds with client teams. It ships eval-tested, model-agnostic AI systems into production in weeks. Every insight reflects work and lessons from the studio's own engagements — the people who write the code write the words. Our products [CodeHerder](https://codeherder.com) [CostMon](https://costmon.com) [FreeTier](https://freetier.co) [GreatAPIs](https://greatapis.com) [Beemy](https://beemy.co) [CustomHosted](https://customhosted.com) Read next July 7, 2026 · 7 min read ### [The AI-Native Target That Wasn't: A Two-Week Diligence](https://customlabs.io/case-studies/ai-diligence-flagged-replatform-cost/) A growth-equity firm's term sheet on an 'AI-native' SaaS target got repriced after a two-week check found $1.4M of hidden re-platform cost. diligence readiness due-diligence architecture Read → June 16, 2026 · 7 min read ### [Cutting Inference Spend 40% Without Betting on One Vendor](https://customlabs.io/case-studies/model-agnostic-routing-cut-inference-spend/) A Series B fintech's LLM spend outran revenue on one provider. Model-agnostic routing cut unit cost and vendor risk, and closed a data-residency gap. architecture cost model-agnostic routing Read → May 12, 2026 · 6 min read ### [A Retrieval Pipeline That Cut Support Load](https://customlabs.io/case-studies/retrieval-pipeline-cut-support-load/) A SaaS support platform replaced a keyword search widget with a tenant-isolated retrieval pipeline. Escalations and response time fell with no new headcount. retrieval support ai-integrations Read →