This prompt is designed for data engineers and pipeline operators who need to reassemble a single logical data row that has been split across a page break in a PDF. The core job is to match partial rows from two consecutive pages using a stable key field—such as an invoice line number, transaction ID, or general ledger account code—and merge their cell values into one complete record. You should use this prompt when your upstream table extraction has already produced structured JSON row arrays per page, and you now face the problem of orphaned half-rows that would otherwise create duplicate or incomplete entries in your downstream database.
Prompt
Cross-Page Row Reconciliation Prompt

When to Use This Prompt
Define the reconciliation job, the required inputs, and the boundaries where this prompt should not be applied.
The prompt requires three concrete inputs to function reliably. First, you must supply the extracted rows from the current page and the following page as two separate JSON arrays, with each row represented as an ordered list of cell values. Second, you must specify the zero-based index of the key column that should be used for matching (for example, index 0 for a transaction ID column). Third, you must provide the expected total number of columns in a complete row so the prompt can detect partial rows and validate merge results. Without a stable, unique key field that spans the page break, this prompt will produce unreliable matches and should not be used. If your tables lack a consistent row identifier across pages, you need a different approach—such as spatial proximity matching or header-pattern continuation detection—rather than key-based reconciliation.
Do not use this prompt when rows can split across more than two pages, when the key field itself is split by the page break, or when the table has merged cells that span the page boundary. In those cases, the prompt will either fail silently or produce merged rows with missing key values. For tables with multi-page row splits, chain this prompt iteratively across page pairs. For merged-cell scenarios, apply a merged cell resolution prompt first to produce a clean grid before reconciliation. Always run a row-count validation after merging: the total number of output rows should equal the sum of complete rows from both pages plus the number of successfully matched partial-row pairs. If this invariant fails, route the page pair to human review rather than silently propagating corrupted data.
Use Case Fit
Where the Cross-Page Row Reconciliation Prompt works, where it fails, and what you must provide before relying on it in a production pipeline.
Good Fit: Multi-Page Ledgers
Use when: extracting transaction registers, general ledgers, or bank statements where a single logical row splits across page breaks. Guardrail: provide explicit key fields (e.g., transaction ID, date, description) as the reconciliation anchor in the prompt template.
Bad Fit: Single-Page Tables
Avoid when: the table fits entirely on one page with no row splitting. Guardrail: use a simpler table extraction prompt to reduce token cost and avoid false-positive row merges caused by the reconciliation logic.
Required Input: Key Field Specification
Risk: the model cannot guess which columns uniquely identify a row across pages. Guardrail: always supply a [KEY_FIELDS] list in the prompt. Without it, reconciliation degrades to brittle positional matching that fails on page breaks.
Required Input: Page Boundary Metadata
Risk: the model cannot detect page breaks from raw text alone. Guardrail: prepend page markers (e.g., [PAGE 3]) or pass structured page objects so the prompt knows where splits occur. This is a pipeline responsibility, not a model inference task.
Operational Risk: Silent Merge Failures
Risk: partial rows that cannot be matched are dropped or incorrectly merged without warning. Guardrail: require the prompt to output an unreconciled_rows array and set a pipeline alert if it is non-empty. Route unreconciled rows to human review.
Operational Risk: Header Repetition Confusion
Risk: repeated column headers at the top of continuation pages are mistaken for data rows. Guardrail: instruct the prompt to detect and strip continuation headers using a [HEADER_PATTERN] constraint. Validate output row count against expected page density.
Copy-Ready Prompt Template
A reusable prompt template for reconciling rows that split across page breaks in multi-page tables, with placeholders for your specific document context and output schema.
This prompt template is designed to be dropped into your document processing pipeline when you have already extracted raw table data from individual PDF pages and need to reassemble logical rows that were fragmented across page boundaries. The template assumes you have page-level table representations and a set of key fields that define row identity. It instructs the model to match partial rows, merge split cells, and flag any rows that could not be reconciled, producing a structured output that your application can consume directly.
textYou are a table reconciliation engine. Your task is to reassemble logical rows from a multi-page table where individual rows may split across page breaks. ## INPUT You will receive: 1. A list of page-level table extractions, each with a page number and an array of rows. 2. A list of key fields that uniquely identify a logical row. Page-level tables: [PAGE_TABLES] Key fields for row identity: [KEY_FIELDS] ## CONSTRAINTS - A logical row may span multiple pages. Match partial rows across pages using the key fields. - When a row continues on a subsequent page, the continuation may omit repeated key field values. Infer the match from row position, surrounding context, and partial key matches. - Merged cells that split across pages must be reassembled. Concatenate text content from split cell fragments with a space separator. - If a row appears to be a repeated header row rather than a data continuation, exclude it from the merged output and note it in the `excluded_header_rows` field. - If a row fragment cannot be matched to any other fragment with confidence, include it in the output but flag it in the `unreconciled_rows` field with the reason. - Do not invent data. If a cell value is missing in all fragments, leave it null. ## OUTPUT SCHEMA Return a JSON object with this exact structure: { "reconciled_table": [ { "row_id": "string, a stable identifier for the logical row", "source_pages": [1, 2], "cells": { "column_name": "value" }, "reconciliation_confidence": "high | medium | low", "reconciliation_notes": "string explaining how fragments were matched, or null" } ], "unreconciled_rows": [ { "page": 1, "row_index": 0, "cells": {}, "reason": "string explaining why reconciliation failed" } ], "excluded_header_rows": [ { "page": 2, "row_index": 0, "cells": {} } ], "reconciliation_summary": { "total_logical_rows": 0, "reconciled_rows": 0, "unreconciled_rows": 0, "pages_processed": 0 } } ## EXAMPLES [EXAMPLES] ## RISK LEVEL [RISK_LEVEL]
To adapt this template, replace [PAGE_TABLES] with your actual page-level extraction data, structured as an array of objects each containing a page number and a rows array. Replace [KEY_FIELDS] with the column names that together form a unique row identifier—for a general ledger this might be ["account_code", "transaction_date", "reference_number"]. The [EXAMPLES] placeholder should contain one or two worked examples showing a split row and the expected reconciled output. Set [RISK_LEVEL] to "high" if the reconciliation feeds financial reports or compliance filings, which should trigger downstream validation and human review for any unreconciled_rows. For lower-risk analytical use cases, set it to "medium" or "low" to adjust the model's conservatism in flagging uncertain matches. Before deploying, validate that your page-level extraction preserves enough row-position context for the model to reason about continuations—if your extraction pipeline strips row ordering, reconciliation accuracy will degrade sharply.
Prompt Variables
Required inputs for the Cross-Page Row Reconciliation Prompt. Each placeholder must be populated before the prompt is assembled and sent to the model. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[PAGE_EXTRACTS] | Array of per-page table extraction results with page numbers, row data, and column headers | [{"page": 1, "rows": [["Acme Corp", "100.00"]], "headers": ["Vendor", "Amount"]}] | Must be a non-empty array. Each element requires page (integer), rows (array of arrays), and headers (array of strings). Reject if any page has zero rows. |
[KEY_FIELD_INDICES] | Zero-based column indices that uniquely identify a logical row across pages | [0, 2] | Must be an array of integers. Each index must be within bounds of the headers array length for all pages. Reject if any index exceeds max column count across pages. |
[RECONCILIATION_STRATEGY] | Strategy for matching partial rows: exact, fuzzy, or composite | fuzzy | Must be one of: exact, fuzzy, composite. Exact requires identical key values. Fuzzy allows normalized string matching. Composite uses multiple key fields with a match threshold. |
[FUZZY_MATCH_THRESHOLD] | Minimum similarity score for fuzzy key matching, required when strategy is fuzzy | 0.85 | Must be a float between 0.0 and 1.0. Required when [RECONCILIATION_STRATEGY] is fuzzy. Reject if threshold is below 0.7 without explicit override flag. |
[CONTINUATION_HEADER_PATTERN] | Regex or string pattern that identifies repeated header rows on continuation pages | "^Vendor.*Amount$" | Must be a valid regex string or null. When null, continuation detection relies on column count matching only. Test regex against known header strings before use. |
[OUTPUT_SCHEMA] | Target JSON schema for reconciled rows including source page ranges and confidence | {"type": "object", "properties": {"reconciled_rows": {"type": "array"}}} | Must be a valid JSON Schema object. Schema must include fields for reconciled row data, source_page_range, and reconciliation_confidence. Reject if schema lacks confidence field. |
[UNMATCHED_ROW_POLICY] | Action for rows that cannot be reconciled: flag, discard, or isolate | flag | Must be one of: flag, discard, isolate. Flag appends warning to output. Discard removes unmatched rows silently. Isolate places unmatched rows in a separate output array. Reject if policy is discard without explicit audit approval. |
[MAX_PAGE_GAP] | Maximum number of pages allowed between partial row segments before treating as separate rows | 2 | Must be a positive integer or null. When null, no gap limit is enforced. Set to 0 to require rows to appear on consecutive pages. Reject if gap exceeds total page count. |
Implementation Harness Notes
How to wire the cross-page row reconciliation prompt into a production document extraction pipeline with validation, retries, and human review.
The cross-page row reconciliation prompt is not a standalone tool—it is a post-extraction assembly step that sits between raw table extraction and downstream ingestion. After your layout-aware extraction prompt has produced per-page table fragments, feed those fragments into this reconciliation prompt to merge split rows, resolve continuation markers, and produce a single normalized table. The prompt expects structured input: an array of page objects, each containing a page number and an array of row objects with key fields that can be used for matching across page boundaries.
Wiring the prompt into a pipeline requires several guard layers. First, validate the input shape before calling the model—each page must have a page_number and rows array, and each row must include the key fields specified in [MATCHING_KEY_FIELDS]. If a page fragment is missing required keys, route it to a repair step before reconciliation. After the model returns the merged table, run a row-count sanity check: the total reconciled rows should not exceed the sum of input rows across all pages, and no row should appear with duplicate key combinations unless explicitly flagged as an unresolved split. Log every reconciliation decision—matched rows, merged cells, and flagged orphans—so that downstream audit can trace each output row back to its source pages.
Model choice and retry strategy matter here. Use a model with strong structured output support and a large enough context window to hold all page fragments plus the prompt. If the table spans more pages than fit in a single context window, batch the reconciliation: process pages in overlapping windows of 3–5 pages, then reconcile the batch outputs in a second pass. On validation failure, retry once with the error details injected into [CONSTRAINTS]. If the retry also fails, escalate the affected page range to human review rather than silently dropping rows. For high-stakes use cases like general ledger extraction, require human sign-off on any row flagged as reconciliation_status: unresolved before the data reaches a financial system.
Observability is non-negotiable. Emit structured logs containing the input page count, output row count, number of merged rows, number of unresolved rows, and per-row source page ranges. If your pipeline writes to a data warehouse or ledger, include a reconciliation_run_id and reconciliation_timestamp on every output row. This lets downstream consumers distinguish between rows that were extracted cleanly from a single page and rows that were assembled across page breaks—critical context when investigating numeric discrepancies later. Finally, treat the reconciliation prompt as versioned infrastructure: any change to the matching logic, key fields, or output schema should be tested against a golden dataset of known multi-page tables before release.
Expected Output Contract
Defines the required fields, types, and validation rules for each reconciled row produced by the Cross-Page Row Reconciliation Prompt. Use this contract to build downstream ingestion, validation, and error-handling logic.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
reconciled_row_id | string (UUID v4) | Must be a valid UUID v4. Generated by the reconciliation process, not extracted from the source. | |
source_page_range | string | Must match the pattern 'pp. [START]-[END]' where START and END are integers and START <= END. Example: 'pp. 4-5'. | |
key_field_values | object | Must be a non-empty JSON object. Keys are the column names used for matching (e.g., 'Account Number'). Values must be strings. Schema must match the provided [KEY_FIELDS]. | |
reconciled_cells | object | Must be a JSON object where keys are column names from [OUTPUT_SCHEMA] and values are the merged cell values. No cell value should be an empty string; use null for missing data. | |
reconciliation_status | string (enum) | Must be one of: 'complete', 'partial', 'conflict'. 'complete' means all expected cells were merged without conflict. 'partial' means some cells were missing from all fragments. 'conflict' means two fragments had different values for the same cell. | |
conflict_details | array of objects or null | If reconciliation_status is 'conflict', this must be an array of objects, each with 'column', 'value_fragment_a', 'value_fragment_b', and 'source_pages' fields. Otherwise, must be null. | |
missing_cells | array of strings or null | If reconciliation_status is 'partial', this must be an array of column names that could not be found in any fragment. Otherwise, must be null. | |
reconciliation_confidence | number (float) | Must be a float between 0.0 and 1.0. Represents the model's confidence in the row match. A value below [CONFIDENCE_THRESHOLD] should trigger human review. |
Common Failure Modes
Cross-page row reconciliation fails silently in production when partial rows are dropped, mismatched, or duplicated. These are the most common failure patterns and how to guard against them before they corrupt downstream reports.
Key Field Drift Across Pages
What to watch: The key field used for matching (e.g., transaction ID, line number) changes format or gains a prefix on continuation pages. The model matches nothing and either drops rows or creates duplicates. Guardrail: Normalize key fields before reconciliation—strip whitespace, enforce case, and validate that key field format is consistent across all page batches before attempting row matching.
Header Row Misidentified as Data
What to watch: Repeated column headers on continuation pages are treated as data rows, injecting garbage records into the reconciled output. This is especially common when headers are visually similar to data rows. Guardrail: Detect and remove repeated header rows by comparing each candidate row against the known header signature from the first page. Flag rows that match header patterns above a similarity threshold for human review.
Partial Row Orphaning
What to watch: A row that starts near the bottom of one page and continues at the top of the next is split, but the model fails to recognize the continuation. The orphaned fragment is either dropped or treated as a separate incomplete row. Guardrail: Explicitly instruct the model to flag rows that appear truncated at page boundaries. Post-process orphan flags by attempting fuzzy key-field matching on adjacent page batches before accepting the orphan as a new row.
Page-Number Noise in Cell Values
What to watch: Page numbers, footers, or watermarks that overlap table regions are extracted as cell content, corrupting numeric fields and breaking reconciliation logic. Guardrail: Strip known page artifacts (page numbers, running headers, footers) from the extracted text before table parsing. Use spatial bounding-box filtering when available to exclude content outside the detected table region.
Column Count Mismatch After Merge
What to watch: A continuation page has one fewer or one more apparent column due to OCR misalignment, merged-cell expansion, or a missing separator. The reconciliation step aligns columns incorrectly, shifting all values in the merged row. Guardrail: Validate that column counts are identical across all page batches before reconciliation. On mismatch, log the page and column counts, attempt column-header alignment by name rather than position, and escalate if alignment confidence is low.
Duplicate Row Creation from Ambiguous Breaks
What to watch: A row that appears complete on one page but also has a continuation fragment on the next page is counted twice—once as a standalone row and once as part of the merged row. Guardrail: After reconciliation, deduplicate by checking for rows with identical key fields and overlapping or adjacent page ranges. Keep the merged version and log the duplicate for audit. Require exact key-field match plus page-range overlap to trigger deduplication.
Evaluation Rubric
Criteria for testing the Cross-Page Row Reconciliation Prompt before production deployment. Each criterion validates a specific failure mode common in multi-page table assembly.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Row Completeness | Every logical row from the source document appears exactly once in the output with no missing segments | Row count in output does not match expected row count from ground truth; orphaned row fragments present | Compare output row count against manually verified ground truth for a 5-page test document with known row splits |
Key Field Match Accuracy | Rows split across pages are correctly joined using [KEY_FIELD] values with zero false joins | Two unrelated rows merged because of ambiguous key values; a split row appears as two separate rows | Inject a test PDF where two rows share similar but not identical key values across a page break and verify correct separation |
Cell Merge Integrity | All cells from a split row are present in the reconciled row with no data loss or duplication | A cell value from page N is missing in the reconciled row; a cell value appears twice | Audit a reconciled row against the original PDF pages and confirm every cell value is present exactly once |
Page Range Attribution | Each reconciled row includes a [SOURCE_PAGES] field listing all pages where row segments appeared | Missing [SOURCE_PAGES] field; page range lists only the first page of a multi-page split | Parse the output JSON and assert that every row with a split has at least two page numbers in [SOURCE_PAGES] |
Header Continuity Handling | Repeated header rows on continuation pages are identified and excluded from data rows | A repeated header row appears as a data row in the output; header text contaminates a data cell | Include a test PDF with explicit repeated headers on continuation pages and verify zero header rows in data output |
Unreconciled Row Flagging | Rows that cannot be matched across pages appear in an [UNRECONCILED_ROWS] array with the partial data and a reason code | Unmatched row fragments are silently dropped; no [UNRECONCILED_ROWS] field in output | Supply a PDF with a deliberately un-matchable row fragment and assert it appears in [UNRECONCILED_ROWS] with a non-null reason |
Column Count Consistency | Every reconciled row has the same number of columns as the table header definition | A row has fewer or more columns than expected; column misalignment shifts values into wrong fields | Validate output schema: assert that len(row) equals len(header_columns) for every reconciled row |
Confidence Score Threshold | Each reconciliation decision includes a [CONFIDENCE] score; rows below [CONFIDENCE_THRESHOLD] are routed to human review | A row with low confidence appears in the final output without a flag; confidence field is null or missing | Set [CONFIDENCE_THRESHOLD] to 0.85, inject a borderline case, and assert it routes to the review queue rather than the completed output |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base reconciliation prompt and a small sample of 3-5 multi-page tables. Use the prompt as a single-turn call without schema enforcement. Focus on getting the merge logic right for the most common split pattern in your documents.
Simplify the output to a flat JSON array of reconciled rows with a source_pages array and a reconciliation_status field (matched | partial | unmatched). Skip confidence scoring and validation passes.
codeReconcile rows that split across pages in this multi-page table. Key field for matching: [KEY_FIELD] Output each reconciled row with all columns merged and source page numbers.
Watch for
- False matches when the key field has near-duplicate values across different rows
- Rows that split mid-cell producing misaligned column counts
- Repeated header rows being treated as data rows

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us