Vision-Guided Iterative Refinement for Frontend Code Generation
Organizations: School of Mathematics, University of Bristol, UK · Amazon AGI
Abstract
Code generation with large language models often relies on multi-stage human-in-the-loop refinement, which is effective but very costly - particularly in domains such as frontend web development where the solution quality depends on rendered visual output. We present a fully automated critic-in-the-loop framework in which a vision-language model serves as a visual critic that provides structured feedback on rendered webpages to guide iterative refinement of generated code. Across real-world user requests from the WebDev Arena dataset, this approach yields consistent improvements in solution quality, achieving up to 17.8% increase in performance over three refinement cycles. Next, we investigate parameter-efficient fine-tuning using LoRA to understand whether the improvements provided by the critic can be internalized by the code-generating LLM. Fine-tuning achieves 25% of the gains from the best critic-in-the-loop solution without a significant increase in token counts. Our findings indicate that automated, VLM-based critique of frontend code generation leads to significantly higher quality solutions than can be achieved through a single LLM inference pass, and highlight the importance of iterative refinement for the complex visual outputs associated with web development.
Figures & tables
| Outcome | Single-dimensional Judge | Multi-dimensional Judge |
|---|---|---|
| Agreement | 48.5% | 69.5% |
| Draw | 28.5% | 8.5% |
| Disagreement | 23.0% | 22.0% |
| Generator | Method | Score | Gain (%) | Tokens |
| Distill-Qwen-14B | Initial code | – | 2,571 | |
| CITL: Cycle 1 | +6.2 | 15,067 | ||
| CITL: Cycle 2 | +7.8 | 29,853 | ||
| CITL: Cycle 3 | +8.7 | 45,808 | ||
| CITL: Best | +17.8 | 23,662 | ||
| Refine w/o Critic | +1.5 | 7,209 |
| Method | Code Task Accomplishment | Code Quality | Visual Task Accomplishment | Aesthetic Quality |
|---|---|---|---|---|
| Initial code | 4.244 | 4.923 | 5.618 | 6.158 |
| CITL: Cycle 1 | 4.559 (+7.4%) | 4.840 (-1.7%) | 6.249 (+11.2%) | 6.582 (+6.9%) |
| CITL: Cycle 2 | 4.584 (+8.0%) | 4.785 (-2.8%) | 6.461 (+15.0%) | 6.737 (+9.4%) |
| CITL: Cycle 3 | 4.635 (+9.2%) | 4.764 (-3.2%) | 6.561 (+16.8%) | 6.801 (+10.4%) |
| CITL: Best | 4.998 (+17.8%) | 5.300 (+7.6%) | 7.094 (+26.3%) | 7.269 (+18.0%) |
| Refine w/o Critic | 4.296 (+1.2%) | 4.942 (+0.4%) | 5.707 (+1.6%) | 6.321 (+2.6%) |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
| Generator | Method | Code Task Accomplishment | Code Quality | Visual Task Accomplishment | Aesthetic Quality |
|---|---|---|---|---|---|
| Haiku 4.5 | Initial code | 7.110 | 7.071 | 7.804 | 7.758 |
| CITL: Cycle 1 | 7.571 +6.5% | 7.369 +4.2% | 8.002 +2.5% | 7.882 +1.6% | |
| CITL: Cycle 2 | 7.707 +8.4% | 7.529 +6.5% | 8.082 +3.6% | 7.960 +2.6% | |
| CITL: Cycle 3 | 7.782 +9.5% | 7.560 +6.9% | 8.135 +4.2% | 7.970 +2.7% | |
| CITL: Best | 7.995 +12.4% | 7.794 +10.2% | 8.522 +9.2% | 8.330 +7.4% | |
| Sonnet 4.5 | Initial code | 7.346 | 7.192 | 8.106 | 7.690 |
Code Generation
Code generation studies methods for turning natural-language, visual, or formal specifications into executable programs and code edits.
See all 313 papers