---
title: 'TEDS-Structure: Table Structure Similarity'
url: https://www.emergentmind.com/topics/teds-structure
type: topic
---

# TEDS-Structure: Table Structure Similarity

A TEDS-Structure (Tree Edit Distance-based Similarity for Structure) metric quantitatively evaluates the structural fidelity of predicted tables compared to ground-truth table structures in document understanding tasks. It is rooted in the formalism of ordered tree edit distance and measures the minimum number of edit operations (insertions, deletions, substitutions) at the HTML-like DOM level required to make the predicted table’s structure isomorphic to the ground truth. The TEDS-Structure score, normalized to [0,1], focuses solely on the logical arrangement of table elements, explicitly excluding any cell content or OCR text similarities. The TEDS-Structure metric has become a critical benchmark for table recognition, particularly in evaluating detection-based, transformer-based, and multi-corpus document layout models [1911.10683, 2203.01017, 2604.11042, 2508.05669].

## 1. Formal Definition and Mathematical Formulation

TEDS-Structure is defined via normalized tree edit distance over DOM-like ordered trees representing table structure. Given a predicted table tree \(T_{pred}\) and a ground-truth table tree \(T_{gt}\), both with nodes labeled as HTML tags (`<table>`, `<thead>`, `<tbody>`, `<tr>`, `<td>`) and cell span attributes, TEDS-Structure is computed as follows:

Let \(\mathit{ED}(T_{gt}, T_{pred})\) denote the tree edit distance—the minimal cost sequence of insertions, deletions, and substitutions (as defined below) to transform \(T_{pred}\) into \(T_{gt}\). For each tree \(T\), let \(|T|\) be the total number of nodes.

\[
\mathrm{TEDS}(T_{gt}, T_{pred}) = 1 - \frac{\mathit{ED}(T_{gt}, T_{pred})}{\max(|T_{gt}|, |T_{pred}|)}
\]

The edit-cost function for TEDS-Structure ignores HTML cell content; substitutions on `<td>` nodes are scored as cost 0 if their row/colspan structural attributes match and cost 1 otherwise. All node insertions or deletions and substitutions of non-matching tags incur unit cost [1911.10683].

This construction is faithful to structure alone—any change in nesting, number of rows, columns, or multi-span cell positions will directly penalize the similarity.

## 2. Algorithmic Implementation

TEDS-Structure is computed using a dynamic programming-based ordered tree edit distance algorithm, such as the Zhang–Shasha algorithm. The steps are as follows [1911.10683, 2604.11042]:

- Both predicted and ground-truth tables are parsed into ordered trees reflecting their DOM structure, with all node labels and span values but not content.
- For each pair of nodes, the edit cost is:
  - 1 for insertion or deletion.
  - 1 for substitution if node types differ or (for `<td>`) if spans mismatch.
  - 0 for substitution if tags and spans match.
- The dynamic program computes minimal total cost, which is then normalized as above.

This metric can be extended to corpora containing multiple tables per page by forming a cost matrix of pairwise TEDS-Structure values and greedily or optimally matching tables (e.g., via Hungarian algorithm) before aggregating document-level scores [2508.05669].

## 3. Evaluation Protocols and Empirical Use

TEDS-Structure is integral to table structure recognition benchmarks such as PubTabNet and FinTabNet [1911.10683, 2203.01017], as well as to new cross-corpus layout representation harmonization protocols [2604.11042]. In typical evaluation pipelines:

- Prediction and annotation are post-processed to ensure structural tags only.
- Token normalization or reduction to semantic classes (e.g., cell type) may be used in tasks focusing only on pure structure.
- Structure-only TEDS scores are reported independently of full TEDS (which includes content).

For example, [2604.11042] reports table TEDS (structure-only) scores for different training strategies, demonstrating drops in table fidelity (TEDS: 0.800 → 0.750) when merging datasets with inconsistent annotation, and gains (TEDS: 0.814) when dataset harmonization is applied algorithmically pre-training.

## 4. Representation Analysis and Metrics Sensitivity

Representation-level analyses (UMAP, silhouette scores) show that inconsistent table-structure annotations induce fragmentation in the learned feature space, increasing structural errors and lowering TEDS-Structure. Harmonized annotation pools, as in agentic harmonization workflows, restore cluster compactness and separability, which directly translates into improved structural TEDS [2604.11042].

Worked examples further illustrate metric behavior: for multi-hop shifts or missing rows/columns, the edit script accumulates costs for required insertions/deletions, driving TEDS-Structure down even when local adjacency-based metrics would not register the error [1911.10683].

## 5. Variants and Extensions

While classical TEDS-Structure is text/content-agnostic and acts only on structure, variants exist:

- **TEDS-IOU** incorporates bounding box overlaps into the substitution cost for `<td>` nodes, thus integrating spatial alignment [2208.00385].
- **Markdown TEDS** applies to Markdown table representations by parsing into an analogous tree structure and employing identical insertion/deletion/substitution costs, with potential for string similarity-based graded substitution [2508.05669].
- The "corrected" TEDS variant first aligns cells by content labels before computing structure-only distance, increasing robustness to cell orderings when semantic identity is preserved [2604.11042].

## 6. Metric Comparison, Limitations, and Best Practices

TEDS-Structure supersedes classic adjacency-relation metrics by capturing global misalignments and multi-hop cell errors that adjacency-based F1 cannot diagnose. Adjacency metrics also penalize minor OCR/text errors excessively, which TEDS-Structure by construction ignores.

A limitation is computational: while tree edit distance is optimal for tables of moderate size, its complexity is quadratic in the cell count. It is ill-suited for monolithic tables with extreme dimensionality without further optimization. TEDS-Structure’s interpretability hinges on faithful DOM construction and the explicit omission of cell content.

Empirically, structure-only TEDS is highly sensitive to cell-class merging/splitting errors in annotations—fungibility of header/body regions, or inconsistent whitespace/cell-splitting conventions, will artificially degrade TEDS-Structure unless harmonization is enforced before mixed-dataset training [2604.11042].

## 7. Applications and Impact

TEDS-Structure is the authoritative metric for model development and comparison in table structure recognition tasks. It is used to benchmark transformer-based models (TableFormer, StructureFormer) [2203.01017], detection-based hybrids [2604.11042], and vision-language table converters [2508.05669]. TEDS-Structure serves as a direct proxy for the end utility of table structure extraction in downstream analytical pipelines, explaining its adoption for leaderboard ranking and statistical ablation reporting.

Its proper use has led to methodological best practices: precise DOM-normalization, dataset harmonization, early metric monitoring to detect “structure drift,” and the inclusion of representation-level diagnostics to support TEDS outcomes in the presence of ambiguous annotation conventions [2604.11042, 1911.10683].

---
**References**:  
- [1911.10683] Zhong, X. et al., “Image-based table recognition: data, model, and evaluation.”  
- [2203.01017] Herzig, J. et al., “TableFormer: Table Structure Understanding with Transformers.”  
- [2208.00385] Rao, S. et al., “Evaluating Table Structure Recognition: A New Perspective.”  
- [2508.05669] Lee, G. et al., “Fine-Tuning Vision-Language Models for Markdown Conversion of Financial Tables in Malaysian Audited Financial Reports.”  
- [2604.11042] Chuang, Z. et al., “Improving Layout Representation Learning Across Inconsistently Annotated Datasets via Agentic Harmonization.”

Source: https://www.emergentmind.com/topics/teds-structure