arXiv:2611.12112cs.SENov 2026

Manuscript Offprint

arXiv:2611.12112

LiveWorkspace: Externalizing Visual Understanding as Persistent Shared State for Screenshot-to-Code Agents

Shijun Xiao, Zonghui Yang, Xinrong Chen, Hao Liu, Wensheng Zhang, Yongqiang Tang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Screenshot-to-Code requires coding agents to sustain visual understanding across code generation, execution, and revision. We introduce LiveWorkspace, a visual coding harness that externalizes this understanding as Shared Visual State (Shared VS), an implementation-independent representation of visual hierarchy, node attributes, and layout relations. LiveWorkspace constructs and retains Target from screenshots and recovers Current from browser execution in the same schema. Structured Diff and implementation bindings guide code modifications; user edits update Target and reuse the alignment loop. Using GPT-5.2 for both methods, LiveWorkspace improves end-to-end Avg by 1.8 points on Design2Code and 2.0 on ScreenBench over a control with matched model-call counts and stagewise budget limits. Further experiments demonstrate reuse of constructed Shared VS across coders and improvements in iterative repair. LiveWorkspace also achieves 93.0% edit success across 100 controlled editing cases. These findings support treating visual understanding as a persistent shared working state throughout code generation, execution, and modification.

1 Introduction

As coding agents evolve from code completion and program generation toward understanding, building, and modifying real software interfaces (Yang et al., 2024; Wang et al., 2025, 2024), Screenshot-to-Code is becoming a fundamental capability for translating visual intent into executable software. Given a target webpage screenshot, a model must generate HTML/CSS/JavaScript whose browser rendering faithfully reproduces the target design. The model must identify visual elements, recover their structure and attributes, and translate these visual constraints into executable code. Code generation is also not the end of this process: many visual

Figure

(a) Structure-guided (b) Screenshot-driven (c) LiveWorkspace (Ours)

Figure 1: Visual interfaces for Screenshot-to-Code. (a) Target-side structure guides generation; (b) rendered screenshots provide image-level feedback; (c) LiveWorkspace maintains Target and Current in Shared VS and exposes their differences for code revision.

deviations become apparent only after the code is rendered, requiring the coding agent to verify and revise the implementation. The central challenge of Screenshot-to-Code is therefore to sustain visual understanding that guides code generation and modification after execution.

Existing methods improve this process along two main directions. One line of work uses explicit page decomposition and structural modeling to provide intermediate representations of regions, layouts, or hierarchies for code generation, including DCGen, LaTCoder, LayoutCoder, and ScreenCoder (Wan et al., 2025; Gui et al., 2025b; Wu et al., 2025a; Jiang et al., 2025). Another brings browser execution results back into generation and performs multiple rounds of refinement based on differences between the target screenshot and the current rendering, including UI2Code N^{N}, VisRefiner, and other rendering-in-the-loop methods (Yang et al., 2025b; Deng et al., 2026). The former improves understanding of the target page structure; the latter enables continued correction of visual errors through execution feedback after initial generation. However, target-side structural representations and execution-side visual feedback still lack a common, persistent state interface. Structural representations primarily guide code generation, without normalizing execution results into the same representation. Screenshot-based feedback still relies on the model to infer visual correspondences between the target and current implementation from images.

Based on this observation, we formulate Screenshot-to-Code as a continuous process of visual alignment and introduce Shared Visual State (Shared VS) to externalize page understanding into a working state independent of the specific HTML/CSS implementation. Shared VS describes the final visible structure and appearance of a page through visual hierarchy H, node attributes A, and layout relations L, without requiring recovery of the original DOM or CSS. The same schema supports recovery of Target Shared VS from the target screenshot and Current Shared VS from code execution, enabling explicit comparison between the target design and current implementation.

Building on this representation, we introduce LiveWorkspace, a visual coding harness that uses Shared VS as its core working state and combines the coding agent’s structural reasoning with deterministic visual measurement. LiveWorkspace retains Target Shared VS across iterations and recovers Current Shared VS after each execution, using their differences to guide subsequent modifications; user edits update Target and reuse the same alignment process. Figure 1 illustrates the distinction between target-side structure, image-level feedback, and persistent shared visual state.

We evaluate the complete LiveWorkspace harness on Design2Code and ScreenBench. Compared with a GPT-5.2 control with matched model-call counts and stagewise budget limits, LiveWorkspace improves final reconstruction Avg from 91.8 to 93.6 on Design2Code and from 81.2 to 83.2 on ScreenBench, gains of 1.8 and 2.0 points, respectively. With only Recovered Target Shared VS as visual input, DeepSeek-V4 achieves initial-

generation Avg scores of 92.7 and 83.0 on Design2Code and ScreenBench. Controlled repair experiments show that Structured Diff improves the repair rate, with further gains from source binding; LiveWorkspace also achieves higher final fidelity and introduces fewer new defects than screenshot feedback. Across 100 controlled editing cases, LiveWorkspace achieves 93.0% edit success.

Our main contributions are as follows:

• We introduce Shared VS as an implementation-independent interface that represents target designs and executed implementations in a common visual schema for explicit comparison and alignment.

• We build a visual coding harness around Shared VS, separating agent-based structural reasoning from deterministic visual measurement. It retains Target, recovers Current after execution, and unifies generation, repair, and user editing through the same state interface.

• Our experiments show that Shared VS supports reuse across coding models, Structured Diff turns state discrepancies into actionable repair feedback, and source binding provides implementation-location cues that further improve repair.

References (54)