Towards Zero-shot Relation Extraction in Web Mining: A Multimodal Approach with Relative XML Path

Zilong Wang, Jingbo Shang

Abstract

The rapid growth of web pages and the increasing complexity of their structure poses a challenge for web mining models. Web mining models are required to understand semi-structured web pages, particularly when little is known about the subject or template of a new page. Current methods migrate language models to web mining by embedding the XML source code into the transformer or encoding the rendered layout with graph neural networks. However, these approaches do not take into account the relationships between text nodes within and across pages. In this paper, we propose a new approach, ReXMiner, for zero-shot relation extraction in web mining. ReXMiner encodes the shortest relative paths in the Document Object Model (DOM) tree of the web page which is a more accurate and efficient signal for key-value pair extraction within a web page. It also incorporates the popularity of each text node by counting the occurrence of the same text node across different web pages. We use contrastive learning to address the issue of sparsity in relation extraction. Extensive experiments on public benchmarks show that our method, ReXMiner, outperforms the state-of-the-art baselines in the task of zero-shot relation extraction in web mining.

Introduction

Extracting structured data from the web is a moving target. While humans can easily identify that "Christopher Nolan" is a "Director" on a new movie site, machines struggle because every website uses a different HTML template. Traditional Relation Extraction (RE) models are often trained on specific site layouts, making them brittle when encountering new sites or layout changes.

The "zero-shot" challenge asks: Can we build a model that learns the general language of web design well enough to extract data from a website it has never seen before? Current state-of-the-art models like MarkupLM use "Absolute XML Paths"—the full address of a node from the root. However, these addresses vary wildly between sites. ReXMiner addresses this by focusing on the local structural neighborhood.

Comparison of Absolute vs. Relative XML Paths across different verticals

Methods

ReXMiner is a multimodal model that builds upon the Transformer-based MarkupLM with three key architectural innovations designed to capture the "general language" of web design:

  1. Relative XML Path Attention: Instead of absolute coordinates, ReXMiner calculates the shortest path between two text nodes within the Document Object Model (DOM) tree. These relative relationships (e.g., a label being a sibling or parent of its value) are much more consistent across different websites than absolute locations.
  2. Popularity Embedding: The model tracks the frequency of text across multiple pages of the same site. High-frequency text (e.g., "Director:") likely represents a "key" or attribute, while low-frequency text (e.g., "Quentin Tarantino") likely represents a "value."
  3. Contrastive Learning: To handle the sparsity of relations on a page, contrastive learning is used to push related pairs closer in the embedding space while pushing unrelated pairs further apart.
The ReXMiner architecture overview, including the multimodal embedding layer and relative attention mechanism

Experimental Setup

The researchers evaluated ReXMiner using the SWDE (Structured Web Data Extraction) dataset, which contains thousands of pages from three verticals: Movie (e.g., IMDb), NBA (e.g., ESPN), and University (e.g., US News). To test zero-shot capabilities, they employed a "leave-one-vertical-out" approach, training on two categories and testing on the third entirely unseen category.

Key Results

ReXMiner established a new state-of-the-art for zero-shot web relation extraction:

  • Superior Performance: It achieved an average F1 score of 59.05%, significantly outperforming MarkupLM (53.17%) and nearly doubling the performance of older graph-based methods.
  • Robustness: The model showed its most significant gains in the NBA vertical, improving the F1 score by over 10 points compared to baselines.
  • Ablation Success: Removing the Relative XML Path caused a ~4% drop in performance, while removing the Popularity Embedding caused a ~2% drop, proving both features are critical.

Conclusion

ReXMiner demonstrates that structural relationships within the DOM tree are more stable than absolute content for cross-site generalization. By leveraging relative paths and site-wide statistics, the model gains a form of "common sense" about web schemas. Future work will focus on reducing computational costs and exploring more complex DOM topologies beyond shortest paths.

Summary updated

BibTeX
@inproceedings{wang2023towards,
  author = {Zilong Wang and Jingbo Shang},
  title = {{Towards Zero-shot Relation Extraction in Web Mining: A Multimodal Approach with Relative XML Path}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  url = {https://openreview.net/forum?id=lC4vFCM2VA},
}
Figure