Abstract
GEM (Gestalt Enhanced Markup) is a language model designed to master web understanding by learning the visual "intuition" of a website without the computational overhead of processing screenshots. By training on the underlying render tree using principles from Gestalt psychology—specifically how humans group objects by similarity and proximity—GEM outperforms models that use actual visual inputs while remaining faster and more robust to varying device layouts.
Introduction and Motivation
Web pages are complex entities composed of content, structure (HTML), and visual styling (CSS). Humans instantly recognize semantic relationships based on visual cues, such as items grouped in a sidebar or sharing a specific font style. However, most Pre-trained Language Models (PLMs) treat a web page as a flat string of HTML code, missing these crucial spatial and stylistic contexts.
Existing approaches generally fall into two categories: text-centric models that ignore layout entirely, and vision-centric models that process page screenshots. While vision models are powerful, they are computationally expensive, require OCR to extract text, and are brittle across different screen resolutions. GEM offers a "middle way" by providing visual awareness using only the structured data available in a browser's render tree.
As shown in the figure above, HTML code can be deceptive. Elements that are siblings in the code may be spatially distant, while elements far apart in the DOM tree may be neighbors on the screen. GEM learns to prioritize the screen layout over the raw code sequence.
Methodology
The core innovation of GEM is the application of Gestalt psychological theory to the pre-training process. Gestalt theory suggests that humans perceive "unified wholes" rather than individual parts. GEM focuses on two specific laws: the Law of Similarity (grouping things that look alike) and the Law of Proximity (grouping things that are physically close).
The Render Tree and Pre-training Objectives
Instead of raw HTML, GEM utilizes the Render Tree, which combines the DOM with the CSS Object Model to provide exact coordinates and computed styles (font, color, size) for every element. The researchers introduced two novel pre-training tasks to embed this knowledge into the model:
- Same Textual Style Prediction (STSP): The model predicts if pairs of text nodes share visual styles, teaching it to recognize semantic groups based on styling.
- Proximate Nodes Prediction (PNP): The model predicts whether two nodes are physically touching or overlapping in the layout, regardless of their position in the HTML code.
Crucially, these visual features are only used to generate labels during pre-training. During inference, GEM only requires the HTML and text, making it significantly lighter than vision-based models.
Experimental Results
GEM was evaluated against several benchmarks, demonstrating superior performance across diverse web understanding tasks:
- Web Question Answering (WebSRC): GEM achieved an Exact Match (EM) score of 69.12, outperforming its predecessor, MarkupLM (66.67), and V-PLM (62.07), a model that uses actual screenshots.
- Information Extraction (SWDE): GEM reached a 96.04 F1 score, setting a new standard for structured data extraction from web pages.
- The Challenge Set: On a subset of questions where GPT-3.5-turbo originally struggled, GEM achieved 67.04 EM, slightly edging out GPT-3.5-turbo (66.99) and significantly outperforming Llama 2 (25.91).
Conclusion
GEM demonstrates that explicit visual processing via pixels is not always necessary for deep web understanding. By leveraging CSS properties as a "cheat sheet" for visual structure, GEM develops a robust mental map of web pages. While the pre-training phase requires a browser engine to calculate the render tree, the resulting model is highly efficient for large-scale automated browsing and data extraction. Future work may involve integrating these Gestalt objectives into larger LLM architectures to further enhance structural reasoning.
Summary updated