# XY-Cut++: Advanced Layout Ordering via Hierarchical Mask Mechanism

> Analysis of XY-Cut++ (arXiv 2025), which extends the classic XY-Cut algorithm with pre-mask processing, multi-granularity segmentation, and cross-modal matching for block-level reading order recovery, along with the DocBench-100 benchmark.

- Authors: Hunter Heidenreich
- Published: 2026-04-02
- Paper: Preprint (arXiv) <https://arxiv.org/abs/2504.10258>
- Benchmark: DocBench-100 <https://arxiv.org/abs/2504.10258>
- Source: Bevaya Labs, <https://labs.bevaya.ai/>

---


## TL;DR

XY-Cut++ extends the classic XY-Cut projection-based algorithm with three complementary components: pre-mask processing to remove highly dynamic layout elements before sorting, multi-granularity segmentation using density-driven adaptive splitting to handle complex multi-column layouts, and cross-modal matching that reinstates masked elements into the ordered sequence using semantic priority and geometric distance metrics. The authors also introduce DocBench-100, a 100-page block-level benchmark with annotations across complex and regular layout subsets. On DocBench-100, XY-Cut++ achieves 98.8 BLEU-4 overall while running at 514 FPS on CPU (ordering module only), outperforming both classic projection methods and learning-based baselines in accuracy.

## What kind of paper is this?

**Dominant:** $\Psi\_{\text{Method}}$: The core contribution is the XY-Cut++ algorithmic framework. The paper is structured around ablations of each component, comparisons against baselines, and analysis of design choices such as the density threshold and geometric distance weights. The algorithm and its performance are the central focus.

**Secondary:** $\Psi\_{\text{Resource}}$: The paper introduces DocBench-100, a focused 100-page benchmark with block-level reading order annotations, emphasizing multi-column and complex page topologies that existing datasets underrepresent.

## What is the motivation?

Document reading order recovery is a prerequisite for downstream applications such as RAG pipelines and LLM preprocessing: if blocks are ordered incorrectly, text chunking and context windows will contain semantically incoherent sequences. Three specific challenges motivate this work:

1. **Complex layouts.** Multi-column newspapers, nested text boxes, non-rectangular text regions, and cross-page content routinely defeat the classic XY-Cut algorithm, which relies on clean projection-cut separability. The algorithm's rigid threshold mechanism causes hierarchical errors when L-shaped inputs span multiple columns.

2. **Cross-modal alignment overhead.** Learning-based methods such as LayoutReader are capable of handling complex layouts but carry prohibitive latency (around 22 FPS averaged across benchmarks) that makes them impractical in production document parsing pipelines.

3. **Lack of block-level benchmarks.** Existing datasets such as ReadingBank annotate at the word level, making it difficult to evaluate block-level structural reasoning directly. OmniDocBench provides block-level support but has sparse coverage of domain-specific complex layouts such as newspapers and multi-column technical documents.

The authors identify that many hard cases for XY-Cut stem from L-shaped inputs: regions that span multiple columns create false projection gaps and cause the recursive split to propagate errors into all subsequent ordering decisions. Their key observation is that temporarily masking such elements before the projection stage and then reinserting them afterwards is both highly effective and computationally cheap.

## What is the novelty?

XY-Cut++ is a heuristic, geometry-aware algorithm with shallow semantic augmentation. It requires no neural training and operates entirely on the bounding box coordinates and coarse semantic labels produced by any layout detection model (the paper uses PP-DocLayout). The pipeline has four stages: layout detection, pre-mask processing, multi-granularity segmentation, and cross-modal matching.

### Pre-Mask Processing

Elements with high positional flexibility (titles, figures, tables) are identified via semantic labels and temporarily excluded from the subsequent XY-Cut passes. This directly addresses the L-shape problem: once these spanning elements are masked, the remaining text blocks form clean separable regions for projection-based splitting.

### Multi-Granularity Segmentation

Segmentation proceeds through three phases:

**Phase 1: Cross-Layout Detection.** An adaptive threshold $T\_l$ is computed from the median bounding-box width across all content blocks $\\{B\_i\\}$:

$$T\_l = \beta \cdot \text{median}(\\{l\_i\\}\_{i=1}^N)$$

with $\beta = 1.3$ as an empirically tuned scaling factor. A block $B\_i$ is classified as a cross-layout element if its width exceeds $T\_l$ and its horizontal projection overlaps with at least two other blocks:

$$C\_{\text{cross}}(B\_i) = \begin{cases} 1 & l\_i > T\_l \land \sum\_{j \ne i} I\_{\text{overlap}}(B\_i, B\_j) \ge 2 \\ 0 & \text{otherwise} \end{cases}$$

**Phase 2: Geometric Pre-Segmentation.** Central title elements and isolated graphical components are identified using a centrality and isolation criterion:

$$P(B\_i) = \mathbb{I}\!\left(\frac{\\|C\_i - C\_{\text{page}}\\|\_2}{d\_{\text{page}}} \le 0.2 \;\wedge\; \phi\_{\text{text}}(B\_i) = \infty\right)$$

