Every document processing system has a number in its configuration that decides how much work people still do. A value extracted with confidence above the threshold goes straight into the system of record, and one below it is shown to a person. Set too high, the threshold leaves the review queue as long as it was before the project, and set too low, it lets wrong values flow into invoices, claims and customs declarations unchecked.
That number is often chosen in an afternoon, when someone picks 0.8 or 0.9 because it sounds careful and applies it to every field on every document type. Six months later the team usually reviews nearly everything because nobody trusts the output. The other common outcome is that it reviews almost nothing and finds the errors downstream.
A threshold holds up when it was derived from measured accuracy on your own documents, when it reflects what an error in that particular field costs, and when someone re-measures it as the documents change. This piece describes how to get there.
In brief
- A confidence score only means something once you have compared it with actual accuracy on a labeled sample of your own documents.
- Thresholds should be set per field and per document type, because fields differ both in how hard they are to read and in how much an error costs.
- Each field's threshold follows from a target error rate among auto-accepted values, and that target should be set by the business owner of the process rather than by the engineering team.
- Validation rules such as arithmetic checks, checksums and master data lookups catch errors that confidence scores miss, so they should run before any threshold is applied.
- Thresholds lose accuracy as suppliers and templates change and as models are upgraded, so a random sample of auto-accepted values has to be audited on a continuing basis.
What a confidence score is, and is not
A confidence score is a number that an extraction system attaches to each value, usually on a scale from 0 to 1, to show how sure it is. It is tempting to read 0.95 as correct 95 times in 100, but that reading is only justified when the score is calibrated.
A score is calibrated when, among all values given a confidence near some level, the share that are correct matches that level, and nothing guarantees this. Scores from OCR engines, layout-aware extraction models and classifiers come from different machinery, and any of them can be consistently overconfident or underconfident on your documents, which differ from whatever the system was trained on.
Language models add a further complication. If you ask a model to extract a field and also to say how confident it is, the confidence it reports is generated text that nothing measured and that may not correlate with accuracy. Token log probabilities, where the provider exposes them, are a better signal, as is agreement between two independent extractions, although both still need checking. Getting the model to return its output in a dependable shape is a separate subject, covered in getting reliable structured output from language models.
Whatever its source, a score is best treated as a ranking signal until you have evidence otherwise. A useful score places wrong values below right ones, and whether 0.9 means anything in absolute terms is something you can only find out by measuring.
Step 1: Label a sample of real documents and measure it
You need documents whose correct values are known, and although there is no way around this, it is usually less work than people expect.
Draw the sample from production intake in place of the tidy examples from a vendor's demonstration. It should hold bad scans and handwritten amendments as well as multi-page documents and suppliers with unusual layouts, in roughly the proportions in which they arrive. A few hundred documents per type is enough to start with for common fields. Rare fields and layouts need deliberate oversampling, or they will not show up in the numbers.
Have a person key each document and a second person key a subset independently. Where they disagree, you have usually found an ambiguous field or an unclear rule about the right answer, such as whether "invoice date" means the issue date or the tax point date. Settle those rules in writing before going further, because a threshold can be no more accurate than the definition of correct.
Keep the sample, since it starts the test set you will rerun after every model or configuration change, as described in the test set that runs every night.
Next, measure accuracy by confidence band for each field. Run the extraction over the sample and record each field's extracted value and confidence and whether it matched the label. Grouping the results by confidence then shows how accuracy changes from band to band.
SELECT
field_name,
FLOOR(confidence * 10) / 10 AS confidence_band,
COUNT(*) AS extracted_values,
SUM(CASE WHEN is_correct THEN 1 ELSE 0 END) AS correct_values,
AVG(CASE WHEN is_correct THEN 1.0 ELSE 0.0 END) AS accuracy
FROM extraction_results
WHERE document_type = 'commercial_invoice'
GROUP BY field_name, FLOOR(confidence * 10) / 10
ORDER BY field_name, confidence_band;
Three patterns usually appear. For some fields accuracy rises steadily with confidence, as you would hope. Other fields are overconfident, so that the top band still contains a visible share of errors. For a third group the scores barely separate right values from wrong ones, which means that no threshold on that score will work and a different signal is needed.
Sample size needs care, because a top band with no errors in a small sample does not show an error rate of zero, and it means you need more labeled documents for that field before auto-accepting it.
Step 2: Set the target from the cost of an error
The threshold follows from a business decision about what share of wrong values is acceptable among the values that skip review, so it should not be treated as a technical setting.
The target differs between fields because the cost of an error differs. A mistake in a free-text description is a nuisance, whereas a wrong bank account number sends money to the wrong place, and a wrong tax identifier may become a compliance matter. For each field, ask the process owner what happens when the value is wrong and the error goes unnoticed, and what a person's check costs, and the answers will put the fields in order.
For each field you then find the lowest threshold at which the measured error rate among values at or above it stays within the target, as in this pseudo-code.
def pick_threshold(results, max_error_rate, min_sample=200):
"""results: list of (confidence, is_correct) for one field."""
for t in sorted({round(c, 2) for c, _ in results}):
accepted = [ok for c, ok in results if c >= t]
if len(accepted) < min_sample:
return None # not enough evidence: review everything
error_rate = 1 - sum(accepted) / len(accepted)
if error_rate <= max_error_rate:
return t # lowest threshold that meets the target
return None
A None result is legitimate, since for some fields the right policy today is to review every value, which is safer than a threshold that only appears to work.
Each threshold produces a pair of numbers, the share of values auto-accepted and the expected error rate among them. That pair is the trade being made, and the choice should rest with the person accountable for the process.
Step 3: Put validation rules ahead of the threshold
Confidence measures how sure the system is about what it read but says nothing about whether the value makes sense, and a model can read a clearly printed wrong number with complete confidence. Rules catch these errors, and the main types are listed below.
- Arithmetic on the totals. Line amounts should sum to the subtotal, and the subtotal plus tax should equal the total.
- Check digits and formats. IBANs carry check digits, as do many national identifiers and container numbers, and dates must be real dates that fall in a plausible range.
- Lookups against master data. The supplier should exist, the purchase order should be open and the currency should match the supplier's contract.
- Agreement between related documents. The quantity on the invoice should match the quantity on the packing list.
A value that passes a strong check can be accepted at lower confidence than one with no check available, while a value that fails a check goes to review whatever its confidence. In our view rules do more than threshold tuning to make automation safe, and since they are also cheap to build, they belong in the design of any intelligent document processing pipeline from the first week.
Commercial invoices at a freight forwarder
Take a mid-size freight forwarder that prepares customs declarations from data extracted from commercial invoices. Its system went live with a single threshold of 0.85 for every field, so reviewers opened most documents because at least one field on each fell below it, and declarations were still being corrected after submission.
Measuring on a labeled sample of several hundred invoices gives a different picture for each field.
| Field | What the measurement shows | Decision |
|---|---|---|
| Invoice number | Accurate across nearly all confidence bands | Lower the threshold; accept unless the format check fails |
| Total value | Scores well calibrated; errors concentrated in low bands | Accept above the measured threshold only if the line items sum to the total |
| Currency | Often absent from the page and inferred; high confidence, sometimes wrong | Ignore the score; check against the supplier's contract currency |
| Consignee name | Minor spelling variation counted as errors | Match to the customer master by fuzzy lookup; review only when no match |
| Commodity code | Frequently missing or outdated on the supplier's invoice; errors costly | Always reviewed by a customs specialist, with the model's suggestion shown |
The measurement produces five separate policies, one per field, in place of a single better number. Review effort moves away from fields that were never a problem and toward the commodity code, where an error has regulatory consequences, and the reviewers' screen now shows only the fields that need attention, highlighted on the page image. That is where specialist time should be spent in a business that moves goods across borders, as much of logistics and supply chain does.
Step 4: Keep measuring after go-live
A threshold describes the documents it was measured on, and those change when a large supplier adopts a new invoice template or a scanner is replaced, or when a new document type arrives or the extraction model is upgraded. The scores then shift, and the threshold can stop meaning what it meant without anything reporting it.
Three mechanisms keep the threshold accurate over time.
- Audit a random sample of auto-accepted values. Each week a person checks a small random selection of values that skipped review, which is the only direct measurement of the error rate that matters. Reviewers' corrections cannot take its place, because reviewers only see values that fell below the threshold.
- Watch the score distributions closely. Track the share of values auto-accepted per field and per supplier, and the rate at which reviewers change the values they are shown, and re-measure after any sudden move in either.
- Rerun the labeled set on every change. A model or prompt upgrade can improve accuracy and change calibration at once, so thresholds should be derived again after each change, never carried over. It is the same evaluation and assurance discipline used elsewhere in AI, applied here to documents.
A checklist for your current system
If you already run document extraction, these questions take about a day to answer and show whether your thresholds are holding.
- Does anyone know where each threshold came from and which documents it was measured on?
- Is a single threshold applied to everything, or does each field and document type have its own?
- Who decided the acceptable error rate for each field, and do they own the downstream consequence?
- Which validation rules run before a value is accepted, and which obvious rules are absent?
- Is anyone auditing the values that were auto-accepted, and what did the most recent audit find?
- When the extraction model or its configuration last changed, were the thresholds derived again?
- Does the exception queue feed into wider automation with clear exception handling, or does it end up in a shared mailbox?
If the first question has no answer, start there by labeling a sample, running the query in step 1 and looking at a single field, which is usually enough to justify the rest of the work.



