WorksComputer Science
RICoT: Recurrent Interleaved Chain-of-Thought for Page Stream Segmentation
Abstract
Large language models (LLMs) have renewed interest in Page Stream Segmentation (PSS), splitting a multi-page file into its constituent documents. Yet published LLM methods still frame the task as boundary classification over one or a few neighboring pages, and commercial document-splitting APIs do not disclose their methods. We reimagine PSS for LLMs as a sequential process over the whole stream and propose RICoT (Recurrent Interleaved Chain-of-Thought), a prompting framework that works through the pages as a reader would: within a sliding window it reasons about each page and commits its boundary decision before moving on, and across windows it carries forward a compact record of what it has read, keeping per-call cost bounded. We also introduce FinancePSS-205, a benchmark of 205 real-world, de-identified financial page streams, to be released publicly. On FinancePSS-205, RICoT matches or outperforms pairwise and windowed prompting with the same backbone for each of three open-weight LLMs; on a TABME test subset, RICoT with GLM-5 reaches document F1 0.847 and boundary F1 0.915, above published zero-shot results. A 2B-parameter student, trained on a larger teacher's decisions with and without the page-level reasoning, performs comparably in both modes and comes within 0.05 document F1 of the strongest prompted model on FinancePSS-205.
Introduction
Document-level information retrieval typically assumes predefined document boundaries. However, real-world “page streams”—sequences of scanned or digital pages—often bundle multiple documents into a single file. Page Stream Segmentation (PSS) partitions these streams into their constituent documents (Figure 1), a task critical for finance automation (AP/AR), where batched invoices, purchase orders, and receipts are processed together; failing to segment them leads to merged field values, duplicated line items, and failed reconciliation.

Figure 1. Page Stream Segmentation task. A stream of six pages is segmented into four documents: two invoices (pages 1–2 and 3), a delivery receipt (pages 4–5), and an email (page 6). Each document may span one or more consecutive pages.
Traditional PSS relies on pairwise classification ([9] (Wiedemann and Heyer 2018; Mungmeeprued et al. 2022)), deciding if page starts a new document based on . This paradigm suffers from two primary limitations:
Contextual Isolation: Decisions often require long-range dependencies. For example, a remittance advice on page 11 may only be identifiable as part of a page 1 invoice via headers that a pairwise classifier cannot see.
Computational Redundancy: Encoding each page twice—once as context and once as a target—doubles token costs without improving long-range reasoning.
Conversely, full-stream processing falters as sequence length grows, since LLMs degrade in long contexts ((Liu et al., 2024)). Windowed classification ((Pottanigari et al., 2026)) is a middle ground but is limited by fixed window boundaries.
Our contributions are:
The RICoT framework (Section 3): a sliding-window PSS framework that combines interleaved per-page chain-of-thought reasoning within each window with recurrent state propagation across windows—a short reasoning history and an active-segment summary that maintain document-level coherence for arbitrarily long streams.
A distilled 2B student (Section 4): Qwen-3.5-2B trained on Kimi-K2-Instruct’s RICoT outputs over a finance-filtered subset of FinePDFs, with and without the page-level reasoning; the two modes perform comparably, and the student comes within 0.05 DocF1 of the strongest prompted model on FinancePSS-205.
FinancePSS-205 (Section 5.1): a new benchmark of 205 real-world, de-identified AP/AR page streams, to be released publicly with labels and evaluation scripts.1
Extensive component ablations (Sections 6.4 and 6.5) trace how each load-bearing element of RICoT—pagewise interleaved reasoning, recurrent state propagation, the structured decision schema, and the deployment-time expand post-processing—contributes to the framework’s accuracy.
Related Work
Page stream segmentation. PSS has progressed from visual CNNs classifying adjacent page pairs (Wiedemann and Heyer, 2018) through joint text-layout encoders (Mungmeeprued et al., 2022) to layout-feature embedding schemes (Drumond et al., [6]) and efficient image-only pipelines (Braz et al., [4]) on the Tobacco800 benchmark (Lewis et al., 2006; University of California, San Francisco, 2007; Agam et al., [1]). Heidenreich et al. [9] adapt the paradigm to LLMs by prompting instruction-tuned models on adjacent page pairs and obtain the strongest zero-shot decoder baseline on TABME prior to our work; Heidenreich et al. [10] extend the LLM treatment with new metrics and stronger fine-tuned baselines. PSS has also been formalized in adjacent media, e.g. multimodal Transformers on comic-book page streams (Serra Ortega et al., 2025), and real-world open benchmarks of Dutch government streams have been released (van Heusden et al., 2022, 2024). A common thread across this prior work is the pairwise assumption: boundary decisions are made independently for each page given only the immediately preceding page, which limits context to the local pair. Concurrent MSBD (Pottangari et al., 2026) predicts all boundaries of a window in one call (the design of our Windowed baseline) and degrades at larger windows; generation-based segmenters (Inan et al., [11]; Li et al., 2026) are trained and read the full input. RICoT is zero-shot, keeps windows bounded, reasons per page, and carries state across windows. Commercial document-AI services, such as LandingAI’s Agentic Document Extraction,2 Reducto,3 and LlamaIndex’s LlamaParse,4 also offer document splitting, but do not publish their methods, so they cannot serve as reproducible baselines.
Interleaved chain-of-thought reasoning. Chain-of-thought prompting (Wei et al., 2022) elicits intermediate reasoning steps before the final answer. The closest precedent for the mechanism we use is ReAct (Yao et al., 2023), which interleaves thought and action steps for agentic tasks; RICoT adapts the same interleaving principle to sequential classification, alternating per-page reasoning and per-page decision within a window in one call, avoiding the per-page cost of a multi-call agentic loop. Interleaved reasoning has recently been explored as a training paradigm for LLMs (Xie et al., 2025); our contribution is at inference time, integrated with windowed processing and recurrent state for multi-page sequential classification.
Long-context state propagation. Long-context use is limited by the lost-in-the-middle effect (Liu et al., 2024) and by the cost of extending context windows. Architectural mitigations (Beltagy et al., [3]; Zaheer et al., 2020) and recursive decomposition (Zhang et al., 2025) change the underlying inference procedure; explicit memory-management approaches such as MemGPT (Packer et al., 2023) pass state across turns through structured summaries. RICoT shares the explicit-state philosophy, instantiated for PSS as a recurrent active-segment summary plus a short reasoning history carried across overlapping windows.
RICoT Framework
Task definition
Let be a page stream of pages, each represented by OCR-extracted text and layout features. PSS maps to binary boundary labels with iff page starts a new document; by convention . The labels induce a partitioning into contiguous documents where and .
Sliding windows and the two-axis decision
RICoT (Figure 2) processes with token-budgeted windows. Each window is packed greedily with consecutive pages until the running token count would exceed a budget or a page cap is reached, with a one-page overlap into the previous window.5 This adapts window size to page density—short pages pack densely up to , long pages truncate early—so context utilization is consistent across stream geometries.

