Overview
Math Verification transforms Parsefy from a probabilistic extraction tool into a deterministic verification platform. When enabled, Parsefy automatically verifies that extracted numeric data is mathematically consistent.Validated output or fail loudly. Math verification ensures totals match subtotals + tax, line items sum correctly, and cross-field calculations are accurate.
How It Works
1
Schema Analysis
Parsefy scans your schema for verifiable numeric fields (totals, subtotals, taxes, line items). Only fields with
type: "number" or type: "integer" are considered for verification.2
Rule Synthesis
Mathematical rules are automatically generated based on detected field roles
3
Secure Evaluation
Extracted numeric values are verified against the synthesized rules
4
Result Reporting
Verification results are included in the API response
Enabling Verification
Verification Response
Whenenable_verification is set to true, the response includes a verification object:
Verification Status Values
Supported Verification Rules
Field Requirements
For a field to be included in verification:- Must be numeric: The field must have
type: "number"ortype: "integer"in your JSON Schema - Must be part of a verifiable relationship: The field must be part of a mathematical relationship (e.g.,
total,subtotal,tax, or line item amounts)
Check Result Fields
Each check inchecks_run contains:
Shadow Extraction
When verification is enabled and only a single verifiable field is requested (e.g., justtotal), Parsefy automatically extracts supporting fields in the background:
- User requests:
{ "total": { "type": "number" } }withenable_verification=true - Parsefy internally expands to include shadow fields:
subtotal,tax,line_items - LLM extracts all fields
- Math verification runs
- Shadow fields are removed before response
Best Practices
Include Verification Fields
For best verification, include
subtotal, tax, and total in your schemaUse for Financial Data
Enable verification for invoices, receipts, and bills where math accuracy is critical
Handle Failures Gracefully
When verification fails, flag for manual review rather than rejecting outright
Check Individual Results
Review
checks_run to identify which specific calculations failedExample: Full Invoice Extraction with Verification
Next Steps
Confidence Scores
Understand field-level confidence and evidence
Schema Basics
Learn how to define effective extraction schemas
