Skip to main content

Phase 3: Validation

Cross-field sanity checks and re-resolution. Phase 3 performs two critical tasks: it re-runs the reference table lookup cascade on values produced by Phase 2 to normalize free-text AI output to your canonical codes, and it runs informational validation checks across related fields. Flags are informational only — they never block output but help you prioritize review:

After Phase 3 completes, flagged cells appear with warning indicators in the results grid. Use the Flagged filter to see only rows that need attention — for example, an amount_mismatch flag suggests you double-check a total that does not align with its component values. Addressing flagged cells first is the most efficient way to review large extraction runs.

Validation flags

ParameterTypeDescription
date_sanityerrorEnd date before start date, or signature date after effective date.
amount_mismatchwarningTotal doesn't match periodic amount x term (+/-20% tolerance).
lookup_failedwarningReference table field couldn't find a matching code.
low_confidence_outlierwarningCell with <0.3 confidence in a row where average >0.7.
unexpected_emptyinfoField with >80% registry occurrence rate is empty in this document.

Phase 3 also re-runs the lookup cascade (reference table resolution) on values that Phase 2 produced. This is important because AI-extracted values often use natural language labels (e.g., "Frame Agreement") rather than the canonical codes your reference table expects (e.g., std_master). The Phase 3 lookup normalizes these labels to codes, improving consistency across your output without requiring manual corrections.

Validation flags are designed to surface the most impactful issues first. The low_confidence_outlier flag is particularly useful — it highlights cells where the system is uncertain in an otherwise high-confidence row, pointing you to the exact cells most likely to contain errors. For large runs with hundreds of documents, filtering by flags and reviewing those cells first can reduce your review time by 80% or more.

What gets flagged and why depends on cross-field relationships, not just individual values. A date_sanity flag fires when temporal fields contradict each other — for example, a contract end date that falls before the start date, or a signature date after the effective date. An amount_mismatch flag fires when a computed total deviates more than 20% from the product of its component values (e.g., monthly rent times term length versus total contract value). The unexpected_empty flag fires when a field that appears in over 80% of documents in your registry is missing from this particular document, suggesting the AI may have missed it rather than it being genuinely absent.

Retrieve validation flags with job results
curl -s https://api.talonic.com/v1/jobs/c3d4e5f6-a7b8-9012-cdef-123456789012/results \
  -H "Authorization: Bearer $TALONIC_API_KEY"

# Each result row carries the validation flags raised for that document:
# {
#   "job_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
#   "job_status": "complete",
#   "total_rows": 150,
#   "data": [
#     {
#       "document_id": "f0e1d2c3-b4a5-9687-8765-432109876543",
#       "filename": "Contract_Beta.pdf",
#       "status": "completed",
#       "confidence": 0.82,
#       "validation_flags": [
#         {
#           "type": "date_sanity",
#           "severity": "error",
#           "fields": ["contract_start_date", "contract_end_date"],
#           "message": "End date (2024-01-15) precedes start date (2025-03-01)"
#         },
#         {
#           "type": "low_confidence_outlier",
#           "severity": "warning",
#           "fields": ["payment_terms"],
#           "message": "Confidence 0.28 in row with average 0.82"
#         }
#       ]
#     }
#   ]
# }

Phase 3 is particularly valuable for catching systematic errors before they reach downstream systems. For example, if your schema includes both a "start date" and "end date" field, the date_sanity check catches temporal inversions that would be difficult to spot in a large grid. Similarly, the amount_mismatch check catches arithmetic inconsistencies between related financial fields — a total that does not align with its components within a 20% tolerance is flagged for review. These cross-field checks operate on relationships between fields rather than individual values, catching errors that single-field validation cannot detect.

Validation flags never modify cell values. They are purely informational annotations that help you prioritize review. The actual cell value and confidence score remain unchanged by Phase 3 flagging.

Frequently asked questions

Do Phase 3 validation flags block output?+
No. Validation flags are informational only — they never block output. They help you prioritize review by highlighting potential issues.
What types of validation flags exist?+
Five types: date_sanity (date inconsistencies), amount_mismatch (total discrepancies), lookup_failed (no reference match), low_confidence_outlier (low confidence cells), and unexpected_empty (missing high-frequency fields).
Does Phase 3 modify any cell values?+
Phase 3 re-runs the reference table lookup cascade to normalize AI-extracted labels to canonical codes. The validation flags themselves are purely informational and do not modify values.
How does the lookup_failed flag help improve my reference tables?+
The lookup_failed flag identifies values that the AI extracted but could not map to any code in your reference table. These are direct candidates for adding new entries. Review the flagged values after each job — if "Frame Agreement" consistently fails lookup against a contract type table, add it as a synonym pointing to the canonical code. Future runs will resolve it at Step 1 confidence (0.95) without AI fallback.
Is Phase 3 the same as a validation checkpoint in a Spec?+
No. Phase 3 is a fixed step inside every Job: it re-runs the lookup cascade on Planner output and performs cross-field sanity checks. Validation checkpoints belong to the production Spec path, where they are composed in the rail, can block a field, and route it to human review. If you need blocking gates and a review trail, run the work as a Spec rather than a Job.