where $\phi\_{\text{text}}(B\_i) = \infty$ indicates no adjacent text block. These elements are used to partition the page into coarse sub-regions $R$ for further refinement.

**Phase 3: Density-Driven Refinement.** Each sub-region $R$ is processed with an adaptive XY-Cut/YX-Cut strategy. The density ratio $\tau\_d$ measures the proportion of cross-layout to single-layout element area within $R$:

$$\tau\_d = \frac{\sum\_{k=1}^{N\_c} w\_k^{(C\_c)} h\_k^{(C\_c)}}{\sum\_{k=1}^{N\_s} w\_k^{(C\_s)} h\_k^{(C\_s)}}$$

The splitting strategy $S(R)$ is determined by comparing $\tau\_d$ against a threshold $\theta\_v = 0.9$:

$$S(R) = \begin{cases} \text{XY-Cut} & \tau\_d > \theta\_v \\ \text{YX-Cut} & \text{otherwise} \end{cases}$$

XY-Cut prioritizes horizontal splits (finding gaps in the Y-axis projection), while YX-Cut prioritizes vertical splits. Recursion terminates when each sub-region contains exactly one unmasked block.

### Cross-Modal Matching

After multi-granularity segmentation produces an ordered sequence of atomic regions, the masked elements are restored. Matching is driven by a label priority ordering:

$$L\_{\text{order}}: L\_{\text{cross-layout}} \succ L\_{\text{title}} \succ L\_{\text{vision}} \succ L\_{\text{others}}$$

Each masked element $B\_p$ is assigned an anchor position $B\_{\text{best}}$ in the ordered sequence by minimizing a joint geometric distance:

$$D(B\_p, B\_o, l) = \sum\_{k=1}^{4} w\_k \cdot \phi\_k(B\_p, B\_o)$$

The four geometric constraints $\phi\_1$--$\phi\_4$ encode intersection filtering, boundary proximity, vertical continuity, and horizontal ordering respectively. Weights are scaled to avoid interference between constraints:

$$w\_k = [\max(h, w)^2,\ \max(h, w),\ 1,\ \max(h, w)^{-1}]$$

and further tuned per semantic label class via a grid search on 2,800 documents.

## What experiments were performed?

### Dataset

Experiments use two benchmarks:

- **DocBench-100**: The newly introduced dataset with 30 complex ($D\_c$) and 70 regular ($D\_r$) pages. Complex pages are predominantly three-or-more column layouts (90% of $D\_c$); regular pages are dominated by single and double-column formats typical of academic and business documents. Both end-to-end (image input, full detection required) and oracle JSON-based (detection boxes provided) evaluation protocols are supported.
- **OmniDocBench**: An existing block-level benchmark used to assess cross-dataset transfer, covering single, double, three-column, and complex layout categories.

### Baselines

- **XY-Cut** (Ha et al., 1995): Classic projection-based method, geometry only.
- **LayoutReader** (Wang et al., 2021): LayoutLMv3 fine-tuned on 500k samples; uses rich text and visual features.
- **MinerU** (Wang et al., 2024): End-to-end document extraction pipeline.

### Metrics

- **BLEU-4**: Applied to sequences of block identifiers (not text tokens), using standard n-gram precision with brevity penalty:

$$\text{BLEU-4}(\hat{s}, s) = BP \cdot \exp\!\left(\sum\_{n=1}^{4} \frac{1}{4} \log p\_n\right)$$

- **ARD (Absolute Relative Difference)**: Measures prediction accuracy for block positions; lower is better.
- **Kendall's $\tau$**: Rank correlation between predicted and reference orderings; higher is better.
- **FPS**: Ordering module throughput only; upstream detection and downstream OCR/LM are excluded. Measured over 10 runs on an Intel Xeon Gold 6326 CPU at 2.90 GHz with 256 GB RAM.

### Ablations

Table 2 in the paper presents progressive component ablations, adding each module incrementally:

| Configuration | $D\_c$ BLEU-4 | $D\_r$ BLEU-4 | $\mu$ BLEU-4 |
|:---|:---:|:---:|:---:|
| XY-Cut baseline | 0.749 | 0.819 | 0.797 |
| +Pre-Mask | 0.818 | 0.823 | 0.822 |
| +MGS | 0.946 | 0.969 | 0.962 |
| +CMM (full XY-Cut++) | **0.986** | **0.989** | **0.988** |

A detailed component ablation (Table 3) isolates individual design choices within each module, including cross-layout masking, pre-cut, adaptive scheme, and the four geometric constraint terms.

## What are the outcomes/conclusions?

XY-Cut++ achieves 98.8 mean BLEU-4 on DocBench-100, compared to 79.7 for the XY-Cut baseline, 78.8 for LayoutReader, and 87.3 for MinerU. The improvement is more pronounced on complex layouts: BLEU-4 on $D\_c$ rises from 0.749 (baseline XY-Cut) to 0.986, an absolute gain of 23.7 points. ARD across all pages falls from 0.139 to 0.009, a reduction of 93.5%.

