[Paper Review] DOM-LM: Learning Generalizable Representations for HTML Documents
DOM-LM proposes a transformer-based self-supervised representation learning model for HTML documents that jointly encodes text and DOM tree structure to capture both semantic and structural semantics. It outperforms existing methods in attribute extraction, open information extraction, and question answering, especially in few-shot and zero-shot settings, demonstrating strong generalization for real-world web applications.
HTML documents are an important medium for disseminating information on the Web for human consumption. An HTML document presents information in multiple text formats including unstructured text, structured key-value pairs, and tables. Effective representation of these documents is essential for machine understanding to enable a wide range of applications, such as Question Answering, Web Search, and Personalization. Existing work has either represented these documents using visual features extracted by rendering them in a browser, which is typically computationally expensive, or has simply treated them as plain text documents, thereby failing to capture useful information presented in their HTML structure. We argue that the text and HTML structure together convey important semantics of the content and therefore warrant a special treatment for their representation learning. In this paper, we introduce a novel representation learning approach for web pages, dubbed DOM-LM, which addresses the limitations of existing approaches by encoding both text and DOM tree structure with a transformer-based encoder and learning generalizable representations for HTML documents via self-supervised pre-training. We evaluate DOM-LM on a variety of webpage understanding tasks, including Attribute Extraction, Open Information Extraction, and Question Answering. Our extensive experiments show that DOM-LM consistently outperforms all baselines designed for these tasks. In particular, DOM-LM demonstrates better generalization performance both in few-shot and zero-shot settings, making it attractive for making it suitable for real-world application settings with limited labeled data.
Motivation & Objective
- To address the limitations of existing methods that treat HTML documents as plain text or rely on computationally expensive visual rendering.
- To learn generalizable representations that capture both textual content and structural semantics from the DOM tree.
- To improve performance on downstream tasks like attribute extraction, open information extraction, and question answering with minimal labeled data.
- To enable effective few-shot and zero-shot generalization for real-world web applications with limited annotations.
- To overcome the shortcomings of heuristic-based context construction in prior tree-encoding models by learning contextualized tree representations.
Proposed method
- DOM-LM uses a transformer encoder to jointly encode tokens and DOM tree nodes, incorporating structural information through multiple position embeddings.
- It applies a self-supervised masked language modeling (MLM) objective by masking both individual tokens and entire DOM nodes during pre-training.
- The model processes the DOM tree using a sliding window mechanism to retain relevant structural context, pruning older nodes and adding new ones at each step.
- Position embeddings are designed to model hierarchical and sequential relationships within the DOM tree, enabling structure-aware representation learning.
- The final node and token representations are fine-tuned on downstream tasks such as attribute extraction, OpenIE, and question answering.
- The approach avoids rendering by directly using raw HTML source, making it efficient and scalable compared to visual feature extraction.
Experimental results
Research questions
- RQ1Can a self-supervised, structure-aware representation model improve performance on HTML document understanding tasks compared to text-only or visual-based baselines?
- RQ2To what extent can a model pre-trained on diverse HTML documents generalize to unseen websites in few-shot or zero-shot settings?
- RQ3How effectively can joint modeling of text and DOM tree structure capture semantic and syntactic relationships in semi-structured web content?
- RQ4Does the use of structured position embeddings in a transformer encoder lead to better contextualization of DOM nodes than heuristic-based context retrieval?
- RQ5Can the model outperform existing methods in tasks like attribute extraction and question answering without relying on rendered visual features?
Key findings
- DOM-LM consistently outperforms all baselines across attribute extraction, open information extraction, and question answering tasks.
- The model demonstrates superior generalization in few-shot and zero-shot settings, indicating strong transferability to unseen websites and templates.
- By jointly encoding text and DOM structure, DOM-LM captures relationships between elements that are lost when only raw text is used.
- The self-supervised pre-training with masked node and token prediction leads to robust, generalizable representations without requiring labeled data.
- DOM-LM achieves state-of-the-art performance while avoiding the computational cost of rendering or storing visual features.
- The model’s performance gains are particularly significant in low-resource scenarios, validating its suitability for real-world applications with limited annotations.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.