[Paper Review] Design2Code: Benchmarking Multimodal Code Generation for Automated Front-End Engineering
This paper introduces Design2Code, the first real-world benchmark for evaluating multimodal large language models (MLLMs) in generating functional web code from screenshots. It evaluates state-of-the-art models like GPT-4o and Claude 3.5 Sonnet using 484 curated real webpages and finds that models struggle most with accurately recalling visual elements and generating correct layouts, despite improvements from text-augmented prompting.
Generative AI has made rapid advancements in recent years, achieving unprecedented capabilities in multimodal understanding and code generation. This can enable a new paradigm of front-end development in which multimodal large language models (MLLMs) directly convert visual designs into code implementations. In this work, we construct Design2Code - the first real-world benchmark for this task. Specifically, we manually curate 484 diverse real-world webpages as test cases and develop a set of automatic evaluation metrics to assess how well current multimodal LLMs can generate the code implementations that directly render into the given reference webpages, given the screenshots as input. We also complement automatic metrics with comprehensive human evaluations to validate the performance ranking. To rigorously benchmark MLLMs, we test various multimodal prompting methods on frontier models such as GPT-4o, GPT-4V, Gemini, and Claude. Our fine-grained break-down metrics indicate that models mostly lag in recalling visual elements from the input webpages and generating correct layout designs.
Motivation & Objective
- To address the gap in realistic, diverse, and complex benchmarks for multimodal code generation from UI designs.
- To enable rigorous evaluation of current MLLMs in transforming real-world web screenshots into functional code.
- To identify key failure modes in MLLM-generated code, particularly in visual element recall and layout accuracy.
- To provide automatic and human evaluation protocols that correlate with human judgment.
- To support future research in automated front-end development by offering a standardized benchmark and evaluation suite.
Proposed method
- Curated 484 high-quality, diverse real-world webpages from the C4 validation set, manually filtered for quality and independence from external dependencies.
- Extracted and embedded CSS into HTML files to produce complete, standalone code implementations for each webpage.
- Developed automatic metrics measuring visual similarity across bounding boxes, text content, position, and color of matched elements between generated and reference webpages.
- Proposed text-augmented prompting, which supplements screenshots with extracted text to reduce OCR burden, and self-revision prompting for iterative refinement.
- Conducted comprehensive human evaluations to validate automatic metric performance and model ranking.
- Constructed Design2Code-HARD, a separate set of 80 challenging examples for fine-grained comparison of state-of-the-art models.
Experimental results
Research questions
- RQ1How well do current multimodal LLMs generate functional code from real-world web screenshots?
- RQ2To what extent do automatic evaluation metrics correlate with human judgment in code generation quality?
- RQ3How do different prompting strategies—especially text-augmented and self-revision—improve code generation performance?
- RQ4What are the primary failure modes of MLLMs in this task, particularly regarding visual element recall and layout accuracy?
- RQ5How do commercial models (e.g., GPT-4o, Claude 3.5 Sonnet) compare to open-source models on complex, real-world webpages?
Key findings
- State-of-the-art MLLMs like GPT-4o and Claude 3.5 Sonnet achieve high-quality code generation on simple examples but struggle significantly on complex, real-world webpages.
- Text-augmented prompting leads to measurable improvements in code generation, particularly in text content and layout accuracy, by reducing OCR load on the model.
- Self-revision prompting shows limited effectiveness, with only a small subset of models able to successfully identify and correct errors in their own outputs.
- The automatic evaluation metrics show strong correlation with human judgment, validating their use for scalable benchmarking.
- Models consistently underperform on visual element recall and layout structure, indicating a fundamental gap in multimodal understanding of complex UIs.
- Open-source models remain significantly behind commercial models in both automatic and human evaluations, highlighting a large performance gap in real-world application.
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.