interaction2code-eval
Interaction2Code: Benchmarking MLLM-based Interactive Webpage Code Generation from Interactive Prototyping — Jingyu Xiao et al. (2024) (arXiv:2411.03292, 2024)
What this evaluates
Evaluates multimodal large language models' ability to generate functional interactive webpage code from interactive prototype screenshots. It specifically probes the model's capacity to capture dynamic interaction behaviors, element positioning, and visual-textual alignment, rather than just static layout reproduction.
Datasets
Metrics
CLIP (primary) — range: [0, 1]
- Cosine similarity between CLIP image embeddings of the rendered generated webpage and the reference webpage screenshot.
SSIM — range: [0, 1]
- Structural Similarity Index Measure comparing the pixel-level structural fidelity between the generated and reference webpage screenshots.
Text — range: [0, 1]
- Textual overlap or embedding similarity between the extracted text content of the generated code and the reference code.
Position — range: [0, 1]
- Positional similarity score measuring the alignment of interactive elements' coordinates between the generated and reference webpages.
IR — range: [0, 1]
- Interaction Rate, representing the proportion of correctly generated interactive elements relative to the ground truth.
Usability Rate — range: [0, 1]
- Percentage of generated interactions deemed functionally consistent with the ground truth by human annotators with front-end development experience.
Win Rate — range: [0, 1]
- Proportion of pairwise comparisons where the model's output is preferred over the baseline, determined by majority vote (≥3 out of 5 annotators).
Input / output format
Input: Screenshot of an interactive webpage prototype (and optionally accompanying textual descriptions).
Output: HTML/CSS/JavaScript code implementing the interactive webpage.
Scoring recipe
def compute_metrics(generated_code, ref_code, gen_img, ref_img):
gen_img, ref_img = render_to_image(generated_code), render_to_image(ref_code)
clip = cosine_similarity(CLIP.encode(gen_img), CLIP.encode(ref_img))
ssim = structural_similarity(gen_img, ref_img)
text = text_similarity(extract_text(generated_code), extract_text(ref_code))
pos = element_position_similarity(extract_elements(generated_code), extract_elements(ref_code))
ir = count_correct_interactions(generated_code, ref_code) / count_total_interactions(ref_code)
return {'CLIP': clip, 'SSIM': ssim, 'Text': text, 'Position': pos, 'IR': ir}
Common pitfalls
- MLLMs significantly undergenerate interactive elements relative to static content, leading to incomplete functionality.
- Performance degrades sharply for interactions with low visual saliency (small area ratio on the screen).
- Single-modality (visual-only) inputs yield substantially poorer results than combined visual-textual inputs.
Evidence (verbatim from paper)
Gemini-1.5-flash's metrics (CLIP, SSIM, text, position, IR) of the interaction part improve from direct prompting scores (0.4737, 0.3616, 0.2809, 0.4302, 0.6738) to (0.5093, 0.3854, 0.3217, 0.4511, 0.7112) with CoT, and further to (0.5194, 0.3898, 0.3454, 0.4612, 0.7326) with Mark prompting.
Citation
@misc{xiao2024interaction2code,
title={Interaction2Code: Benchmarking MLLM-based Interactive Webpage Code Generation from Interactive Prototyping},
author={Jingyu Xiao et al. (2024)},
year={2024},
note={arXiv:2411.03292}
}
1---2name: interaction2code-eval3description: Evaluates multimodal large language models' ability to generate functional interactive webpage code from interactive prototype screenshots. It specifically probes the model's capacity to capture dynamic interaction behaviors, element positioning, and visual-textual alignment, rather than just static layout reproduction. Use when the user wants to benchmark on Interaction2Code, or asks about evaluating this task. Reports CLIP.4---56# interaction2code-eval78> Interaction2Code: Benchmarking MLLM-based Interactive Webpage Code Generation from Interactive Prototyping — Jingyu Xiao et al. (2024) (arXiv:2411.03292, 2024)910## What this evaluates1112Evaluates multimodal large language models' ability to generate functional interactive webpage code from interactive prototype screenshots. It specifically probes the model's capacity to capture dynamic interaction behaviors, element positioning, and visual-textual alignment, rather than just static layout reproduction.1314## Datasets1516- **Interaction2Code** — total ?; splits: train (-1), test (-1); repo https://github.com/WebPAI/Interaction2Code1718## Metrics1920- `CLIP` **(primary)** — range: [0, 1]21 - Cosine similarity between CLIP image embeddings of the rendered generated webpage and the reference webpage screenshot.22- `SSIM` — range: [0, 1]23 - Structural Similarity Index Measure comparing the pixel-level structural fidelity between the generated and reference webpage screenshots.24- `Text` — range: [0, 1]25 - Textual overlap or embedding similarity between the extracted text content of the generated code and the reference code.26- `Position` — range: [0, 1]27 - Positional similarity score measuring the alignment of interactive elements' coordinates between the generated and reference webpages.28- `IR` — range: [0, 1]29 - Interaction Rate, representing the proportion of correctly generated interactive elements relative to the ground truth.30- `Usability Rate` — range: [0, 1]31 - Percentage of generated interactions deemed functionally consistent with the ground truth by human annotators with front-end development experience.32- `Win Rate` — range: [0, 1]33 - Proportion of pairwise comparisons where the model's output is preferred over the baseline, determined by majority vote (≥3 out of 5 annotators).3435## Input / output format3637**Input**: Screenshot of an interactive webpage prototype (and optionally accompanying textual descriptions).3839**Output**: HTML/CSS/JavaScript code implementing the interactive webpage.4041## Scoring recipe4243```python44def compute_metrics(generated_code, ref_code, gen_img, ref_img):45 gen_img, ref_img = render_to_image(generated_code), render_to_image(ref_code)46 clip = cosine_similarity(CLIP.encode(gen_img), CLIP.encode(ref_img))47 ssim = structural_similarity(gen_img, ref_img)48 text = text_similarity(extract_text(generated_code), extract_text(ref_code))49 pos = element_position_similarity(extract_elements(generated_code), extract_elements(ref_code))50 ir = count_correct_interactions(generated_code, ref_code) / count_total_interactions(ref_code)51 return {'CLIP': clip, 'SSIM': ssim, 'Text': text, 'Position': pos, 'IR': ir}52```5354## Common pitfalls5556- MLLMs significantly undergenerate interactive elements relative to static content, leading to incomplete functionality.57- Performance degrades sharply for interactions with low visual saliency (small area ratio on the screen).58- Single-modality (visual-only) inputs yield substantially poorer results than combined visual-textual inputs.5960## Evidence (verbatim from paper)6162> Gemini-1.5-flash's metrics (CLIP, SSIM, text, position, IR) of the interaction part improve from direct prompting scores (0.4737, 0.3616, 0.2809, 0.4302, 0.6738) to (0.5093, 0.3854, 0.3217, 0.4511, 0.7112) with CoT, and further to (0.5194, 0.3898, 0.3454, 0.4612, 0.7326) with Mark prompting.6364## Citation6566```bibtex67@misc{xiao2024interaction2code,68 title={Interaction2Code: Benchmarking MLLM-based Interactive Webpage Code Generation from Interactive Prototyping},69 author={Jingyu Xiao et al. (2024)},70 year={2024},71 note={arXiv:2411.03292}72}73```7475- arXiv: 2411.03292