Skip to content

Mathematical consistency enforcement

Definition

Catching arithmetic extraction errors by having the model emit both a derived total and the extracted total, then flagging for human review only when they disagree.

Key points

  • The problem: 18% of invoice extractions show line items that don't match the grand total due to OCR or extraction errors.
  • Schema solution — redundancy: the model outputs both:
    • calculated_total — derived by the model summing items (e.g. 210.025)
    • stated_total — extracted directly from the page (e.g. 260.00)
    • plus currency.
  • Routing action: flag the record for human review ONLY when calculated_total != stated_total.
  • A specific case of Resilient schema design (redundant fields) feeding Human-in-the-loop calibration (targeted human review).
  • On the Architect's Reference Matrix it sits under the Accuracy × Data Extraction "Schema Redundancy" pattern.

Why it matters for the exam

  • Extraction-accuracy scenarios: the correct control is dual totals + a mismatch flag, not "trust the model" or "review everything."

Common gotchas

  • Flag only on mismatch — routing every record to humans defeats the point.
  • The model both sums (calculated_total) and extracts (stated_total); comparing them is the check.

See also

Sources