On OmniDocBench, results suggest XY-Cut++ achieves the highest mean scores across layout categories (0.953 BLEU-4 versus 0.926 for MinerU), though MinerU has a slight edge on the "Complex ARD" sub-metric (0.050 versus 0.064).

In terms of throughput, the ordering module runs at 514 FPS on average across DocBench-100 and OmniDocBench, modestly faster than the XY-Cut baseline (487 FPS). The authors attribute this to the semantic filtering step in cross-modal matching, which processes each block once rather than repeatedly partitioning subsets through recursive descent. LayoutReader and MinerU run at 22 and 11 FPS respectively.

### Limitations

The authors identify several open issues:

- **Label granularity**: Fine-grained segmentation (caption linkage, ambiguous block boundaries) depends on the quality and category count of the upstream detector's semantic labels. On OmniDocBench, which has fewer label categories, some fine-grained failures persist.
- **Sub-page nested structures**: Pages that contain embedded sub-documents or complex nested regions (illustrated in Figure A8) remain a failure mode, as the current framework lacks hierarchical sub-page reasoning.
- **Heuristic hyperparameters**: The scaling factor $\beta$ (Eq. 1) and density threshold $\theta\_v$ (Eq. 5) were tuned on the available data and may need domain-specific adjustment for out-of-distribution documents.
- **Benchmark scale**: DocBench-100 contains only 100 annotated pages, which limits statistical power and may not represent the full distribution of real-world document types.

Future work directions the authors identify include sub-page detection with hierarchical reasoning, learning the split policy and edge weights from weak supervision, and coupling lightweight language priors with end-to-end RAG/LLM evaluation.

## Reproducibility

### Models

XY-Cut++ is a heuristic algorithm, not a learned model. There are no trainable parameters and no model weights to release. The algorithm depends on an upstream layout detector to provide bounding boxes and coarse semantic labels. Experiments use PP-DocLayout (Sun et al., 2025) for this purpose.

### Algorithms

The full pipeline is described in Algorithm 1 of the paper. Key hyperparameters are:

- Cross-layout scaling factor: $\beta = 1.3$
- Density threshold for split axis selection: $\theta\_v = 0.9$
- Overlap projection threshold for intersection constraint: $\tau\_{\text{overlap}} = 0.3$
- Centrality threshold for Phase 2 pre-segmentation: 0.2 (fraction of page diagonal)
- Edge weights $w\_{\text{edge}}$ for semantic-specific matching: four-class lookup table tuned via grid search on 2,800 documents

No training procedure, optimizer, or learning rate schedule is involved. The grid search over semantic-specific edge weights is not described in enough detail to fully reproduce without the 2,800-document corpus.

### Data

- **DocBench-100**: 100 pages (30 complex, 70 regular). Pages are sourced from PP-DocLayout public document detection corpora and MinerU extraction outputs. Annotation was performed in two stages: automatic pre-annotation by MinerU followed by manual verification and screening. Pages with inherently ambiguous global reading order are excluded. The authors state they will release the evaluation script and dataset documentation, but at the time of writing the license is not specified in the preprint.
- **OmniDocBench**: Used for additional evaluation only; not introduced by this paper.
- **Annotation format**: Each page provides an image, an input JSON (bounding boxes, labels, no reading order index), and a ground truth JSON (same fields plus block-level reading order index).

### Evaluation

- **BLEU-4** is applied to sequences of block identifiers, not text tokens. The brevity penalty is computed using block sequence lengths.
- **ARD** and **Kendall's $\tau$** are computed over the same block-level ordering.
- **FPS** is measured on the ordering module only, explicitly excluding upstream detection and downstream OCR. Results are averaged over 10 runs on an Intel Xeon Gold 6326 @ 2.90 GHz with 256 GB RAM. The paper reports both DocBench-100 and OmniDocBench FPS values separately before averaging.
- The Wilcoxon signed-rank test is reported for the Kendall's $\tau$ comparison ($p < 0.001$), but no other statistical significance tests or error bars are provided.
- No code repository is linked in the preprint. The benchmark and evaluation script availability is stated as future release.

### Hardware

- **Evaluation hardware**: Intel Xeon Gold 6326 CPU @ 2.90 GHz, 256 GB RAM. No GPU is used for the ordering module.
- **No GPU training**: XY-Cut++ is a heuristic algorithm; GPU hardware is not required.
- **Grid search**: Conducted on 2,800 documents to tune edge weights; no compute cost is reported for this step.
- **Deployment**: The algorithm is CPU-only and lightweight enough for production-grade deployment alongside any detection model that provides bounding boxes and coarse labels.

## BibTeX

```bibtex
@article{liu2025xycutplusplus,
  title={XY-Cut++: Advanced Layout Ordering via Hierarchical Mask Mechanism on a Novel Benchmark},
  author={Liu, Shuai and Li, Youmeng and Wei, Jizeng},
  journal={arXiv preprint arXiv:2504.10258},
  year={2025}
}
```


