How do you get confidence scores from document extraction with an LLM?
To get a real, calibrated confidence score for each extracted field, you need a model that runs an actual OCR engine and returns that engine's certainty — not a general LLM you ask to output a confidence number. Interfaze, which is OpenAI-API compatible, returns a precontext array with per-word confidence and bounding boxes alongside the normal structured result.
Last updated 2026-07-20
The trap: a confidence field in your schema
Adding a `confidence` field to your schema feels like the answer, but the model just generates a plausible number — it has no measured signal behind it. See why LLM confidence scores are unreliable for the full explanation.
What actually works
Use a model that exposes its specialist encoder's output. Interfaze returns a `precontext` array containing the raw OCR result — per-word text, confidence, and bounding boxes. You map each extracted value back to those words to attach a real confidence and location to every field.
How to wire it up
Because Interfaze implements the OpenAI chat-completions API, migration is a base URL, an API key, and a model string — the request body is otherwise identical. The confidence and bounds come back in the response's `precontext` field, next to your structured `object`.
The honest tradeoff
Interfaze runs full OCR internally, so it consumes more input tokens and is slower — and usually costs more per call — than a raw general model. You pay that for an answer you can verify. If your task tolerates silent errors, you may not need it. If a wrong field is expensive — KYC, lending, insurance, claims — that is exactly what it's for.
FAQ
Does OpenAI return confidence scores for document extraction?
Not calibrated per-field confidence. You can request a confidence field in the schema, but the model guesses the value.
Is Interfaze a different API to integrate?
No — it implements the OpenAI chat-completions spec. You change the base URL, key, and model string; the rest of your code is unchanged.