Figure 2. RICoT architecture. Window processes its pages with interleaved per-page reasoning and decisions, receiving reasoning history and active-segment summary from preceding windows. Recurrent state and the per-page two-axis decision (segment + sub-document) extend effective context beyond the window boundary while keeping per-window inference cost bounded.
Two-axis decision. For each page in the window the model emits
where the segment axis marks a new segment (S) or continuation (C); on continuations, the sub-document axis optionally marks a nested document instance (e.g. an invoice inside a statement of account). is a document-class label, a grounding fingerprint (page identifier + short evidence quote), and a categorical confidence (HIGH9, MOD6, LOW3). is emitted only on S decisions, so each segment has one label. Keeping segment-start and sub-document-start as separate axes at decision time preserves both signals for downstream control (§ 3.4).
Interleaved reasoning and recurrent state
Within a window, RICoT generates per-page reasoning (<think>) interleaved with the per-page decision (<decision>) before moving to the next page. We refer to this as pagewise thinking (PwT); the alternative of emitting one block of reasoning followed by all decisions is the windowed thinking variant we ablate in § 6.4. Interleaving grounds each decision in evidence local to its target page.
Two recurrent state objects, , are propagated across windows. is an anchored recency window: up to the most recent thought–decision pairs, always preserving the two decisions that opened the active segment (joined by an elision marker once they age out). describes the currently open segment in two parts: (i) deterministic metadata derived by walking back to the most recent S decision, and (ii) a model-emitted <active_segment_carry_forward> block summarizing anticipated content and progress for the next window. The stream is wrapped with <stream></stream> tags so the model suppresses on the terminal window where no successor exists. Each page is decided in the first window containing it; later emissions for the overlap page are ignored. A worked example is in Appendix § 14.
Robust decoding. A decision cache stores the most recent valid per page. After parsing, any missing, malformed, or duplicate page is filled from first; if the page will recur in the next overlapping window the correction is deferred; remaining gaps are repaired by a correction call, and finally by rule-based fallbacks (continuation by default, low-confidence UNKNOWN otherwise). The full procedure is summarized in Algorithm 1 (Appendix § 30).
Expand: deployment-time controllability
Because the two-axis decision keeps sub-document starts as a separate signal even when their parent segment is open, downstream consumers can re-threshold what counts as a segment without re-running inference. We use this for one specific operating choice on FinancePSS-205, which we call expand: when a predicted sub-document of a priority class (invoice, statement, purchase_order, packing_slip, bill_of_lading, commercial_invoice, packing_list) appears inside a parent segment, the sub-document’s start is promoted to a true segment start in post-processing. The priority list is taken from the document ontology of the AP/AR workflows the data come from and was fixed before any FinancePSS evaluation; expand uses no re-inference and no gold labels. We report its effect alongside the no-expand variant throughout § 6 so its contribution is visible rather than absorbed into the headline number.
Distilling RICoT into a Small Model
A small model running the same framework is more attractive to deploy than a large prompted one, so we distill RICoT into a 2B student: a larger teacher LLM runs RICoT over a training corpus, and the student learns to produce the teacher’s per-page decisions both with and without the accompanying page-level reasoning.
Training corpus from FinePDFs
We construct training data from FinePDFs (Kydlícek et al., 2025), a publicly available PDF-sourced corpus ( tokens, documents). We restrict to the English subset ( documents) and isolate finance content through a two-stage filter: Stage 1 is a high-recall keyword pass over a tiered finance lexicon, and Stage 2 is an XGBoost classifier over TF-IDF features trained on Stage-1 documents labeled by an LLM judge for finance vs. non-finance. The combined filter yields 12.3M finance documents ( tokens). Lexicon tiers, classifier details, and classification threshold tuning are in Appendix S.
From this pool we sampled 300K documents. Because FinePDFs lacks page markers, we re-fetch each PDF via its Common Crawl URL and re-OCR it per page, using FinePDFs’ per-page language list to verify page-count alignment and drop unsupported scripts; 150,448 documents () survive (Appendix P).
We then ran RICoT with the teacher model (Kimi-K2-Instruct [8]) over the 150,448 documents, producing 467,229 chunk-level samples (each chunk is one sliding-window span with the teacher’s interleaved reasoning, per-page decisions, and active_segment_carry_forward summary). Only 20,959 (13.9%) source documents contain two or more segments; the remaining 86% are self-contained single-segment documents, reflecting FinePDFs’ web-crawled provenance.
Chunk selection. We keep every multi-segment file and every special chunk in it (containing or immediately preceding a segment start, or ending the file), subsampling other chunks up to a cap. Single-segment files are downsampled within embedding clusters of the teacher’s free-form class labels, and truncated or single-page documents are dropped. The final corpus has 46,791 documents (20,959 multi-segment, 25,832 single-segment); caps will be included in the public release.
Training with and without page-level reasoning
Each training sample is a triple (SYS, CTX, OUT)—system instruction, stream context, chunk output—always rewritten together so the schema declared, carried, and produced agree. With probability 0.40 per chunk, the sample is rendered without page-level reasoning: the per-page <think> blocks are removed and the instruction no longer mentions reasoning, so the target is the teacher’s decisions alone; otherwise it keeps the teacher’s interleaved reasoning and decisions. One student thus serves both modes at deployment: with reasoning (Q3.5-2B*,PWT) and decisions only (Q3.5-2B*; § 5.2). A worked example of each will be included in the public release (Appendix R).
For operational convenience only, some samples also omit optional decision fields (e.g., document class, confidence, grounding) or the carry-forward progress field, so that one student accepts reduced or full schemas without retraining; is never removed, and we claim no accuracy contribution for this variation (Appendix § 24).
Training setup
We fine-tune Qwen-3.5-2B (Qwen Team, 2026) with QLoRA (Dettmers et al., [5]) of rank 32 (, dropout 0, target modules: all linear projections) for 1 epoch on the 46,791-document training corpus, with 1,800 samples held out for validation. We use cosine learning-rate schedule (, 8% warmup), AdamW-8bit, bf16 with gradient checkpointing, effective batch size 16 (per-device 8, grad-accumulation 2). Training took 44 hours on A100 80GB. The full hyperparameter set is in Appendix § 26. We report a single training run; we did not sweep the sampling probabilities of § 4.2 or the LoRA rank.
Experimental Setup
Datasets
We evaluate on three benchmarks spanning different domains and complexity levels (Table 1).
| TABME-250 | Tob800 | FinPSS | |
| Streams | 250 | 1 | 205 |
| Segments (docs) | 2,627 (1,542) | 153 | 685 |
| Pages | 7,271 (4,240) | 259† | 1,772 |
| Pages/stream | 29.1 / 27 / 3 / 81 | 259† | 8.6 / 5 / 2 / 82 |
| Segs/stream | 10.5 / 10 / 3 / 19 | 153† | 3.3 / 2 / 1 / 44 |
| Segment length | 2.8 / 1 / 1 / 20 | 1.7 / 1 / 1 / 17 | 2.6 / 2 / 1 / 66 |
Table 1. Test-set statistics. TABME segment/page counts shown as total (unique) since TABME composes its streams from a shared pool of source files (Appendix § 10). Stream statistics reported as avg/med/min/max; † Tobacco800 is evaluated as a single continuous stream, so per-stream distributional statistics do not apply.
TABME (Mungmeeprued et al., 2022). A large synthetic page-stream benchmark built from the Truth Tobacco Industry Documents archive, in which 44,769 source PDFs were concatenated into folders mimicking real folder length and type distributions. Each source PDF forms one ground-truth segment, so TABME provides a large, reproducible test of file-level segmentation. Inference cost on the full 5,000-stream test set is substantial, so we run prompting experiments on a fixed random subset of 250 streams (TABME-250; stream IDs in Appendix § 15); our distilled model is additionally evaluated on the full 5,000-stream test set, where numbers track the subset closely (DocF1 0.756 vs. 0.770 on ,PwT; § 6.1).
Tobacco800 (Lewis et al., 2006; University of California, San Francisco, 2007; Agam et al., [1]). A standard PSS benchmark from the same archive, containing scanned letters, memos, and reports. Following Wiedemann and Heyer (2020) and Mungmeeprued et al. (2022), we evaluate on the last 259 pages from 153 documents, ordered alphabetically by filename and treated as a single continuous stream. It is near ceiling and serves as a reference rather than discriminating benchmark.
FinancePSS-205 (new). 205 real-world page streams from production AP/AR workflows, mixing invoices, remittance advice, purchase orders, delivery receipts, statements, and email, with typical finance bundling (invoice–remittance pairs, PO–invoice matches, invoices nested in statements). Each stream is one file exactly as received, so boundaries between related same-vendor documents must be inferred from content. A new document starts wherever a page begins a document with its own transactional identity; labels were produced by the research team (no inter-annotator agreement study; see Limitations). We will release the de-identified page-level, spatially-aware text (the exact model input) with labels under CC BY-NC 4.0 (non-commercial research use) and the evaluation scripts under Apache-2.0; the dataset card and trivial baselines are in Appendix § 9.
We use only the test partitions of the public datasets; no training data from any benchmark is used in this work.
Models
Prompted LLMs. GLM-4.7-flash (GLM Team et al., [8]) is the 30B small variant of the GLM-4.7 family, our small-model prompting baseline—roughly the size of our distilled student; GLM-4.7 (GLM Team et al., [8]) is the full GLM-4.7 model; GLM-5 (GLM-5 Team, [7]) is a 744B-parameter Mixture-of-Experts model released under the MIT license by Z.ai; Claude Haiku 4.5 (Anthropic, [2]) is included as a non-GLM frontier prompted-model point of comparison. By default we run RICoT with each model’s internal extended thinking off (§ 6.4).
Distilled student. Qwen-3.5-2B (Qwen Team, 2026) distilled from Kimi-K2-Instruct (Kimi Team, [8]) as described in § 4; the base model prompted with RICoT without fine-tuning is reported as a control.
Table labels. G4.7-F for GLM-4.7-flash, G4.7 for GLM-4.7, G5 for GLM-5, C-H4.5 for Claude Haiku 4.5, and Q3.5-2B for the Qwen-3.5-2B base model. The distilled-student variants are denoted Q3.5-2B* (no pagewise thinking) and Q3.5-2B*,PwT (with pagewise thinking).
Evaluation metrics
We report five metrics spanning page, segment, and stream granularities. PageF1 (Heidenreich et al., [10, 9]) is page-level boundary-classification F1. B-F1 (Pottanigari et al., 2026) is the same F1 over adjacent-page decisions only, excluding each stream’s first page. DocF1 (Heidenreich et al., [9, 10]) is F1 over documents, each represented as the tuple of its page indices; a true positive is an exact tuple match. All F1 scores are micro-averaged over streams. MNDD (per-stream mean of Minimum Number of Drag-and-Drops) is a user-centric metric counting the minimum drag-and-drop operations needed to reconcile a prediction with the ground truth in a folder-management UI; lower is better. STP% (Straight-Through Pass) is the percentage of streams with zero boundary errors. All metrics are computed on the segment axis only and ignore class labels; the sub-document axis enters only through the with-expand rows (§ 3.4).
Baselines
Baselines are re-run on our infrastructure with the same backbones as RICoT.
Pairwise. Each adjacent page pair () is classified independently for whether starts a new document (Heidenreich et al., [9, 10]); window size , overlap . Internal extended thinking enabled (its strongest configuration per § 6.4).
Windowed. A fixed-size window of pages is shown to the LLM with a single decision prompt asking for boundary labels across the window; windows overlap by . Internal extended thinking enabled. The same single-call, multi-boundary design was proposed concurrently as MSBD (Pottanigari et al., 2026).
Implementation details
The RICoT sliding window is sized by a constant token budget (), a per-window page cap (), and a one-page overlap (); these were fixed a priori and held constant across all experiments (sweep in Appendix § 11). Pages whose tokenized length exceeds a fixed per-page threshold are truncated using a head-and-tail rule (first 500 + last 300 tokens, with an explicit truncation marker between), since segmentation signal concentrates at document openings and closings. All inference uses temperature 0.001 (top- 1) for both prompting and the distilled model. The inference configuration is described in Appendix § 29; structural prompt templates will be included in the public release.
Prompted results are single runs; distilled-model FinancePSS and Tobacco800 numbers are means of 5 inference runs. Run-to-run variability and confidence intervals are in Appendix § 10.
Results
FinancePSS cells read with-expand (no-expand), e.g. 0.832 (0.795); superscripts iT, PwT, * denote internal-thinking, pagewise-thinking, and fine-tuned runs, and em-dashes mark cells we did not run.
Headline cross-dataset results
Table 2 reports RICoT across all four prompted models and two distilled-model variants on the three benchmarks. The strongest prompted model (GLM-5) reaches DocF1 0.967 on Tobacco800 and 0.847 on TABME-250, and the strongest prompted-model FinancePSS configuration (GLM-4.7) reaches 0.832 with expand. The distilled 2B model (Qwen-3.5-2B*,PwT) reaches 0.785 on FinancePSS-205 and 0.770 on the full 5,000-stream TABME test set without exposure to TABME training data. Its gap to the strongest prompted model is 0.047 DocF1 on FinancePSS-205, 0.040 on Tobacco800, and 0.091 on TABME-250 (same streams). The same base Qwen-3.5-2B prompted with RICoT but without fine-tuning reaches only 0.445 / 0.396 / 0.281 on the three datasets, isolating the contribution of distillation from base-model capacity and framework prompts. The two student modes perform comparably (0.785 vs. 0.773 on FinancePSS-205, with overlapping intervals in Appendix § 10; 0.770 vs. 0.774 on full TABME), so page-level reasoning can be skipped at inference.
| Model | FinancePSS-205 DocF1 | FinancePSS-205 PageF1 | FinancePSS-205 MNDD | Tobacco800 DocF1 | Tobacco800 PageF1 | Tobacco800 MNDD | TABME-250 DocF1 | TABME-250 PageF1 | TABME-250 MNDD |
| G4.7-F | 0.762 (0.741) | 0.898 (0.884) | 1.005 (1.225) | 0.867 | 0.949 | 48.0 | 0.683 | 0.829 | 5.65 |
| G4.7 | 0.832 (0.795) | 0.916 (0.884) | 0.848 (1.255) | 0.961 | 0.987 | 7.0 | 0.794 | 0.892 | 3.31 |
| C-H4.5 | 0.776 (0.739) | 0.880 (0.831) | 1.172 (1.647) | 0.957 | 0.984 | 8.0 | 0.816 | 0.910 | 2.88 |
| G5 | 0.826 (0.769) | 0.906 (0.864) | 0.975 (1.422) | 0.967 | 0.987 | 3.0 | 0.847 | 0.922 | 2.40 |
| Q3.5-2B (base) | 0.445 | 0.688 | 3.103 | 0.396 | 0.664 | 167.0 | 0.281 | 0.563 | 14.62 |
| Q3.5-2B | 0.773 (0.763) | 0.904 (0.892) | 0.897 (1.079) | 0.914 | 0.954 | 26.6 | 0.753 / 0.774 | 0.873 / 0.894 | 4.56 / 4.21 |
| Q3.5-2B, PwT | 0.785 (0.779) | 0.901 (0.897) | 1.044 (1.073) | 0.927 | 0.965 | 18.6 | 0.756 / 0.770 | 0.885 / 0.896 | 4.20 / 4.30 |
Table 2. Headline cross-dataset results for RICoT. DocF1 / PageF1 higher is better; MNDD lower. FinancePSS numbers show with-expand outside parentheses and without-expand inside; without expand, predicted sub-document starts count as continuations, which is how TABME and Tobacco800 are scored throughout. TABME-250 / TABME-full reported separately for the distilled model. Bold marks the column best. fine-tuned rank-32 QLoRA; PwT pagewise thinking enabled. Full 5,000-stream TABME test set (vs. 250-stream prompting subset).
Comparison to prior published TABME baselines
Table 3 compares RICoT with published TABME results [9, 10] (Pottanigari et al. 2026). These span different test sets and OCR versions (table footnotes) and are indicative only. RICoT with GLM-5 (DocF1 0.847) beats the strongest published zero-shot decoder (GPT-4o-ZS) by +0.144 DocF1 and +32 STP points; the distilled 2B model on the full test set (0.770) beats the XGBoost and DiT baselines of Heidenreich et al. [9] and GPT-4o-ZS by +0.067. On boundary F1, we list for each model of Pottanigari et al. (2026) its best result across all their methods (PC, BD, MSBD), window sizes, and inputs: 0.866 (Claude Haiku 4.5), 0.887 (Gemini 3.1 Flash-Lite), and 0.876 (GPT-5.4-mini). RICoT, using text only, exceeds all of them: GLM-5 reaches 0.915 and Claude Haiku 4.5 0.901 (+0.035 over the same model’s best), and even the 2B students (0.890, 0.887) match or exceed them. None of our models approaches the fine-tuned LLMs (Phi-3-mini, Mistral-7B) trained on TABME’s training split; the gap reflects both TABME’s file-level segment granularity and genuine errors of our models (§ 6.6).
| Model | Type | Input | DocF1 | B-F1 | STP% | MNDD |
| XGBoost | FT | txt | 0.642 | – | 7.4 | 10.85 |
| DiT | FT | vis | 0.623 | – | 6.6 | 10.48 |
| Phi-3-mini | ZS | txt | 0.060 | – | 0.0 | 14.79 |
| Mistral-7B | ZS | txt | 0.368 | – | 1.4 | 21.15 |
| GPT-4o | ZS | txt | 0.703 | – | 9.4 | 7.79 |
| C-H4.5 (BD) | ZS | txt | – | 0.866 | – | – |
| Gemini-3.1-FL (MSBD) | ZS | vis | – | 0.887 | – | – |
| GPT-5.4-mini (BD) | ZS | vis | – | 0.876 | – | – |
| Phi-3-mini | FT | txt | 0.933 | – | 63.7 | 1.76 |
| Mistral-7B | FT | txt | 0.967 | – | 80.0 | 0.81 |
| C-H4.5 (RICoT) | ZS | txt | 0.816 | 0.901 | 33.6 | 2.88 |
| G5 (RICoT) | ZS | txt | 0.847 | 0.915 | 41.6 | 2.40 |
| Q3.5-2B (RICoT) | DIST | txt | 0.774 | 0.890 | 23.2 | 4.21 |
| Q3.5-2B, PwT (RICoT) | DIST | txt | 0.770 | 0.887 | 21.9 | 4.30 |
Table 3. TABME comparison against published baselines (Heidenreich et al., [9, 10]; Pottanigari et al. (2026)). ZS / FT: zero-shot vs. fine-tuned on TABME training split; DIST: distilled from teacher outputs on a FinePDFs subset, no TABME data. Input: OCR text (txt) or page images (vis). Bold: overall best; underline: best zero-shot; –: not reported. GPT-4o-ZS evaluated on a 10% subset; best result per model over all methods, window sizes, and inputs in Pottanigari et al. (2026) (TABME++; BD: pairwise); TABME-250; full 5,000-stream test set.
RICoT vs. pairwise and windowed paradigms
Table 4 reports DocF1 head-to-head against pairwise and windowed LLM-PSS baselines on all three datasets for the GLM family, with every method run on the same backbone (Tobacco800 has only one stream, but the single-stream DocF1 still differentiates configurations). On FinancePSS, RICoT is the best configuration for every model, by +0.154, +0.069, and +0.057 over the best baseline (GLM-4.7-flash, GLM-4.7, GLM-5). Without expand the margins are +0.133 and +0.032 and a tie on GLM-5 (§ 6.6). Context length does not explain the gain: in a control that keeps pairwise decisions but shows a symmetric 5-page context (GLM-4.7-flash, 5 runs; Appendix § 12), pairwise rises from 0.506 to 0.651, yet RICoT still leads it by +0.111 (+0.090 without expand) with 2.15 vs. ∼7.6 calls per stream. On the near-ceiling Tobacco800, RICoT wins for GLM-4.7 and GLM-5. On TABME-250, RICoT leads for GLM-4.7 (+0.052) and GLM-5 (+0.092), while for the small GLM-4.7-flash, pairwise classification with internal thinking is stronger (0.771 vs. 0.683), mirroring its Tobacco800 result.
| Method | Tobacco800 G4.7-F | Tobacco800 G4.7 | Tobacco800 G5 | FinancePSS-205 G4.7-F | FinancePSS-205 G4.7 | FinancePSS-205 G5 | TABME-250 G4.7-F | TABME-250 G4.7 | TABME-250 G5 |
| Pairwise | 0.886 | 0.888 | 0.872 | 0.506 | 0.763 | 0.739 | 0.771 | 0.704 | 0.697 |
| Windowed | 0.823 | 0.867 | 0.958 | 0.608 | 0.757 | 0.769 | 0.731 | 0.742 | 0.755 |
| RICoT | 0.867 | 0.961 | 0.967 | 0.762 | 0.832 | 0.826 | 0.683 | 0.794 | 0.847 |
| no expand | – | – | – | 0.741 | 0.795 | 0.769 | – | – | – |
Table 4. DocF1 of RICoT vs. pairwise and windowed LLM-PSS baselines on the same backbone. Baselines run with internal thinking (their best general configuration); RICoT without § 6.4. Expand applies to FinancePSS only. Bold: best per column.
Pagewise vs. internal extended thinking
Do RICoT’s gains overlap with models’ internal extended thinking? We run a ablation on GLM-4.7-flash crossing pagewise interleaved thinking with internal extended thinking across all three datasets (Table 5). Pagewise yields a positive DocF1 delta on every dataset; internal-thinking alone is positive only on FinancePSS and neutral-to-negative elsewhere; the two are roughly additive when combined. Per-page output-token costs differ by an order of magnitude: on FinancePSS-flash, pagewise adds ∼60 output tokens to gain +0.074 DocF1, while internal thinking adds ∼650 tokens for +0.028. The per-channel cost breakdown is in Appendix § 18. We therefore default to internal-thinking-off for all RICoT runs in this paper.
| Configuration | FinPSS | Tob. | TABME | Out toks |
| no-think (baseline) | 0.688 | 0.822 | 0.661 | 172 |
| internal only | +0.028 | −0.012 | −0.008 | 823 |
| pagewise only | +0.074 | +0.045 | +0.022 | 232 |
| both | +0.118 | +0.057 | +0.046 | 722 |
Table 5. 2×2 DocF1 deltas vs. no-think baseline on GLM-4.7-flash. Last column reports per-page output tokens on FinancePSS-flash.
Component ablations
Table 6 ablates each load-bearing component of RICoT on FinancePSS-205 across the three prompted GLM models by removing one component at a time and re-running. Pagewise thinking is the largest single contributor on all three models (−0.048 to −0.088 DocF1). Context propagation (reasoning history and active-segment summary ) matters most for GLM-5 (−0.048) and on long streams (Appendix § 13). Grounding is reliably positive for GLM-4.7-flash and GLM-5. Removing only the model-emitted carry-forward block is mixed, so the state-propagation story rests on the reasoning history; Appendix § 10 marks which deltas exceed run-to-run noise. Expand contributes +0.021 to +0.057. Per-dataset full ablation tables, including TABME and Tobacco800, are in Appendices § 19, § 20, and M.
| Configuration | G4.7-F | G4.7 | G5 |
| RICoT (full) | 0.762 | 0.832 | 0.826 |
| − pagewise thinking | 0.688 (−0.074) | 0.784 (−0.048) | 0.738 (−0.088) |
| − context propagation | 0.752 (−0.010) | 0.837 (+0.005) | 0.778 (−0.048) |
| − carry-forward block | 0.736 (−0.026) | 0.841 (+0.009) | 0.795 (−0.031) |
| − grounding | 0.695 (−0.067) | 0.831 (−0.001) | 0.755 (−0.071) |
| − expand (no-expand) | 0.741 (−0.021) | 0.795 (−0.037) | 0.769 (−0.057) |
Table 6. Component ablations on FinancePSS-205 DocF1. Each row removes one component from the full RICoT (with-expand) configuration; Δ shown in parentheses. “Carry-forward block” removes only the model-emitted .
Discussion
Segment granularity on TABME. TABME assigns one segment to each source file, whereas RICoT segments individual document instances and marks nested documents on its sub-document axis. Consistent with this difference, RICoT’s TABME errors are predominantly additional boundaries: page-level recall is at least 0.955 for every prompted model, against precision of 0.733–0.873 (Appendix § 16). To characterise these additional boundaries, we manually reviewed 100 false boundaries of Q3.5-2B* on the full test set (Appendix § 17). Weighted by how often each error recurs across streams, about 17% are genuine document starts within a single source file, which file-level labels merge (treating them as correct would raise precision from 0.836 to about 0.86); about 33% are nested documents, such as envelopes, attachments, and fax payloads, predicted as top-level rather than sub-document starts; about 33% are over-segmentations triggered by repeated headers or explicit continuations (“Page 2 of 2”); and the remaining 17% are ambiguous. The precision gap on TABME thus reflects both a difference in segment granularity and genuine model errors, and fine-tuning on TABME’s training split plausibly addresses both.
Expand on FinancePSS. On FinancePSS, expand drives a meaningful share of the gain for the larger models: without it, RICoT-GLM-5 ties the best baseline and RICoT-GLM-4.7 leads by +0.032; with it the margins become +0.057 and +0.069. GLM-4.7-flash wins regardless (+0.133 without expand). GLM-5 more often places bundled-packet boundaries on the sub-document axis rather than the segment axis; expand re-thresholds these detected starts, closing its gap to GLM-4.7 from 0.026 to 0.006.
Limitations
Our evaluation is restricted to English documents; multilingual streams—common in global enterprises—remain untested, and we did not evaluate on recent non-English open benchmarks (van Heusden et al., 2022, 2024). The discriminating evidence rests mainly on FinancePSS-205, which is modest in size (205 streams), curated rather than randomly sampled, labeled by the research team without an agreement study, and covers a single domain, so generalization to legal or medical content requires further validation; Tobacco800 is near ceiling, and TABME scores file-level segments, so its precision mixes granularity differences with model errors (§ 6.6). Run-to-run variability was measured with five repeats on GLM-4.7-flash (Appendix § 10) and assumed to transfer to the other models, whose results are single runs; the student was trained once, and the effect of omitting optional decision fields during training was not isolated. Model coverage spans one model family at three scales plus one non-GLM model. The framework assumes that the first page of a stream begins a document and treats each page image as one logical unit, with no granularity for multiple pages combined into a single scan. It relies on sequential continuity and cannot reassociate non-contiguous or interleaved pages into one document entity. Finally, recurrent state propagation makes within-stream processing strictly causal: multiple streams can be processed in parallel, but a single long stream must be processed sequentially.
Ethical Considerations
The FinancePSS dataset was collected from production workflows under the data-handling agreements in force at the time and pseudonymised: personal names, addresses, contact details, and account numbers were consistently replaced with type- and length-consistent synthetic values, preserving document structure. The planned release will contain only this de-identified text (no page images), which was audited for retained identifiers (Appendix § 9), and will be licensed for non-commercial research use (CC BY-NC 4.0) under terms of use that prohibit re-identification; because free-text pseudonymisation cannot fully exclude re-identification, we treat the release as pseudonymised rather than anonymous. No human annotators beyond the research team were employed for dataset labeling. AI writing assistance was used for portions of manuscript drafting; all scientific content, experimental design, results, and conclusions are entirely the authors’ own.
FinancePSS-205 Dataset Card
Access and license. The dataset is not yet public; it will be released together with the evaluation code, and the URL will be added in a future version of this preprint. Text and annotations will be licensed under CC BY-NC 4.0 for non-commercial research use, with separate terms of use prohibiting any attempt at re-identification; evaluation scripts under Apache-2.0.
Source and composition. 205 page streams (1,772 pages, 685 segments) as they arrived in production accounts-payable/receivable workflows; documents date from roughly 2024–2025. Each stream is one real bundle: there is no concatenation or reuse, and no stream is duplicated. The set is a curated selection, favouring streams that were fully processable and whose de-identification could be verified, so it is not an unbiased sample of the production distribution. Segment labels are free text with 144 distinct document types (Table 8).
| Document class | Segments |
| invoice | 330 |
| receipt | 35 |
| 18 | |
| bill of lading | 18 |
| statement | 15 |
| purchase order | 15 |
| delivery receipt | 15 |
| packing list | 12 |
| commercial invoice | 9 |
| hazmat driver checklist | 9 |
| other (134 types) | 209 |
Table 8. FinancePSS-205 document-class distribution (case-normalised labels).
Format. One UTF-8 text file per page in stream order, containing layout-preserving OCR text (no images, coordinates, or PDFs); financepss_gt.json lists each stream’s segments as (start_page, page_count, document_label), contiguous and tiling the stream; MANIFEST.json gives per-file SHA-256 prefixes. OCR noise is not corrected; 30 pages (1.7%) are empty after OCR.
Annotation. A new segment starts at the first page of each functionally distinct document. Labels were produced by the research team; no inter-annotator agreement is available for this version. The release encodes only the segment axis; sub-document annotations are planned for a later version.
De-identification. Personal names, addresses, contact details, and account and instrument numbers were replaced with type- and length-consistent surrogates, so identifier changes, a primary boundary cue, survive. An audit on 25 sampled streams found mean character similarity to the source of 0.579 with file lengths within 0.5%; Luhn-valid 13–19-digit strings occur at the chance rate (10.2%), indicating no retained card numbers. The release is pseudonymised rather than anonymous, and residual re-identification risk is not zero.
Difficulty. 48.3% of streams contain a single document, but these hold few of the documents: 46.7% of segments are single pages and the longest stream has 44. Trivial predictors therefore score low (Table 7).
| Predictor | DocF1 | B-F1 |
| Every page a document | 0.260 | 0.469 |
| Whole stream one document | 0.222 | 0.000 |
| RICoT, G4.7 (no expand) | 0.795 | – |
Table 7. Trivial predictors versus RICoT on FinancePSS-205 (micro-averaged).
Uncertainty Estimates
Run-to-run variability. Prompted results in the main paper are single runs, since multi-run coverage of every model × configuration was cost-prohibitive. To measure residual provider-side variability, we repeated the GLM-4.7-flash RICoT configuration 4 more times with identical code, configuration, and decoding (temperature 0.001, top- 1). Table 9 reports the 5-run means (paper run plus 4 repeats) with 95% CIs (Student’s , =5). The runs are genuinely independent: 92 of 205 FinancePSS streams receive different split counts across repeats. Every value reported in the main paper lies inside its CI. We treat differences smaller than the DocF1 band as inconclusive.
| Dataset | DocF1 | PageF1 | MND | STP% | Paper |
| FinPSS (exp.) | 0.762 | ||||
| FinPSS (no exp.) | 0.741 | ||||
| Tobacco800 | 0.867 | ||||
| TABME-250 | 0.683 |
Table 9. GLM-4.7-flash RICoT, 5-run mean ± 95% CI. “Paper”: the single-run DocF1 reported in the main tables. Tobacco800 is one 259-page stream, hence its wider band.
Implications for the main results.
Table 4, Tobacco800: only the GLM-4.7 margin over the best baseline (+0.073) exceeds the band; Tobacco800 margins are otherwise inconclusive.
Matched-context pairwise control (Appendix § 12): 0.651 0.008 over 5 runs; RICoT’s lead (+0.111 with expand, +0.090 without) is far outside both this spread and the run-to-run band.
Table 6: deltas with are within noise: context propagation on GLM-4.7-flash () and GLM-4.7 (+0.005), carry-forward block on GLM-4.7-flash () and GLM-4.7 (+0.009), grounding on GLM-4.7 (), and expand on GLM-4.7-flash (). The band was measured on GLM-4.7-flash and is assumed to transfer.
Bootstrap over streams. 95% CIs (10k resamples of streams) for the strongest configuration on each multi-stream dataset: FinancePSS with expand, GLM-4.7 0.832 [0.782–0.878] and GLM-5 0.826 [0.773–0.871]; TABME-250, GLM-5 0.847 [0.826–0.868]. Tobacco800 is a single stream, so its uncertainty is captured by the run-to-run band above.
Source-file reuse on TABME. TABME composes its 5,000 test streams from 2,238 source files, each used in 24.5 streams on average (range 9–42); this reuse is what lets a fixed archive yield a large and varied test set. A model’s error inside a file therefore recurs wherever the file appears: for Q3.5-2B⋆ on the full test set, the 9,331 false boundaries fall on only 1,071 distinct (file, page) sites, and the 10% of files with the most false boundaries hold 87% of them. Streams are thus not independent units. Resampling streams (10k resamples) gives B-F1 0.890 [0.887–0.893], while resampling source files gives [0.877–0.902], about four times wider; counting each source file once gives B-F1 0.896. We therefore recommend file-level resampling for model comparisons on the full TABME test set. On TABME-250 reuse is much lower (2,627 segments from 1,542 unique files; Table 1), so stream-level intervals there are less affected.
Distilled student (5 inference runs). The student was trained once. FinancePSS DocF1 with expand: 0.773 (0.763–0.782) for Q3.5-2B⋆ and 0.785 (0.772–0.797) for Q3.5-2B⋆,PwT; Tobacco800: 0.914 (0.897–0.930) and 0.927 (0.898–0.956).
Window-Parameter Sweep
On GLM-4.7-flash / FinancePSS we replaced RICoT’s token-budget packing with static windows of pages and overlap , one run per configuration (Table 10). Overlap 1 is best: at =4, raising from 1 to 3 increases cost from 3.16 to 8.50 calls per stream while DocF1 falls from 0.763 to 0.728. Smaller windows are more accurate but costlier: =2 reaches 0.806 (0.811 without expand) at about 4 the calls of the default, which trades 0.03–0.06 DocF1 for that cost; it was chosen for cost, not tuned for accuracy. Since each page is capped at 800 tokens, =3600 admits at least 4 pages, and =6 bounds the window from above, so the effective window floats within this band. The token-budget setting reaches 0.777 at 2.15 calls per stream, matching static =5 (0.780) and beating static =6 (0.766) at identical cost. MNDM ranges only 0.86–1.21 across configurations, within its noise, so it does not discriminate between them.
| DocF1 | (no exp.) | PageF1 | calls | ||
| 2 | 1 | 0.806 | 0.811 | 0.917 | 8.50 |
| 3 | 1 | 0.788 | 0.768 | 0.909 | 4.44 |
| 4 | 1 | 0.763 | 0.760 | 0.897 | 3.16 |
| 4 | 2 | 0.762 | 0.766 | 0.892 | 4.44 |
| 4 | 3 | 0.728 | 0.715 | 0.891 | 8.50 |
| 5 | 1 | 0.780 | 0.750 | 0.904 | 2.49 |
| 5 | 2 | 0.770 | 0.751 | 0.900 | 3.16 |
| 5 | 3 | 0.777 | 0.739 | 0.904 | 4.44 |
| 6 | 1 | 0.766 | 0.749 | 0.887 | 2.15 |
| 7 | 1 | 0.760 | 0.745 | 0.897 | 1.92 |
| =3600, =6 | 0.777 | 0.755 | 0.907 | 2.15 |
Table 10. Window-parameter sweep, GLM-4.7-flash, FinancePSS-205, single runs. DocF1/PageF1 with expand; no-expand DocF1 in the fourth column. “calls”: LLM calls per stream.
Matched-Context Pairwise Control
To test whether RICoT’s gain is a context-length effect, we keep the pairwise decision paradigm (one independent call per page, predicting only that page’s label, no carried state or joint decoding) but show a symmetric 5-page window () instead of (). Pages use the same head-500/tail-300 truncation as the Windowed baseline, so per-decision context is compa rable to Windowed and RICoT windows. GLM-4.7-flash, internal thinking on (as for the other baselines), temperature 0.001; 5 full runs on FinancePSS-205, all 205 streams with no parse failures.
Results. DocF1 0.651 ± 0.008 (PageF1 0.852 ± 0.006, 95% CI). Context matters: it lifts pairwise from 0.506 to 0.651, which accounts for Windowed’s advantage over pairwise (0.608). With context matched, RICoT still leads by +0.111 (+0.090 without expand), far outside the CI.
Cost. The control makes 7.6 calls per stream (one per page after the first, each re-sending up to 5 pages) versus RICoT’s 2.15; each call uses 2,860 input and 1,277 internal-thinking tokens on average, whereas RICoT runs with internal thinking off.
Long Streams and Error Propagation
Depth-stratified state propagation. On the 17 longest FinancePSS streams, restricting to deep pages (windows ≥ 5), full RICoT outperforms the no-context-propagation ablation by +0.178 DocF1 (GLM-5) and +0.131 (GLM-4.7), while the effect is negative for GLM-4.7-flash. Recurrent state therefore matters most where it is exercised (long streams) and for models with the capacity to use it; on short streams, which fit in one or two windows, it has little to act on.
Error cascading. Mapping boundary errors to windows shows local persistence rather than systematic corruption: the next-window error rate is 50–71% after an erroneous window versus 5–12% after a correct one, yet 54–69% of streams with an early error later produce an error-free window (median error run: 2 windows). This analysis is observational; a causal estimate would require replay with corrected state.
Worked Inference Example
Below is the teacher output for the first window (pages 1–2 of 4 shown) of a FinePDFs stream, in the full schema used for distillation. Per-page reasoning precedes each decision; the grounding fingerprint names the identifiers that define the active segment, and later pages cite fulfillment evidence against it. Because this is the first window, no reasoning history or active-segment summary is passed in; from the second window on, carries the most recent reasoning–decision pairs in this same format, and carries the active segment’s start page, class, pages covered, and the model-emitted carry-forward block. The complete chunk, including its two decisions-only renderings (Appendix R), will be included in the public release, with the verbatim instruction prose withheld (Appendix T).
<analyze_page> First page of the stream. Header clearly
identifies this as a SEC Form 10-K annual report for Landec
Corporation, fiscal year ended October 28, 2001, with
commission file number 0-27446. Active segment resets to SEC
Form 10-K annual report grounded by Landec Corporation, FY
2001, file number 0-27446. </analyze_page>
<decision> <page>1</page>
<segment_boundary> <type>SEGMENT_START</type>
<document_class>SEC Form 10-K annual
report</document_class>
<grounding> <fingerprint>Landec Corporation, FY ended
10/28/2001, Commission file number 0-27446</fingerprint>
<initiation_evidence>Header Dominance: SEC Form 10-K
header with clear company identifier, fiscal year, and
commission file number; first page of
stream</initiation_evidence></grounding>
<confidence>high</confidence></segment_boundary>
<page_role>cover page with company information and
securities registration details</page_role> </decision>
<analyze_page> Page 2 continues the same Form 10-K document
with “LANDEC CORPORATION ANNUAL REPORT ON FORM 10-K” header
and table of contents listing Items 1–14. [...] No new
segment initiation signals present. </analyze_page>
<decision> <page>2</page>
<segment_boundary> <type>SEGMENT_CONTINUATION</type>
<grounding> <fulfillment_evidence>Same Form 10-K document
continuation, table of contents follows cover page
structure, consistent company name and document
type</fulfillment_evidence></grounding>
<confidence>high</confidence>
<sub_document_start>none</sub_document_start>
<page_role>table of contents and beginning of Part
I</page_role> </decision>
TABME-250 Stream IDs
The 250 TABME stream IDs used for all prompting experiments were sampled uniformly at random from TABME’s 5,000-stream test split with a fixed seed and held constant across runs:
2492, 1410, 1806, 1699, 2082, 2914, 1944, 3341, 4049, 4073, 2664, 2227, 1672, 2658, 2835, 2024, 2099, 758, 1374, 2002, 3178, 4357, 3601, 1295, 4428, 134, 3494, 2527, 4925, 176, 1965, 4676, 701, 1492, 2327, 4195, 2997, 4865, 225, 1994, 4981, 3060, 2037, 575, 3342, 1517, 3121, 705, 2449, 204, 3614, 440, 2233, 4297, 2162, 4230, 1863, 3107, 2826, 3273, 1089, 3823, 4807, 409, 2605, 2794, 2499, 2845, 1320, 4997, 638, 3191, 1464, 601, 1223, 2791, 3144, 3678, 3659, 650, 2810, 3403, 3540, 2984, 1685, 2817, 4879, 1943, 3412, 4797, 1695, 554, 2866, 813, 3749, 367, 1325, 1638, 1494, 1970, 1509, 42, 2060, 1381, 1760, 4188, 619, 172, 331, 3695, 1399, 3172, 946, 3794, 4975, 1175, 3756, 3687, 1383, 2917, 3688, 4758, 714, 2665, 566, 226, 4821, 4661, 1645, 3663, 4370, 1642, 3498, 3055, 3543, 2606, 3203, 2136, 4858, 989, 1969, 4098, 4362, 2895, 1713, 2278, 1352, 4967, 3934, 1789, 3929, 2532, 2941, 1807, 4933, 2830, 3536, 2859, 3185, 4783, 1395, 402, 2964, 2715, 2117, 1892, 3175, 3503, 3522, 1006, 2581, 4912, 3889, 2334, 4482, 3186, 2422, 2106, 1487, 1237, 950, 1773, 1157, 2870, 3070, 4806, 4825, 3149, 4882, 1179, 3857, 3210, 4991, 844, 2153, 2858, 1061, 4378, 642, 4574, 4533, 471, 2766, 1723, 4900, 786, 746, 3501, 1362, 4893, 4376, 4107, 858, 3825, 1598, 4911, 2088, 2955, 3285, 308, 1465, 1840, 4090, 4270, 485, 4192, 4265, 4598, 242, 3747, 3572, 2772, 2103, 1756, 3923, 2398, 4604, 1143, 2785, 3097, 2860, 854, 1266, 1421, 1423, 1573, 2399, 4253, 4423, 4464
Our distilled 2B model is additionally evaluated on the full 5,000-stream test set (TABME-full); the subset / full numbers track closely (DocF1 0.756 vs. 0.770 for Qwen-3.5-2B⋆,PwT), supporting the 250-stream subset as representative of the full distribution.
TABME Page-Level Precision/Recall
Table 11 reports page-level precision and recall on TABME-250 under RICoT prompting. Recall is on every prompted model and precision spans 0.733–0.873, so errors are mostly extra boundaries rather than missed ones. The distilled student shows the same shape on the full test set (boundary-level precision 0.836, recall 0.951, B-F1 0.890). Appendix § 17 analyses these extra boundaries: some are document starts that TABME’s file-level labels merge, but most are errors of the model.
| Model | PageP | PageR | Gap |
| G4.7-F | 0.733 | 0.955 | +0.222 |
| G4.7 | 0.832 | 0.962 | +0.130 |
| C-H4.5 | 0.861 | 0.965 | +0.104 |
| G5 | 0.873 | 0.978 | +0.105 |
Table 11. TABME-250 page-level precision/recall under RICoT prompting.
TABME False Boundaries: Error Analysis
Setup. We analyse the false boundaries (FPs) of Q3.5-2B⋆ (RICoT, no pagewise thinking) on the full 5,000-stream test set, scoring sub-document starts as continuations as in all our metrics (§ 5.3): precision 0.836, recall 0.951, B-F1 0.890, 9,331 FPs. We sampled 100 FPs: 45 at random (one per stream) and 55 as one error site per source file, from files not already sampled; they cover 98 distinct (file, page) sites. Each was judged by hand from the OCR text, and 25 of them, including every A1 site, were also checked against the page images; this changed one label (a magazine letters page first judged to come from another issue was the next page of the same issue).
Categories. A1: a genuine top-level document begins inside one source file (e.g. two separate funding records filed together); TABME’s file-level label merges them. A2: a genuine nested document (envelope, enclosure, attachment, fax payload) that the model emitted as a top-level start. In our framework the correct output is a sub-document start, which the metric scores as continuation, so A2 is a model error: the right document at the wrong level. B: no document starts here; the page continues the same document. C: ambiguous (archive slip sheets, near-empty pages, unreadable OCR).
Findings. Table 12 gives the breakdown. A1 and A2 sites recur more often than B sites (17 vs. 9.6 across the test set): short files such as a letter and its envelope, or a memo and its attachment, appear in many streams. Per occurrence, A1 accounts for about 17% of the FPs; counting these pages as correct raises precision from 0.836 to about 0.86. A1 also includes convention cases, such as a second copy of a form or a technical sheet followed by its safety data sheet. About two thirds of the FPs (A2 and B) are errors of the model. The B errors follow a few patterns: (i) later pages that repeat the title block, project or estimate number, or carry “Page of ”; (ii) section, table and figure headings inside a long document; (iii) title slides or cover pages inside a deck or brochure; (iv) back sides and stamp pages (e.g. the endorsement side of a check); and (v) a memo that follows its own distribution page.
| Weighting | A1 | A2 | B | C |
| Per sampled case () | 14 | 27 | 44 | 15 |
| Per distinct site (98) | 13 | 27 | 45 | 15 |
| Per FP occurrence | 17 | 33 | 33 | 17 |
Table 12. Share (%) of TABME false boundaries by category, Q3.5-2B⋆, full test set. “Per FP occurrence” weights each site by how often it is a false boundary across the test set. Each share is uncertain by about ±10 points.
Separate documents within one source file. Figure 3 shows four A1 cases, in which the page the model marked as a new document begins a separate document filed in the same source PDF; TABME’s file-level label counts each boundary as an error. (a) Two check transmittal forms of the Council for Tobacco Research for the same grant, one for the third and one for the fourth quarterly payment (stream 0390, p. 11; a false boundary in 18 of the 33 streams containing the file). (b) Product-test summaries of two different projects, with different samples and results (stream 3712, p. 7; 27 of 29). (c) Two separate bibliographic database printouts, each with its own print number, “PAGE 1” header and end-of-print marker (stream 0065, p. 4; 11 of 32). (d) Compiled funding records: a grant followed by a contract to a different recipient, with its own activation date and amount (stream 0211, p. 14; 28 of 28).

