ReLook: Vision-Grounded RL with a Multimodal LLM Critic for Agentic Web Coding

Paper · arXiv 2510.11498 · Published October 13, 2025
RL with Verifiable Rewards (RLVR)

While Large Language Models (LLMs) excel at algorithmic code generation, they struggle with front-end development, where correctness is judged on rendered pixels and interaction. We present ReLook, an agentic, vision-grounded reinforcement learning framework that empowers an agent to close a robust generate–diagnose–refine loop by invoking a multimodal LLM (MLLM) as a tool. During training, the agent uses the MLLM-in-the-loop both as a visual critic—scoring code with screenshots—and as a source of actionable, vision-grounded feedback; a strict zero-reward rule for invalid renders anchors renderability and prevents reward hacking. To prevent behavioral collapse, we introduce Forced Optimization, a strict acceptance rule that admits only improving revisions, yielding monotonically better trajectories. At inference, we decouple the critic and run a lightweight, critic-free self-edit cycle, keeping latency comparable to base decoding while retaining most of the gains. Across three widely used benchmarks, ReLook consistently outperforms strong baselines in vision-grounded front-end code generation, highlighting the benefits of agentic perception, visual rewards, and training–inference decoupling.

Introduction. Large Language Models (LLMs) excel on closed-form benchmarks—programming contests (Li et al., 2022), SQL synthesis (Liu et al., 2024), and mathematical reasoning (Yang et al., 2024; Deng et al., 2025)—yet still underperform on front-end code generation, where visual fidelity and interaction are first-class. Unlike binary unit tests in algorithmic tasks, front-end quality lies on a continuum: a single misaligned pixel can signify failure.

This perceptual barrier explains current shortcomings: text-only models are blind to pixel-level consequences, yielding (i) layout drift, (ii) interaction breakage, and (iii) aesthetic inconsistency. To address this, a model must (1) see rendered HTML/CSS/JS/SVG, (2) diagnose misalignments and broken interactions, and (3) iteratively refine in situ. Existing methods miss this loop: one-shot vision-to-code systems (pix2code (W ̈ust et al., 2024), Design2Code (Si et al., 2024), UICoder (Wu et al., 2024)) generate but do not refine; self-refinement frameworks (CodeRL (Le et al., 2022), Self-Refine (Madaan et al., 2023), Reflexion (Shinn et al., 2023), CRITIC (Gou et al., 2023; Peng et al., 2025; Zhang et al., 2025b)) iterate but cannot see, relying on pixel-blind unit tests or linters.

To bridge this gap, we introduce ReLook, a vision-grounded agentic reinforcement learning framework that completes the generate–diagnose–refine loop. The agent actively invokes an MLLM as a tool to ”see” rendered outputs and obtain rich textual suggestions during inference, enabling true iterative refinement. Training uses a comprehensive reward system: a powerful MLLM (e.g., Qwen2.5-VL (Wang et al., 2024)) supplies the perceptual signal text-only methods lack, and a rendering-integrity rule assigns zero reward when required screenshots are invalid to deter reward hacking.

However, we identify a critical challenge: behavioral collapse, where despite high-quality feedback, a subsequent revision can be worse. We adopt a Forced Optimization strategy that accepts only strictly improving steps, ensuring high-quality, monotonically improving trajectories. For low-latency inference, the external critic can be discarded; the model performs a lightweight self-edit cycle—render, self-edit, and converge quickly to a human-aligned result.

Our contributions are as follows:

• Robust Reward System. We employ an MLLM as the reward model to provide the rich, pixel-level training signal that text-only methods cannot capture. This is critically supplemented by a zero-reward rule for answers without screenshots, which is designed to prevent reward hacking by forcing the agent to produce renderable code.

• Agent reinforcement learning Framework. We empower the agent to perform a generate–diagnose–refine loop by actively invoking an MLLM as a diagnostic tool. The agent can “see” its rendered output and receive rich, actionable feedback for iterative improvement. To ensure this powerful loop is productive and stable, we introduce a Forced Optimization strategy that addresses the challenge of behavioral collapse by guaranteeing the construction of high-quality, monotonically improving rollout trajectories.

• Broad Applicability. We perform extensive experiments on three widely-used benchmark datasets, and demonstrate that ReLook significantly outperforms the baselines. Moreover, we show the compatibility of ReLook by integrating it with different LLMs.

Related work. Early vision-to-code systems translate static screenshots to HTML/CSS (W ̈ust et al., 2024) in one shot. Recent methods add structure—Design2Code (Si et al., 2024), Web2Code (Yun et al., 2024), UICoder (Wu et al., 2024), DesignCoder (Chen et al., 2025)—but mainly optimize static similarity, struggling with dynamics and iterative refinement. ReLook trains with a renderer in the loop, uses vision-grounded rewards from temporal screenshots, and internalizes refinement via RL, aligning with cross-modal supervision (Feng et al., 2022).

RL for program synthesis leverages unit-test rewards and large candidate sets (Le et al., 2022; Li et al., 2022); reflective/tool-driven critiques improve correction (Madaan et al., 2023; Shinn et al., 2023; Gou et al., 2023; Peng et al., 2025). For front-end, unit tests are pixel-blind; even with structured visual instructions (Yun et al., 2024), pixel signals are missing. LLM critics help surface model errors (McAleese et al., 2024). We couple the policy with a visual reward from temporal screenshots and stabilize training via Forced Optimization and zero-reward for invalid renders.

