Skip to main content
QUICK REVIEW

[Paper Review] MarkupLM: Pre-training of Text and Markup Language for Visually-rich Document Understanding

Junlong Li, Yiheng Xu|arXiv (Cornell University)|Oct 16, 2021
Handwritten Text Recognition TechniquesComputer Science10 citations
TL;DR

This paper proposes MarkupLM, a multimodal pre-training framework that jointly learns text and markup language representations using Transformer architecture and XPath embeddings for visually-rich document understanding in dynamic-layout documents like HTML/XML. It outperforms strong baselines on WebSRC and SWDE benchmarks through novel pre-training objectives: Masked Markup Language Modeling, Node Relationship Prediction, and Title-Page Matching.

ABSTRACT

Multimodal pre-training with text, layout, and image has made significant progress for Visually Rich Document Understanding (VRDU), especially the fixed-layout documents such as scanned document images. While, there are still a large number of digital documents where the layout information is not fixed and needs to be interactively and dynamically rendered for visualization, making existing layout-based pre-training approaches not easy to apply. In this paper, we propose MarkupLM for document understanding tasks with markup languages as the backbone, such as HTML/XML-based documents, where text and markup information is jointly pre-trained. Experiment results show that the pre-trained MarkupLM significantly outperforms the existing strong baseline models on several document understanding tasks. The pre-trained model and code will be publicly available at https://aka.ms/markuplm.

Motivation & Objective

  • Address the challenge of document representation learning in markup-based documents (e.g., HTML/XML) where layout is dynamically rendered and not fixed.
  • Overcome the limitations of existing layout-based pre-training models (e.g., LayoutLM) that rely on explicit 2D layout or image features, which are unavailable in markup documents.
  • Develop a unified pre-training framework that integrates text, markup structure (via XPath), and sequence order to model document semantics effectively.
  • Design new self-supervised pre-training objectives tailored to markup language structure and semantic relationships in documents.
  • Demonstrate the effectiveness of MarkupLM on downstream document understanding tasks such as reading comprehension and data extraction.

Proposed method

  • Introduce an XPath embedding layer to represent the hierarchical path from the root to each token in the document’s DOM tree, replacing 2D layout embeddings used in LayoutLM.
  • Use a multi-stream input embedding approach combining text embeddings, 1D position embeddings, segment embeddings, and XPath embeddings to encode document structure.
  • Propose three pre-training objectives: Masked Markup Language Modeling (MMLM) to jointly mask and predict text and markup tokens; Node Relationship Prediction (NRP) to predict parent-child or sibling relationships in the DOM tree; and Title-Page Matching (TPM) to predict whether a page’s title matches its content.
  • Fine-tune the pre-trained MarkupLM on downstream tasks using standard classification or sequence labeling heads.
  • Leverage large-scale unlabeled webpages (e.g., 1M–24M pages) for pre-training, with model initialization from BERT or RoBERTa.
  • Use a standard Transformer encoder with multi-head self-attention and feed-forward networks to process the input embeddings.

Experimental results

Research questions

  • RQ1Can joint pre-training of text and markup language improve document representation learning in dynamically rendered documents like HTML/XML?
  • RQ2How effective are XPath-based embeddings in capturing structural relationships in markup documents compared to 2D layout embeddings?
  • RQ3To what extent do the proposed pre-training objectives—MMLM, NRP, and TPM—contribute to downstream performance on document understanding tasks?
  • RQ4Does pre-training on large-scale, unlabeled webpages lead to significant gains in downstream tasks such as reading comprehension and data extraction?
  • RQ5Can MarkupLM generalize across different document types, including those with variable rendering across devices?

Key findings

  • MarkupLM significantly outperforms strong baselines on the WebSRC dataset, achieving a 5.3% absolute improvement in Exact Match (EM) score when combining all three pre-training objectives.
  • The Title-Page Matching (TPM) objective contributes the most to performance, improving EM by 4.6% compared to baseline, while Node Relationship Prediction (NRP) improves EM by 2.4%.
  • Using a stronger initialization model (RoBERTa-base instead of BERT-base) leads to a 1.9% EM gain, indicating the importance of initialization quality.
  • Training on 24M webpages (vs. 1M) with RoBERTa-base and all three objectives yields the best performance: 68.39% EM, 74.47% F1, and 87.93% POS on the WebSRC development set.
  • Ablation studies confirm that all three pre-training objectives are effective and complementary, with the combination yielding the highest performance.
  • The pre-trained MarkupLM models and code are publicly released at https://aka.ms/markuplm for community use and further research.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.