Figure 3. Separate documents inside a single TABME source file. In each pair, the right page (red border) is where the model started a new document; TABME’s ground truth treats it as a continuation of the left page (grey border) because both belong to the same source PDF.
Token-Cost Breakdown
Table Table 13 expands the cost figures in § 6.4 with per-channel breakdowns, all on GLM-4.7-flash with FinancePSS-205 input. Input is approximately constant across modes; output variation is dominated by the internal-thinking budget, which constitutes 73%–82% of total output in internal modes. When internal thinking is on, external pagewise-thinking tokens drop from 72 to 44 (∼39% reduction), evidence of partial substitution between the two reasoning channels.
| Mode | In | Out | Int. | Ext. | Dec. | C-fwd |
| no-think | 752 | 172 | 0 | 0 | 142 | 21 |
| pagewise | 797 | 232 | 0 | 72 | 126 | 20 |
| windowed | 772 | 251 | 0 | 83 | 128 | 20 |
| int.+pagewise | 767 | 722 | 528 | 44 | 115 | 16 |
| int. only | 736 | 823 | 674 | 0 | 110 | 17 |
Table 13. Per-page output-token cost on GLM-4.7-flash, FinancePSS-205, broken out by component. Input is roughly constant across modes. Int. = internal reasoning tokens; Ext. = external (pagewise) reasoning tokens.
Interleaved-Thinking Ablation (Full)
Table Table 14 expands the pagewise-thinking ablation across all three datasets and all three prompted models. The think row is the full RICoT configuration with pagewise thinking; windowed_think re-places the interleaved per-page reasoning with a single block of reasoning emitted before the window-level decisions; wo_think disables structured reasoning entirely. FinancePSS uses with-expand.
| Dataset | Configuration | G4.7-F | G4.7 | G5 |
| FinancePSS | think (full) | 0.762 | 0.832 | 0.826 |
| FinancePSS | windowed_think | 0.754 | 0.814 | 0.746 |
| FinancePSS | wo_think | 0.688 | 0.784 | 0.738 |
| Tobacco800 | think (full) | 0.867 | 0.961 | 0.967 |
| Tobacco800 | windowed_think | 0.846 | 0.968 | 0.981 |
| Tobacco800 | wo_think | 0.822 | 0.942 | 0.981 |
| TABME-250 | think (full) | 0.683 | 0.794 | 0.847 |
| TABME-250 | windowed_think | 0.677 | 0.805 | 0.847 |
| TABME-250 | wo_think | 0.661 | 0.762 | 0.829 |
Table 14. Interleaved-thinking ablation, DocF1 by dataset and model.
State-Propagation Ablation (Full)
Table Table 15 expands the state-propagation ablation across all three datasets and three models. The full RICoT configuration carries both the reasoning history (“cognitive trace”) and the active-segment summary (which includes the model-emitted active_segment_carry_forward block) across windows.
| Dataset | Configuration | G4.7-F | G4.7 | G5 |
| FinancePSS | full | 0.762 | 0.832 | 0.826 |
| FinancePSS | only_cognitive_trace | 0.748 | 0.824 | 0.766 |
| FinancePSS | only_active_segment | 0.749 | 0.801 | 0.786 |
| FinancePSS | no_carry_forward | 0.736 | 0.841 | 0.795 |
| FinancePSS | no_context_prop. | 0.752 | 0.837 | 0.778 |
| Tobacco800 | full | 0.867 | 0.961 | 0.967 |
| Tobacco800 | only_cognitive_trace | 0.887 | 0.971 | 0.981 |
| Tobacco800 | only_active_segment | 0.892 | 0.935 | 0.968 |
| Tobacco800 | no_carry_forward | 0.910 | 0.968 | 0.967 |
| Tobacco800 | no_context_prop. | 0.892 | 0.961 | 0.977 |
| TABME-250 | full | 0.683 | 0.794 | 0.847 |
| TABME-250 | only_cognitive_trace | 0.692 | 0.799 | 0.854 |
| TABME-250 | only_active_segment | 0.668 | 0.789 | 0.818 |
| TABME-250 | no_carry_forward | 0.677 | 0.816 | 0.855 |
| TABME-250 | no_context_prop. | 0.670 | 0.751 | 0.796 |
Table 15. State-propagation ablation, DocF1.
Decision-Block Ablation (Full)
only_cognitive_trace keeps only ; only_active_segment keeps only ; no_carry_forward drops the model-emitted carry-forward block but keeps the deterministic summary; no_context_propagation disables all cross-window state.
The cognitive trace is consistently load-bearing (removing it hurts noticeably), while the carry-forward block is mixed across models—supporting the framing in § 6.5 that the state-propagation story rests on the cognitive trace rather than carry-forward specifically.
Decision-Block Ablation (Full)
Table Table 16 ablates the per-page decision schema. barebone drops everything except and ; no_auxiliary drops auxiliary tags (, ); no_grounding drops the fingerprint and evidence quote; no_nested drops the sub-document axis . The pattern inverts with model size: smaller models often pay a capacity tax for schema overhead, while larger models are roughly invariant or benefit from the structure.
| Dataset | Configuration | G4.7-F | G4.7 | G5 |
| FinancePSS | full | 0.762 | 0.832 | 0.826 |
| FinancePSS | barebone | 0.708 | 0.772 | 0.760 |
| FinancePSS | no_auxiliary | 0.775 | 0.809 | 0.770 |
| FinancePSS | no_grounding | 0.695 | 0.831 | 0.755 |
| FinancePSS | no_nested | 0.740 | 0.812 | 0.746 |
| Tobacco800 | full | 0.867 | 0.961 | 0.967 |
| Tobacco800 | barebone | 0.939 | 0.961 | 0.987 |
| Tobacco800 | no_auxiliary | 0.910 | 0.971 | 0.971 |
| Tobacco800 | no_grounding | 0.851 | 0.967 | 0.977 |
| Tobacco800 | no_nested | 0.824 | 0.968 | 0.977 |
| TABME-250 | full | 0.683 | 0.794 | 0.847 |
| TABME-250 | barebone | 0.661 | 0.812 | 0.851 |
| TABME-250 | no_auxiliary | 0.672 | 0.804 | 0.849 |
| TABME-250 | no_grounding | 0.647 | 0.791 | 0.841 |
| TABME-250 | no_nested | 0.656 | 0.802 | 0.845 |
Table 16. Decision-block ablation, DocF1.
Class labels. Table 16 does not isolate the class labels, so we ablated them separately on GLM-4.7-flash / FinancePSS, 5 runs each, removing each label from prompt, output, and parser (Table 17). The top-level class is never scored; the sub-document class is a direct input to the with-expand protocol, which promotes a nested start only when its predicted class is in the priority set. Removing both labels changes DocF1 by −0.011, within noise, so the top-level label is metric-neutral; we keep it as a reasoning scaffold (naming the active document anchors the continuation test) and because it is the field downstream routing consumes. The sub-document label is what lifts the full model from 0.739 (no-expand) to 0.753 (with expand); removing it removes that gain by construction. For pure segment boundaries the nested axis can be dropped at no cost: removing only the sub-document class is neutral on F1 and lowers MNDD.
| Configuration | DocF1 | PageF1 | MNDD |
| Full, with expand | |||
| Full, no expand | |||
| − sub-document class | |||
| − both class labels |
Table 17. Class-label ablation, GLM-4.7-flash, FinancePSS-205, 5-run mean ± 95% CI. Without the sub-document class, with- and no-expand scores coincide.
Per-Dataset Full Result Dumps
Complete per-dataset result tables—all metrics (DocF1, PageF1, PageP, PageR, MNDD, STP%); all backbone×method×ablation combinations; both with-expand and without-expand variants on FinancePSS—will be included in the public release.
Training-Sample Configuration
Table 18 lists the probabilities used when rendering training samples (§ 4.2): the chunk-level probability of omitting page-level reasoning (first row) and the per-field probabilities of omitting optional decision and carry-forward fields. The two are sampled independently. Values were set heuristically, weighted by field importance, and not subjected to hyperparameter sweeps owing to compute constraints.
| Omitted content | Probability |
| Pagewise reasoning blocks (chunk-level) | 0.40 |
| Per-page: document_class | 0.20 |
| Per-page: confidence | 0.20 |
| Per-page: grounding (fingerprint+evidence) | 0.20 |
| Per-page: sub_document nested instance | 0.15 |
| Carry-forward: progress field | 0.30 |
Table 18. Probabilities of omitting content when rendering training samples (§ 4.2).
Note. The probabilities above are working values used in the single training run reported in the paper. We did not sweep them; their effect on accuracy remains unexplored.
Training Corpus Attrition Breakdown
Table 19 summarizes the per-stage attrition of the FinePDFs-derived training corpus. Of the 300K candidate documents sampled from the 12.3M-document finance subset, roughly 50% survive download and language-alignment filtering. The main attrition stages are: failed Common Crawl fetch (cache miss / dead URL), page-count mismatch between the downloaded PDF and FinePDFs metadata (indicating unreliable OCR alignment), and detection of pages in scripts unsupported by our OCR model. The surviving 150,448 documents feed into teacher labeling.
| Stage | Count |
| FinePDFs (English subset) | 206M docs |
| Finance filter (stages 1+2) | 12.3M docs |
| Sampled for training pool | 300K docs |
| Download, re-OCR, language filter | 150,448 docs |
| Teacher labeling (chunk samples) | 467,229 chunks |
| Final training corpus | 46,791 docs |
| multi-segment | 20,959 |
| single-segment | 25,832 |
Table 19. Training corpus construction pipeline.
Training Hyperparameters
Full QLoRA hyperparameters used for Qwen-3.5-2B fine-tuning (§ 4.3):
LoRA rank 32; ; dropout 0; target modules q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj.
Optimizer: AdamW-8bit; weight decay 0.01; max grad norm 1.0.
Learning rate: with cosine schedule and 8% warmup ratio.
Batch size: per-device 8, gradient-accumulation 2 (effective 16); evaluation batch size 32.
Epochs: 1; validation split 1% (1,800 samples).
Precision: bf16; gradient checkpointing on.
Hardware: 4×NVIDIA A100 80GB; wall-clock 44 hours.
Worked Training-Sample Example
A complete example showing the same source chunk rendered into a training sample (i) with all schema fields present and pagewise reasoning emitted, (ii) without page-level reasoning (decisions only), and (iii) decisions only, with several optional decision fields also omitted, will be included in the public release.
FinePDFs Finance-Filter Classifier
The Stage 1 finance lexicon contains three tiers of keyword patterns of increasing specificity (high-confidence finance terms, moderate-confidence terms, and disambiguation terms used to distinguish between finance vs. accounting vs. marketing contexts). The Stage 2 XGBoost classifier was trained on 100K Stage-1-surviving documents labeled by an LLM judge (prompted to apply binary finance vs. non-finance labels using a detailed rubric); we used TF-IDF features with a 50K-term vocabulary capped at unigrams and bigrams. The decision threshold was tuned on a 5K-document held-out set to maximize (precision-weighted). The lexicon files, the LLM-judge prompt, and the fitted TF-IDF vectorizer will be included in the public release.
Prompt Templates and Inference Configuration
Structural prompt templates for RICoT and both baselines (task framing, stream-context format, and per-page decision schema) will be included in the public release; the verbatim instruction prose is withheld. All inference runs use temperature 0.001 and top- 1; other sampling parameters are left at each provider’s defaults. Internal extended thinking is explicitly disabled in the RICoT runs and enabled in the baseline runs. Residual provider-side nondeterminism is quantified in Appendix § 10.
Pseudocode for the RICoT Inference Loop
Algorithm 1 gives the full inference-time procedure referenced in § 3.3.
Algorithm 1 RICoT page-stream segmentation
Require: Stream , token budget , page cap , overlap , history size
Ensure: Decisions
; ; ; ;
while pages remain do
// greedy until budget or cap
tag with
<stream>/</stream>if first/last// cache-fill, retry, fallback
; append to
last pairs of
if then
metadata from new segment
else
end if
( if final window)
end while
return
References
- [1]Gady Agam, Shlomo Argamon, Ophir Frieder, David Grossman, and David D. Lewis. 2006. The complex document image processing (CDIP) test collection. Technical report, Illinois Institute of Technology.
- [2]Anthropic. 2025. Introducing Claude Haiku 4.5. Anthropic blog post. https://www.anthropic.com/news/claude-haiku-4-5.
- [3]Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150.arxiv.org/abs/2004.05150
- [4]Fabricio Ataides Braz, Nilton Correia da Silva, and Jonathan Alis Salgado Lima. 2021. Leveraging effectiveness and efficiency in Page Stream Deep Segmentation. Engineering Applications of Artificial Intelligence, 105:104394.
- [5]Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. 2023. QLoRA: Efficient finetuning of quantized LLMs. In Advances in Neural Information Processing Systems, volume 36.arxiv.org/abs/2305.14314
- [6]Patricia Medyna Lauritzen de Lucena Drumond, Lindeberg Pessoa Leite, Teofilo E. de Campos, and Fabricio Ataides Braz. 2023. LayoutQT—Layout Quadrant Tags to embed visual features for document analysis. Engineering Applications of Artificial Intelligence, 122:106091.
- [7]GLM-5 Team. 2026. GLM-5: from vibe coding to agentic engineering. arXiv preprint arXiv:2602.15763.
- [8]GLM Team, Aohan Zeng, et al. 2025. GLM-4.5: Agentic, reasoning, and coding (ARC) foundation models. arXiv preprint arXiv:2508.06471. Z.ai. The GLM-4.7 family used in our experiments is a subsequent release in the same line; see https://github.com/zai-org/GLM-4.5 for model cards.
- [9]Hunter Heidenreich, Ratish Dalvi, Rohith Mukku, Nikhil Verma, and Neven Pičuljan. 2024. Large language models for page stream segmentation. Preprint, arXiv:2408.11981.arxiv.org/abs/2408.11981
- [10]Hunter Heidenreich, Ratish Dalvi, Nikhil Verma, and Yosheb Getachew. 2025. Page stream segmentation with LLMs: Challenges and applications in insurance document automation. In Proceedings of the 31st International Conference on Computational Linguistics: Industry Track, pages 305–317, Abu Dhabi, UAE. Association for Computational Linguistics.
- [11]Hakan Inan, Rashi Rungta, and Yashar Mehdad. 2022. Structured summarization: Unified text segmentation and segment labeling as a generation task. Preprint, arXiv:2209.13759.arxiv.org/abs/2209.13759