Routing documents between GPU and CPU OCR: what cost-per-element taught me
CPU vs. GPU OCR: How We Cut Document Processing Costs by 62%
The question I was handed sounded simple: should the document pipeline run OCR on GPUs or on CPUs?
The pipeline takes scanned documents for a US health-insurance client, turns pages into text, and feeds that text to extraction models downstream. Volume is large, every page carries protected health information (PHI), and there is a turnaround SLA.
The first answer everyone reaches for is throughput: pages per second per machine. GPU wins that contest easily, so the pipeline had been sending everything to a GPU OCR service.
The bill said we were wrong about something.
Throughput is the wrong axis
Pages per second tells you how fast a machine goes when it is busy. It does not tell you what a page costs, because that depends on how busy the machine is, how much of each page actually needs the expensive model, and what happens to the pages the model gets wrong.
So the benchmark I ran measured two things per OCR service, using the same 50,000-page evaluation sample:
- Cost per element. An element is the unit downstream cares about: a page, or a form field, depending on the document class. Cost is the fully loaded compute price of producing it, including idle time, retries, and the fallback path when confidence is low.
- Turnaround time. Not latency per page, but how long a document takes end to end at our actual arrival pattern, measured at the p95.
Two services went into the comparison: a GPU deployment of DocTR and a CPU deployment of LightOnOCR. Both run inside our own network.
Hosted OCR APIs were off the table from the start because of PHI. The data cannot leave our private network boundary, so the options were services we could operate ourselves.
The figures below are illustrative, representative production-style numbers rather than verified measurements from an actual deployment.
The baseline
Before routing, every page went through the GPU OCR service. The service was provisioned to handle peak intake, which meant paying for accelerator capacity even when the incoming documents were easy to recognize.
The baseline looked like this:
| Metric | GPU-only baseline |
|---|---|
| Monthly volume | 1,200,000 pages |
| Average daily volume | 40,000 pages |
| OCR compute cost per month | $18,400 |
| OCR compute cost per 1,000 pages | $15.33 |
| End-to-end p50 turnaround | 2.1 minutes |
| End-to-end p95 turnaround | 8.4 minutes |
| Downstream extraction accuracy | 97.2% |
The problem was not that GPU OCR performed poorly. It was that we were paying GPU prices for clean, machine-printed pages that did not need that much compute.
Classify, then route
Once the data said the page decides, the design followed. We put a lightweight classifier in front of OCR. It looks at page-level signals that are fast to compute: resolution, skew, a quick text-density estimate, and document class from intake metadata.
Each page is assigned to one of two lanes.
The initial routing policy sent approximately 78% of pages directly to CPU OCR and 22% directly to GPU OCR. Of all pages, another 6% were sent to the GPU after a low-confidence CPU result. That meant approximately 28% of total pages ultimately required GPU processing.
Why the fallback matters
The CPU lane is allowed to be wrong, as long as it can recognize when its output is unreliable.
Every CPU result carries a confidence score. If that score falls below a threshold, the page is re-queued onto the GPU lane. The downstream extraction stage also checks required fields and structural consistency, so confidence is not the only safeguard.
The fallback is what let us route aggressively. Without it, the classifier would have needed to be nearly perfect, and classifiers that need to be nearly perfect are expensive to build and expensive to trust.
We selected the confidence threshold using a held-out evaluation set rather than optimizing it against live traffic. The target was to preserve downstream extraction quality while reducing GPU utilization.
What happened to the numbers
Compute cost for the OCR stage dropped by approximately 61.8%, from $18,400 to $7,030 per month, on a workload of 1.2 million pages.
The p95 turnaround did not regress. It moved from 8.4 minutes to 8.2 minutes.
Those two facts together are the whole point: the SLA is set by the slow path, and the slow path—difficult pages on GPU—was unchanged. We only stopped paying GPU prices for pages that never needed them.
The comparison looked like this:
| Metric | GPU-only baseline | Classified routing |
|---|---|---|
| Monthly pages processed | 1,200,000 | 1,200,000 |
| Pages initially routed to CPU | 0% | 78% |
| Pages initially routed to GPU | 100% | 22% |
| Pages falling back from CPU to GPU | N/A | 6% of all pages |
| Pages ultimately processed by GPU | 100% | Approximately 28% |
| OCR compute cost per 1,000 pages | $15.33 | $5.86 |
| Monthly OCR compute cost | $18,400 | $7,030 |
| End-to-end p50 turnaround | 2.1 minutes | 1.9 minutes |
| End-to-end p95 turnaround | 8.4 minutes | 8.2 minutes |
| Downstream extraction accuracy | 97.2% | 97.2% |
The cost-per-1,000-page figures include provisioned compute, idle capacity, retries, and fallback processing. They exclude shared storage and downstream extraction costs, which are assumed to be unchanged between configurations.
The accuracy figure is an illustrative aggregate metric from a hypothetical evaluation. In a real deployment, it would need to be verified on the same labeled test set, with separate reporting for high-risk fields such as member IDs, dates of birth, claim amounts, and diagnosis codes.
The cost breakdown
The monthly cost difference becomes easier to understand when broken down by service.
| Cost component | GPU-only baseline | Classified routing |
|---|---|---|
| GPU OCR capacity | $18,400 | $5,600 |
| CPU OCR capacity | $0 | $1,050 |
| Retry and fallback overhead | Included above | $380 |
| Total | $18,400 | $7,030 |
These are illustrative allocated compute costs, not vendor quotes. They assume reserved or provisioned capacity sized for the actual workload, including idle time and headroom. The cost of the classifier is assumed to be included in the CPU allocation.
The second-order effects
A few secondary effects were worth more than I expected.
- The GPU queue got shorter. GPU utilization during peak intake fell from an illustrative 86% to 64%. Hard pages waited less because clean pages no longer competed for the same accelerator capacity.
- Retries became cheaper. CPU retries and transient failures stopped being a capacity-planning problem. The fallback path added approximately $380 per month in allocated retry and fallback overhead, already included in the routed configuration's total cost.
- The classifier became a measurement tool. Its decisions, joined with the fallback rate, showed how the document mix was shifting month to month. In this example, 6% of all pages required GPU fallback, with the rate varying from 3.1% for clean, digitally generated forms to 14.7% for degraded scans and fax-heavy batches.
- Capacity planning became more predictable. Rather than estimating GPU capacity from total incoming volume, we could estimate it from the proportion of difficult pages and the observed fallback rate.
That last point matters for health-insurance workflows. Document mix can change substantially between routine enrollment periods and claim-processing peaks. A shift toward low-quality scans or faxed correspondence can increase the fraction of pages that require GPU processing, even if total page volume stays flat.
Monitoring the route distribution gives us an early warning before that change shows up as a larger compute bill or a deteriorating turnaround SLA.
Accuracy is a constraint, not a footnote
There is an important caveat to the comparison: DocTR and LightOnOCR are different OCR systems, not the same model running on different hardware.
That means this benchmark compares two service configurations, including model quality, infrastructure utilization, confidence behavior, and fallback cost. It does not isolate the causal effect of CPU versus GPU hardware.
For a production evaluation, I would measure at least three separate outcomes:
- OCR quality: character error rate, word error rate, and layout preservation against manually transcribed pages.
- Extraction quality: exact-match accuracy for important fields, with separate reporting for identifiers, dates, financial amounts, and clinical codes.
- Operational performance: cost per page, p50 and p95 turnaround, fallback rate, queue depth, and retry rate at the actual arrival pattern.
Aggregate accuracy alone can hide serious problems. An OCR system could achieve nearly identical average performance while making more errors on precisely the fields that matter most to a claims workflow.
For that reason, the routing threshold should be selected against predefined quality requirements, with a held-out sample and explicit acceptance criteria. It should not be tuned solely to maximize the number of pages sent to CPU.
PHI and operational boundaries
Because the pipeline handles protected health information, the architecture also needs to preserve the original data-handling constraints.
Both OCR services run inside the approved private environment. Document images and extracted text are not sent to external OCR APIs. Logs contain operational metadata rather than raw document text, and access to diagnostic samples is restricted to authorized personnel.
The classifier itself does not need to retain document content. It can make its routing decision from page-level features and intake metadata, while the orchestration layer records the route, confidence result, fallback outcome, and processing duration.
That makes the system easier to audit without creating another copy of sensitive information just to understand why a page was processed on a particular service.
What I would do differently
I would have instrumented cost per element from day one instead of inferring it afterward from invoices and queue metrics.
I would also have established the confidence threshold using a held-out set before enabling routing in production. Tuning against live traffic can make the first week noisy, particularly when difficult documents are underrepresented in the evaluation sample.
Finally, I would have separated model comparisons from hardware comparisons. Benchmarking two different OCR systems is useful for choosing the cheapest service configuration that meets the quality requirements, but it cannot tell you whether the difference comes from the model architecture, the hardware, or both.
Those are different questions, and the experiment should make clear which one it answers.
The rule I keep
When comparing two ways to process a stream of things, ask what one thing costs and how long one thing waits, at the real arrival rate.
Throughput per machine is an answer to a question nobody downstream is asking.
The right service is not necessarily the one that processes the most pages per second. It is the one that meets the quality and turnaround requirements at the lowest fully loaded cost.
For this illustrative workload, that meant routing clean pages to CPU OCR, reserving GPU capacity for the pages that needed it, and using confidence-based fallback to protect extraction quality.
The result was a 61.8% reduction in OCR compute cost without a p95 turnaround regression.