When a language model writes a web page, it improves the page far more by looking at the rendered result than by rereading its own HTML. In one study, refining without visual feedback gained 1.5%, while a vision-guided critique loop gained up to 17.8% over three cycles (Vision-Guided Iterative Refinement for Frontend Code Generation). Looking is expensive, though. Every cycle, the whole screenshot is cut into image patches and converted into hundreds to thousands of "visual tokens," the units a vision-language model reads. Those tokens can make up 97–99% of the model's input (CARES). Most of that work is wasted, because a typical repair changes one button's padding or one card's color and leaves the rest of the page pixel-identical to the previous cycle.
We propose that a visual critic should pay for the pixels that changed, not for the whole page. The critic keeps its internal memory of the previous render: the cached keys and values that a transformer stores for tokens it has already read, usually called the KV cache. On each new cycle, it re-encodes only the image tiles whose pixels differ. The fresh tiles are written in at the same spatial positions, and the stale entries they replace are evicted. The question is whether this "delta" critic can find layout bugs, including regressions far from the edited region, as reliably as a critic that re-reads the full page. If it can, the per-cycle visual cost drops to roughly the fraction of the page that changed.
Core Claim
Let $N$ be the number of visual tokens in a full render and $\rho_t$ the fraction of image tiles whose pixels changed between cycle $t-1$ and cycle $t$. A full-re-encode critic pays about $N$ visual tokens of prefill (the forward pass over the prompt) every cycle. The delta critic pays about $\rho_t N$, plus a small constant for the new critique prompt. We claim three things. First, on real refinement trajectories $\rho_t$ is small for most cycles. Second, delta encoding at the same resolution keeps critique quality statistically indistinguishable from full re-encoding. Third, it beats alternatives that spend a similar token budget: cropping, downsampling, and similarity-based pruning. The mechanism has two parts. One is change detection on the rendered pixels. The other is KV-cache surgery that replaces stale visual entries in place. Everything else, including the generator, the code critic, and the loop structure, stays identical to existing pipelines, so any quality or efficiency difference comes from how the page is seen.
Relation to Prior Work
The motivating evidence comes from systems that close the loop through a renderer and pay full price every time. The Critic-in-the-Loop (CITL) pipeline renders HTML/CSS with a headless browser, has a vision critic describe discrepancies, and has a code critic translate them into patches. Its authors note the token and latency overhead but do no pruning or caching (Vision-Guided Iterative Refinement). Canvas-of-Thought edits an HTML canvas through atomic create/update/delete operations on individual elements, then re-renders and re-encodes the entire canvas after each edit, which its authors describe as a constant visual encoding overhead (Canvas-of-Thought). ArtifactsBench captures three screenshots per interactive task (before, during, after) and feeds all three to judge models, even when the interaction only touched a small region (ArtifactsBench). We keep their loops and change only the visual input path.
The method borrows from two token-efficiency ideas and extends both to inputs that change over time. LongVILA-R1 caches visual embeddings once and reuses them across reinforcement-learning rollouts. That works because its video never changes (Scaling RL to Long Videos); our renders change a little every cycle, so reuse has to be partial and position-aware. LOOK-M evicts and merges visual KV entries to shrink memory for long multimodal prompts (LOOK-M). It compresses a static prompt once, whereas we evict entries because they became false, not because they are unimportant.
Other work sets constraints on the design. DART shows that dropping near-duplicate visual tokens preserves 98.8% of LLaVA-1.5-7B accuracy at 88.9% pruning on natural-image benchmarks (DART). On web pages, however, identical-looking patches are often distinct elements, such as repeated cards or list bullets, that must each exist in code. Design2Code already shows visual recall is the dominant failure: GPT-4o's Block-Match falls from 93.0 to 56.6 on dense layouts (Design2Code). We therefore never deduplicate within a frame; we only skip tiles that are identical across frames at the same position. VisionThink shows that pruning methods like FastV lose 9.0 points on ChartQA and 8.3 on OCRBench relative to its approach (VisionThink). That is a warning that reducing resolution hurts fine text, and UI critique is full of fine text.
Two loop-level findings shape how the saved compute is used. Refinement gains plateau after a few cycles (Yan et al.), so we do not argue that cheaper cycles buy more cycles. Instead, cheap cycles make verification and rollback affordable. Rollback reverts to the last verified state when an edit causes a regression, and has been used in hardware-design loops (Fang et al.). A snapshot of the cached KV state at the last good render makes reverting nearly free.
Research Program
The first step tests the premise before building anything. We will replay CITL-style trajectories on the WebDev Arena test split (600 tasks, as used by the CITL paper) and on Design2Code with a self-revision loop. For each consecutive pair of renders we will measure $\rho_t$ at the tile granularity of the chosen vision encoder. The idea fails outright if typical edits trigger page-wide reflow, for example when a changed header height shifts every element below it. So this measurement also quantifies how often small code edits produce large pixel changes.
Reflow is exactly the case pixel diffing handles badly. Shifted content counts as "changed" even though it is only displaced. To address this, the second component matches tiles by translation. A tile that reappears unchanged at a vertical offset keeps its cached encoding and receives only a new position index. This relies on the rotary position encoding used in Qwen2-style vision-language models, where a token's spatial position is supplied separately from its content, so moving a tile means supplying a new position rather than recomputing its content.
The third component is the KV surgery itself. We will use an open critic from the Qwen2.5-VL family, which ArtifactsBench already uses as a judge. Its vision encoder uses windowed attention, so re-encoding a changed tile plus a one-window margin approximately reproduces a full re-encode locally; we will measure that error directly. In the language model, stale visual entries are masked out and the fresh tiles are appended at their original spatial positions. The text tokens already in the cache were computed while attending to the old image, and that contamination is the main approximation. We will study it in three settings: no correction; re-running only the prior-critique text over the updated cache, which is cheap because the text is short; and a light LoRA fine-tune on full-versus-delta pairs that teaches the model to treat appended tiles as overriding the evicted ones.
The fourth component extends the approach to interaction. For ArtifactsBench-style before/during/after capture, the second and third frames are encoded as deltas against the first. This turns ArtifactsBench's tripled token cost into roughly one full frame plus two small updates.
Baselines
The naive reference point is the CITL loop exactly as published. The critic re-encodes the full-resolution screenshot in a fresh call each cycle, using the same generator, code critic, cycle count, and judge as our method. The strongest reported number for this loop is an up to 17.8% performance increase over three cycles with Distill-Qwen-14B on WebDev Arena (Vision-Guided Iterative Refinement). No reported result found on Lacuna for its per-cycle token count or latency, so we will measure those ourselves. A second reference is a multi-turn critic that keeps every past screenshot in context. Its memory grows with each cycle, and it shows the cost of naive history.
The strongest token-reducing competitor on the same question is a crop-plus-thumbnail critic. It sends a full-resolution crop of the changed bounding box plus a downsampled whole-page thumbnail and the previous critique. This baseline uses the same pixel diff we do, so it isolates our remaining ingredient: keeping full-resolution encodings of the unchanged page in the model's memory rather than a thumbnail of it. We will also run VisionThink-style quarter-resolution input (VisionThink), DART at a matched visual-token budget (DART), and LOOK-M KV compression at matched memory (LOOK-M). On Design2Code, the external reference is GPT-4o's reported 93.0 Block-Match on the standard set and 56.6 on the HARD subset (Design2Code). We use these numbers to show where the loop sits relative to frontier models, not as a matched comparison.
All methods share the same critic weights, except the fine-tuned variant, which gets its own LoRA-only control trained on full-resolution data with the same compute. They also share the same tasks, cycle budget, and hyperparameter search budget. We count as beating a baseline either of two outcomes: final-page quality within the confidence interval of full re-encoding while using fewer visual tokens than the baseline, or higher quality at the same token budget.
Four ablations isolate the key ingredient. Delta encoding with exact recomputation of all downstream KV entries sets the ceiling. Delta encoding without eviction, where stale tiles remain visible, tests whether contradictory tiles confuse the model. A second ablation removes translation matching. A third replaces pixel diff with bounding boxes derived from the DOM diff (the diff of the page's element tree).
Why not just…?
Why not just crop the changed region and send it with a low-resolution thumbnail? This is the most serious threat, and it needs no model surgery. Its weakness is that UI defects are often relational. An edited button can look correct in its crop while now misaligning with a sibling row that appears only as a blur in the thumbnail. Design2Code's recall collapse on dense pages suggests low-resolution global context misses exactly such elements. We will not rely on that argument alone. We will build a test set of injected relational bugs, including misaligned columns, overlap, and inconsistent spacing across repeated cards. If crop-plus-thumbnail matches delta encoding there and on end-task quality, we will report that the simpler method suffices and that the KV surgery is unnecessary.
Why not just downsample or prune with an off-the-shelf method? VisionThink's gaps over FastV on ChartQA and OCRBench show that uniform reduction hurts text-dense images. DART's duplicate removal is specifically dangerous on pages built from repeated components. Both are included as matched-budget baselines, and our injected-bug set includes small-text and repeated-element defects, where we expect them to fail.
Why not just derive the changed region from the code diff instead of the pixels? A DOM diff predicts where the edited element is but not where cascading layout effects land, whereas a pixel diff observes exactly what changed at trivial cost. We therefore make pixel diff the default and test DOM-derived boxes only as an ablation. We expect the DOM variant to miss reflow-induced regressions.
Why not just distill the loop into the generator and skip rendering at inference? The CITL paper reports that LoRA distillation captures 24.7% of the best loop's gains and 50.6% of the third cycle's gains. That leaves most of the benefit in the runtime loop, and the runtime loop is the part this proposal makes cheaper. The two approaches are complementary, and we will report delta critique on top of a distilled generator.
Proposed Experiments
The first decisive check is the distribution of $\rho_t$ across WebDev Arena and Design2Code trajectories, with and without translation matching. If the median changed fraction exceeds about one half, the efficiency argument collapses and we stop.
The second check measures critique fidelity. Relative to the full-re-encode critic, we measure three things: agreement on defects flagged, recall on the injected-bug suite (split into local, relational, and reflow bugs), and divergence of the patches the code critic proposes.
The third check is end-task quality after three cycles, scored with the CITL paper's VLM judge on the 600 WebDev Arena test tasks. We also report Block-Match, position, color, and text similarity on Design2Code and its HARD subset. For each method we report visual tokens per cycle, prefill latency, and peak KV memory on identical hardware.
The fourth check extends delta encoding to ArtifactsBench's three-frame interaction captures. It tests whether judge scores stay consistent with full-frame judging while the added frames cost a fraction of a full frame.
The fifth check tests rollback. We compare regression rate and total cost for a loop that snapshots the cached KV state at each verified render and reverts on regression, against the same loop with full re-encoding.
The result that would most change our view is delta encoding with exact downstream recomputation matching full re-encoding while the cheap no-correction variant fails badly on relational bugs. That outcome would mean the contaminated text cache, not the visual tiles, is the real obstacle, and would redirect the work toward the fine-tuning route.
References
- Vision-Guided Iterative Refinement for Frontend Code Generation
- CARES: Context-Aware Resolution Selector for VLMs
- Canvas-of-Thought: Grounding Reasoning via Mutable Structured States
- ArtifactsBench: Bridging the Visual-Interactive Gap in LLM Code Generation Evaluation
- Scaling RL to Long Videos
- LOOK-M: Look-Once Optimization in KV Cache for Efficient Multimodal Long-Context Inference
- Stop Looking for "Important Tokens" in Multimodal Language Models: Duplication Matters More
- Design2Code: Benchmarking Multimodal Code Generation for Automated Front-End Engineering
- VisionThink: Smart and Efficient Vision Language Model via Reinforcement Learning
- CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translation
- MEIC: Re-thinking RTL Debug Automation using LLMs