Acceptance criteria, best-of-N, and verifier-assisted search. A broad line of work improves generation via external selection/search: Codex/AlphaCode sample-and-test (Chen et al., 2021; Li et al., 2022); self-consistency/tree deliberation aggregate candidates (Wang et al., 2022; Yao et al., 2023); agentic self-refinement uses iterative critique (Madaan et al., 2023; Shinn et al., 2023; Gou et al., 2023; Huang et al., 2025). Our Forced Optimization differs in both criterion and rule: a vision-grounded score from temporal screenshots (not unit tests), and acceptance strictly requiring monotonic improvement within one trajectory. Unlike best-of-N or offline re-ranking, our rule is online, in-trajectory, preventing regressions and reward hacking, yielding stable, visually aligned improvements for front-end code.

4.3 Multimodal UI Perception and Evaluation ReLook unifies these threads via MLLM-based visual rewards within RL, offering a practical path to visually aware, self-improving front-end generation.

Method. The task of front-end code generation is to produce a code snippet c, consisting of SVG, HTML, CSS, and JavaScript, that correctly implements a user’s intent specified in a natural language question q. This code is typically preceded by a textual chain-of-thought, t, which outlines the generation plan. As established in the introduction, the correctness of c is not determined by its syntax alone, but by its rendered appearance and behavior. Given the absence of traditional unit tests for front-end code, we propose using an MLLM as the reward model to assess the perceptual quality of the output. Simultaneously, to enable the model to ’see’ its rendered results and make improvements, we design an agentic reinforcement learning framework that empowers the agent to invoke the MLLM as a tool for obtaining vision-grounded suggestions for improvement. By doing so, we aim to enhance the front-end code generation capabilities of current LLMs.

The overall framework of the proposed ReLook is shown in Figure 1. At its core, our goal is to empower the agent to ’see’ its rendered output and iteratively improve upon it during inference. We achieve this by designing an agentic reinforcement learning framework that establishes a generate–diagnose–refine loop, where the agent learns to invoke an MLLM as a diagnostic tool. To adjudicate the quality of each code revision, we institute a comprehensive reward system centered on a powerful MLLM. Crucially, to prevent the phenomenon of behavioral collapse, where optimizations paradoxically lead to inferior results, we introduce a Forced Optimization strategy. This strategy refines rollouts to construct higher-quality trajectories, thereby instilling a behavioral logic of monotonic improvement in the agent. Ultimately, this robust training allows the agent to internalize its reflective capabilities, enabling the MLLM critic to be discarded during inference to dramatically accelerate the process.

For each query q, the policy emits t and c. Upon <get feedback>, we execute c in a sandbox, capture screenshots, and query the MLLM for feedback m (wrapped in <mllm feedback>). We feed {q, t, c, m} into the next round and stop when feedback is not requested or a round cap is reached.

2.4 Reinforcement Learning Framework Only tokens in t, c contribute non-zero advantages; critic tokens m are masked ( ˆAi,t=0 on m).

Advantage estimation and credit assignment. We sample G trajectories per query and compute returns from RReLook(oi) (Eq. 5). Using the group mean b as baseline, the advantage is ̃Ai = RReLook(oi) −b, broadcast to policy tokens (text t, code c) while masking critic tokens m ( ˆAi,t=0 on m). Advantages are standardized and clipped to [−2, 2]. We regularize toward πre f with KL weight β. The combined policy πθcombined is defined as: [πθold for tr, cr] ⊕[πMLLM for mr], where πMLLM is a frozen MLLM critic (Qwen2.5-VL-72B-Instruct). Trajectories mix policy tokens (tn, cn) and critic tokens (mn). During training, only πθ is updated. The hyperparameters ε and β control clipping range and KL regularization strength.

Token masking and lightweight feedback distillation. We optimize GRPO over policy tokens (t, c) and mask critic tokens m by zeroing advantages. To enable critic-free inference, we optionally distill m-tokens with lightweight loss Lm distill toward frozen MLLM outputs (see Appendix §F for details). The total objective is L = −J t,c GRPO + γ Lm distill (default γ=0.1, sweep γ ∈[0.05, 0.3]). This lets RL improve visual quality while distillation transfers feedback style for test-time self-reflection.

Conventional RL signals for code, such as unit tests or linters, operate purely in the text domain and are blind to visual defects. To address this, our reward is derived from a powerful Multimodal LLM (Qwen2.5-VL-72B-Instruct) that scores rendered pages based on the user prompt, the generated code, and a series of temporal screenshots. Capturing screenshots at multiple time points allows the critic to assess dynamic behavior.

Conclusion. We introduced ReLook, a vision-grounded RL framework that closes a generate–diagnose–refine loop for front-end code. By coupling a multimodal LLM critic with two safeguards—zero-reward for invalid renders and Forced Optimization—ReLook achieves consistent gains over strong baselines (ReLook > Web-RL > Base) and enables critic-free inference for substantial speedups. We expect this blueprint—placing a perception-aligned evaluator inside the learning loop—to generalize beyond web UIs to other perceptual programming domains. See Appendix for limitations and future directions.

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 should design principles adapt for AI-generated interfaces? Do language models learn genuine linguistic structure or just surface patterns?