WebRenderBench: Enhancing Web Interface Generation through Layout-Style Consistency and Reinforcement Learning
Abstract Automating the conversion of UI images into web code is a critical task for front-end development and rapid prototyping. Advances in multimodal large language models (MLLMs) have made WebUI-to- Code increasingly feasible, yet existing benchmarks remain limited in data diversity and evaluation reliability. To address these issues, we present WebRenderBench1, a large-scale benchmark of 45.1k webpages collected from real-world portal sites, offering greater diversity, complexity, and realism than prior benchmarks. We further propose a novel evaluation metric that measures layout and style consistency from the final rendered pages. Unlike vision-based methods that rely on costly LLM reasoning or structure-based comparisons vulnerable to noise and asymmetry, our approach enables more efficient, objective, and reliable UI quality assessment. Finally, we introduce the Automated Layout and Style Inspection Agent (ALISA), which integrates this metric into reinforcement learning as a reward signal to enhance training on crawled asymmetric webpages. Experiments show that ALISA significantly boosts generation performance, achieving state-of-the-art results across multiple metrics.
Introduction. Automating the conversion of UI images into web code holds great significance for both front-end development and automated prototyping [31, 32]. The advent of multimodal large language models (MLLMs) [2, 11, 26] have brought notable advances in code generation, making WebUI-to-Code increasingly feasible. Nevertheless, current MLLMs still face limitations in generation quality, and the establishment of reliable benchmarks and evaluation metrics remains essential for driving progress in this field. The goal of the WebUI-to-Code task is to generate accurate HTML code from user-provided UI images, ensuring that the resulting layout and style closely align with the input design. To assess the WebUI-to-Code capabilities of MLLMs, several benchmarks [3, 10, 20, 35] have been introduced that offer paired images, reference HTML code, and corresponding evaluation metrics. However, as shown in Figure 1, existing benchmarks still exhibit several notable limitations: (1) Limitations in data quality. Existing benchmark evaluation sets typically contain webpages with relatively simple structures and limited scale. Moreover, datasets such as Web2Code [35] are primarily composed of webpages synthesized by LLMs, which restricts data diversity. As shown in Figure 1(a), we compare the diversity of webpage elements across existing datasets and our dataset using the number of grouped elements (see Algorithm 6). The results show that existing datasets generally exhibit lower element diversity, which limits their ability to reflect model performance on complex, real-world UI images. (2) Limitations in evaluation capability. Current approaches for automatically evaluating generated webpages can be broadly categorized into two types. The first is vision-based evaluation, as adopted in datasets such as Web2Code [35] and Design2Code [20]. In this approach, generated webpages are rendered into screenshots and compared with ground-truth UI images using large-scale models such as GPT-4 Vision API. Multi-turn question answering is then applied to assess element consistency. However, this method entails substantial computational overhead, suffers from low efficiency due to repeated QA interactions, and cannot directly measure layout and style consistency. Instead, it relies heavily on the visual reasoning abilities of large models, which may overlook subtle element differences. The second type is structure-based evaluation. For instance, WebUIBench [10] assesses DOM tree similarity by matching corresponding elements in the generated and reference code based on class names and tag names. As illustrated in Figure 1(c), a single UI design can often be implemented using multiple valid code structures. When mismatches occur in nesting relations or tag usage between generated and reference code, this approach fails to accurately reflect generation quality. Moreover, when training webpages are obtained from crawled external sources, the retrieved code may include compiled class names and irrelevant tags, which we define as code asymmetry. Direct comparison with such noisy code further undermines the reliability of performance evaluation. In this paper, we propose WebRenderBench to address the aforementioned challenges by improving both data quality and evaluation methodology. To overcome the limitations of existing datasets, we construct a large-scale dataset sourced from real-world portal websites, comprising 45.1k webpages with greater diversity, complexity, and realism, thereby covering a broader spectrum of web designs. To alleviate the issue of evaluation capability, we introduce a novel metric grounded in layout and style consistency. This metric leverages WebDriver-rendered outputs and spatial information from the final rendered pages. As illustrated in Figure 1(A–C), it compares generated webpages with their ground-truth counterparts by (i) matching associated elements and quantifying spatial discrepancies, (ii) evaluating grouping differences based on the number of aligned elements along the same axes, and (iii) measuring style differences through quantifiable attributes of corresponding elements. This approach effectively mitigates the noise and asymmetry commonly present in synthesized or crawled webpages, which enables more efficient, objective, and reliable evaluation of final UI quality. Furthermore, to improve model generation performance on externally obtained, asymmetric webpage data, we propose the Automated Layout and Style Inspection Agent (ALISA) for LLM-generated WebUIs. This framework allows our evaluation metric to serve not only as an offline evaluation tool but also as a reward signal within reinforcement learning, thereby enhancing the ability of vision language models (VLMs) to generate high-quality WebUI-to-Code outputs.
Related work. 2.1 WebUI-to-Code Benchmarks and Evaluation Metrics Early studies on WebUI-to-Code employed deep learning models [3, 12, 14, 33], which translated UI screenshots into a simplified domain-specific language using CNN–RNN architectures. These models were trained on synthetic, programmatically generated datasets and evaluated with text-matching metrics such as Jaccard and BLEU scores [17, 21, 22]. However, they struggled to generalize due to the substantial gap between synthetic and real webpages. With the advent of MLLMs [2, 4], which demonstrate strong zeroand few-shot generation capabilities, the focus has shifted toward benchmarks built on real-world data. Design2Code [20] introduced the first large-scale test set of 484 real webpages and replaced rigid code-matching metrics with vision-based measures such as CLIP Score [7] and component-level fidelity. WebSight [8] introduced a synthetic dataset of 2 million pairs of HTML code and screenshots. Similarly, Sketch2Code [9] introduced a dataset of 731 examples, designed to evaluate both direct generation from low-fidelity inputs and multi-turn refinement through simulated user feedback and agent-initiated queries. WebUIBench [10] further broadened the scope by framing tasks from a software engineering perspective. Overall, modern benchmarks increasingly emphasize vision-level metrics, which better capture user experience and tolerate diverse yet functionally equivalent code implementations, thereby overcoming the limitations of purely text-based evaluation.
2.2 Reinforcement Learning for Optimizing Code Generation While MLLMs trained with supervised fine-tuning (SFT) can generate structurally plausible code, they often struggle with layout and styling. Recent work tackles this alignment challenge with reinforcement learning, which goes beyond standard loss functions by optimizing objectives through preference-based strategies such as PPO [18], DPO [16], and GRPO [19]. In code-related RL tasks, the model is treated as an agent [37], where each action corresponds to generating [13, 28, 34] or refining code snippets [27, 36]. The environment (e.g., a compiler or runtime checker) provides a reward signal, which the model uses to update its parameters and maximize performance. The effectiveness of RL largely depends on reward design. In WebUI-to-Code tasks, three major reward schemes are commonly employed: (i) visual similarity between rendered outputs and target UIs, typically measured by CLIP or feature distance [5, 32]; (ii) code quality and functionality, such as syntax correctness or unit test success [9]; and (iii) human or AI feedback, aligning outputs with subjective preferences such as readability or aesthetics [29].
Method. 3 Benchmark Construction The overall pipeline for WebRenderBench data collection and the ALISA training framework are illustrated in Figure 2. § 3.1 outlines the core principles guiding our benchmark design. § 3.2 describes the dataset construction process and presents key statistics. Finally, § 3.3 introduces the evaluation methodology, defines the metrics used in our benchmark, and explains how ALISA is incorporated into the training framework.
3.1 Benchmark Design The motivation for our benchmark design is driven by three core questions: (1) How can we effectively evaluate the WebUI-to-Code generation capabilities of LLMs in realistic and diverse application scenarios? (2) How can we achieve efficient and accurate evaluation of generation quality at the code level? (3) How can we design a reward mechanism that enables effective optimization when the ground-truth and generated code are asymmetric? To address these challenges, we first design a data collection pipeline that acquires webpage data from real-world portal sites. After systematic cleaning and filtering, we construct a large-scale dataset with high diversity and a balanced distribution of webpage complexity. Next, we propose an evaluation method that employs a WebDriver with embedded JavaScript scripts to analyze layout and style consistency between generated and ground-truth pages based on their final rendered outputs. This approach not only ensures efficient and accurate evaluation but also resolves the asymmetry between generated code and ground-truth compiled code, enabling the evaluation scores to be directly used as rewards for optimizing the WebUI-to-Code capabilities of LLMs. We provide detailed discussions of these components in the following sections.
3.2 Dataset Following the benchmark design, the WebRenderBench dataset is constructed through a systematic pipeline encompassing data collection, processing, and cleaning.
3.3 Protocol for Evaluation and Training Existing benchmarks for WebUI-to-Code either evaluate code generation quality from the perspective of code structure or rely solely on visual comparisons of rendered webpages. Both approaches have notable limitations. Structure-based evaluation cannot effectively handle asymmetric code scenarios, while vision-based evaluation often provides only coarse-grained results. Although incorporating LLM-based QA or manual assessment into vision-based methods can improve accuracy, it also incurs substantial time costs, making them unsuitable for real-time reward computation during online training. To address these challenges, we leverage real-time DOM information from browser rendering and assess generation quality from both the rendered output and the code level. Building on the core objectives of WebUI-to-Code, namely layout consistency and style consistency, we propose three evaluation strategies:
Relative Layout Difference of Associated Elements (RDA). For each visible element, high-quality code generation should ensure the existence of a corresponding element in the ground-truth target, with both size and spatial layout closely aligned. Following this principle, the first step is to establish associations between elements. Formally, let the set of visible elements from the generated code be S= {s1, . . . ,sn}, and the set of visible elements from the ground-truth target code be T= {t1, . . . ,tm}. To address inconsistencies in class or tag names, candidate associations are ranked based on inner-text similarity and position/size differences. For elements with inner text, we compute similarity using the Longest Common Subsequence (LCS) and directly match pairs with a score above 0.80. If multiple candidates satisfy this condition, the pair with the smallest position and size difference is selected. For elements without inner text, we instead rely on positional and size differences. We further introduce a threshold of ten based on common UI design padding bias3: if the minimum size difference exceeds this threshold, the element is considered to have no valid association. Next, for each associated pair (s,t), the RDA score is Group-wise Difference in Element Counts (GDA).
Conclusion. In this paper, we present WebRenderBench, a large-scale and diverse benchmark for WebUI-to-Code, accompanied by a novel codelevel metric that evaluates layout and style consistency based on rendered webpages. To further enhance generation quality, we introduce ALISA, an automated layout and style inspection agent that leverages this metric as a reinforcement learning reward. Experimental results demonstrate that integrating ALISA substantially improves the performance of VLMs on complex, real-world webpages. WebRenderBench offers a robust platform for benchmarking and advancing research in WebUI-to-Code.
Lines of inquiry this paper opens 24
Research framings built by reading the notes related to this paper — the questions it feeds into.
Can visual rendering-based rewards effectively improve code and layout quality?- How sensitive are the layout metrics to changes in annotator population?
- Why do vision-based rewards for web generation incur substantial computational overhead?
- How does code asymmetry break DOM-based evaluation of generated web interfaces?
- Can matching UI elements by text similarity and position handle visually equivalent but structurally different layouts?
- What performance gains does ALISA achieve over prior WebUI-to-Code training methods?
- How does layout consistency scoring compare to human preferences for generated web pages?
- Does the rendering reward generalize beyond chart editing to other code generation tasks?
- How does the rendering reward weight code executability against visual fidelity failures?
- What layout and text metrics does ChartEditor use to measure visual fidelity?
- What signals matter more for UI evaluation: rendered visuals or symbolic descriptions?
- Do quality ceiling effects appear in other visual domains beyond game UI?
- Can render-and-judge mechanisms generalize beyond chart-to-code to other executable outputs?
- Should layout evaluation capture rendering artifacts like element overlap?
- Can bounding-box signals prevent visual flaws better than code APIs?
- Why is verifying rendered output easier than generating code from scratch?
- Which post-processing techniques most improve AI-generated app visual polish?
- What specific metrics show how much general models underperform on layout evaluation?
- Does previewing output before submission work better than refining after rendering?
- How should design benchmarks distinguish professional polish from user-facing appeal?
- What would personalized aesthetic fine-tuning require to implement?