Understanding the pipeline

The nine stages a document passes through, from detecting its format to scoring the result, and why staging is what makes confidence and provenance possible.

Ovrin does not treat document extraction as a single prompt. It uses a pipeline.

The nine stages

A document passes through nine named stages, in this order:

  1. Detect — the format, determined by content rather than by file extension.
  2. Acquire — page content, as text, images, or both.
  3. Normalise — one text stream, with offsets preserved back to the source.
  4. Schema — your Go type read by reflection into a JSON Schema.
  5. Prompt — the request built in the core, with document content kept as data.
  6. Generate — the model call, returning raw JSON.
  7. Validate — field rules and cross-field rules.
  8. Ground — each value searched for in the document.
  9. Score — the signals combined into confidence and a review decision.

Each stage names itself in errors and events, so a failure says which one failed.

Why the pipeline matters

This design allows Ovrin to do things a raw prompt cannot do reliably:

  • prefer exact text when present
  • fall back to OCR only as needed
  • detect fabricated values
  • validate numbers and enums
  • explain where a field came from
  • keep confidence decomposed and inspectable

A production mindset

The pipeline is what makes Ovrin a document-processing system rather than a model wrapper. When the extracted number is a payment amount, a missing field, or a contradictory figure, the product needs more than a plausible answer. It needs provenance and validation.

Next