Coding assistants · Research feature

Coding agents show strong structural accuracy in visual drawing tasks

A study finds general-purpose coding agents excel at maintaining structural integrity in zero-shot drawing, outperforming in compositional accuracy despite limited perceptual detail.

Adapted from research by Hengguang Zhou, Yuanhao Ban, Jiaqi Feng and colleagues.

arXiv preprint revision · 2026-10-13 · Attribution & reuse
In this article
Editorial illustration of a branching diagram.

Editor’s introduction

Agents achieve 83.0% structural-fidelity in blind drawing, slightly below the 85.6% seen with visual feedback, indicating that code-based construction supports structural accuracy but does not fully match visual guidance. The study highlights agents’ strengths in preserving layout and satisfying explicit constraints, while noting limitations in capturing fine-grained visual details or perceptual richness. Drawing outcomes are influenced by the interface used, and procedural skills derived from human demonstrations support varied artistic media. Evidence of cross-harness consistency, coherent room arrangements across viewpoints, and stable self-generated scenes after removal of visible drawings suggests agents maintain an internal, structured representation of scenes. This supports a hypothesis that agents use a shared visual language of thought for scene understanding. However, the findings are based on behavioral observations, not direct access to internal models, and most evaluations rely on automated metrics with limited human validation.

Introduction

In recent years, text-to-image generation has largely relied on end-to-end generative models, including latent diffusion models, rectified-flow transformers, and autoregressive models. Despite their considerable success, these approaches encode the generation process in learned neural networks, leaving the details of image construction largely implicit in model parameters. In contrast, modern agents offer a programmatic alternative: they can write and execute programs, coordinate tools, and iteratively refine their actions over multiple turns. These developments motivate our central question: How far can general-purpose coding agents go in visual generation?

We first assess these agents as zero-shot drawers using harnesses ranging from individual pixels and geometric primitives to Canvas 2D programs, SVG documents, and a graphical painting application. To evaluate these coding agents, we introduce AgentDrawBench, a 200-prompt benchmark spanning multiple domains. We will publicly release the benchmark to support further research on agent-based visual generation. Our results show that these agents are strong in structural fidelity but fall short in perceptual realism compared with native image generators. In particular, GPT-6-Astra with Canvas 2D achieves 85.8% structural fidelity, compared with 68.8% for gpt-image-1 and 90.7% for gpt-image-2. On design and symbolic tasks, where precise control matters more than photorealistic appearance, GPT-6-Astra with Canvas 2D achieves a 92.0% holistic win rate against gpt-image-1, judged by gemini-3.5-flash. This task-dependent profile reveals the potential of coding agents for visual generation without a dedicated image generator. These results raise a further question: can agents also use visual programs to organize and reason about the scenes they depict?

The language-of-thought hypothesis proposes that thinking operates over structured mental representations whose meanings depend on their components and how they are combined. Drawing on this perspective, we frame visual code as an external visual language of thought: a structured, executable medium for organizing, manipulating, and reasoning about visual content. We examine whether code can serve this role in both visual generation and understanding. For generation, the agent achieves 83.0% structural fidelity using code alone, close to the 85.6% achieved when it can inspect intermediate images. For understanding, we sample 200 visual question answering tasks from WorldBench covering a broad taxonomy of real-world visual concepts and reconstruct the question images as SVG code. We find that answering from source code achieves 69.0% accuracy, compared with 65.0% from the render and 74.0% from the original image. In the academics and digital-world domains, the agent answers questions more accurately using code than using the original images.

Text-to-image generative models

Diffusion models have achieved substantial success in text-to-image synthesis in recent years. Cited researchers propose to diffuse the latent instead of the image pixels. Imagen combines language representations with cascaded diffusion. transform random noise into data along nearly straight paths, making generation simpler and faster. Cited researchers use the difference between conditional and unconditional noise predictions to guide generation toward alignment with the input prompt. Transfusion unified image tokens and language tokens in one shared transformer and provides better control.

Agentic image-generation systems

Agents organize image creation through tool selection, external knowledge gathering, and iterative refinement. Early systems coordinate visual foundation models, select suitable diffusion generators, and revise generation prompts using visual feedback. Recent work extends these capabilities. VisionDirector decomposes long instructions into structured goals and verifies staged edits with rollback. For knowledge-intensive requests, Gen-Searcher performs search to gather textual knowledge and reference images. RS-Gen uses a training-free questioning-and-solving loop for reasoning and search-augmented generation. As a related concurrent work, MaLiang-Harness studies programmable image and video generation, addressing the gap between executable programs and their visual outcomes.

Harness Design

We design several harnesses for programmable drawing, ranging from direct pixel assignments and shape-based marks to executable Canvas 2D programs and SVG documents. To evaluate whether agents can draw in a human-like manner, we also assess their ability to imitate human drawing strokes and draw through graphical user interfaces (GUIs).

Benchmark Construction

We construct AgentDrawBench, a 200-prompt benchmark across seven families: photographic scene, human/organic, product/material, spatial/3D, stylized illustration, designed visual, diagram/symbolic. We select prompts from four published benchmarks: 110 from Arena-T2I-Hard, 40 from HPDv3, 35 from BizGenEval and 15 from GraphicWeaver. We evaluate structural fidelity, perceptual realization, and holistic quality on AgentDrawBench. We will publicly release AgentDrawBench.

Structural fidelity

We assess prompt adherence using question checklists about the generated image. We retain the source benchmarks’ question sets where available: DSG-style questions from Arena-T2I-Hard, 20-question checklists from BizGenEval, and binary VQA questions from GraphicWeaver. For HPDv3, we generate DSG-style atomic questions from each prompt and manually audit the resulting checklists. These questions cover requested objects, attributes, counts, spatial relationships, text, and layout. For each image, a VLM answers every question with yes, no, or unclear, accompanied by visual evidence. We score questions independently and report the proportion answered yes, treating both no and unclear as failures. For Arena, the structural comparison retains only the source questions labeled faithfulness.

Perceptual quality

An image can satisfy the requested content yet appear visually unconvincing. We therefore assess perceptual quality through relative comparisons on the same prompt, asking which aspects of an agent’s output fall short of a native image-generation baseline. The perceptual rubric contains ten dimensions: artifacts, object form, anatomy, typography, perspective, light transport, material, scene physics, medium realization and semantic coherence. For each dimension applicable to a prompt, a VLM compares the two outputs and selects the better image. To eliminate position bias, each comparison is performed twice with image positions swapped; a win requires agreement across both orderings, while disagreements are reported as ties.

Generation without Visual Feedback

We first ask how well the agent can draw through code and execution feedback alone without visual feedback. We evaluate the GPT-6-Astra agent with Canvas 2D harness on AgentDrawBench. In the blind setting, the agent receives execution results, but never sees the RGB canvas. In the visual feedback setting, it also receives the current rendered canvas after each drawing turn.

Results

On AgentDrawBench, blind drawing achieves an 83.0% structural-fidelity pass rate, compared with 85.6% with visual feedback. These results support the view that code can serve as a working representation for image construction, with rendered-image feedback providing a modest additional structural gain.

Understanding Images through Reconstructed Code

We next ask whether agents can interpret visual code to recover information about an image. To this end, we sample 200 WorldBench image–question pairs proportionally across seven domains. The agent reconstructs the original image as SVG before receiving the question. The agent then answers the same question in a fresh context for each condition, using the original image, the SVG source alone, or the rendered reconstruction. The code-only condition receives no rendered image.

Stroke-workflow protocol

The agent analyzes sampled frames and stroke sequences from drawing demonstrations, identifying how marks are made and how they accumulate to form shapes. These observations are translated into reusable stroke operations and procedural skills specifying construction order, value grouping, edge control, and local corrections. We develop four workflows: Chinese ink combines tapered lines, broken dry strokes, dilute washes, and reserved empty space; charcoal builds tonal masses through broad deposits and directional hatching, then models form through local smudging and lifting; watercolor layers transparent washes, preserves paper lights, and finishes with selective dry-brush accents; and oil painting progresses from broad color masses to loaded strokes, glazing, scumbling, and selective impasto. Video sources and extracted procedures are detailed in Sec. A.1. For each reconstruction, GPT-6-Astra receives a reference image and the written procedures for the selected medium. It starts with a blank persistent canvas and refines the drawing using rendered-image feedback. The agent may inspect the reference, but its drawing code cannot sample, trace, blit, or filter the reference pixels.

Coherence

Consistency across expressions motivates a further test: can the agent preserve a scene’s spatial structure through successive viewpoint changes and revisits? We examine spatial coherence in self-generated rooms. Given a predefined furniture list, the agent chooses where to place the furniture, then draws the room from different headings and returns to earlier views. The room’s arrangement should remain stable while visibility and image-relative ordering change with viewpoint, and revisits should recover the earlier views. By removing earlier SVGs from the visible conversation, we test whether the agent can continue to express its own scene choices without rereading those drawings.

Test setting

Four conditions vary the retained context: (1) the agent’s own drawings (SVG) are kept; (2) they are replaced by one-line stubs; (3) both drawings and the furniture list are replaced by stubs; or (4) every view is a fresh call given only the list and the turn history. Every condition covers all 30 rooms.

With no externally specified target arrangement, we score agreement among the agent’s own outputs geometrically from the SVG: whether a revisited heading shows the same pieces and relations as its first view (piece-set Jaccard, relation agreement), and whether each wall view shows exactly the pieces the agent’s own plan places on that wall, in the same left-to-right order. Chance is obtained by permuting the plan’s wall assignment. All conditions use GPT-6-Astra with SVG output; protocol details are in Sec. D.1.

Interpretation

The room experiment shows that later drawings remain compatible with the agent’s earlier scene choices as the requested viewpoint changes. Furniture positions were never supplied in the prompt, and earlier SVGs are unavailable in the removal conditions, so compatible revisits and floor plans suggest the continued availability of the agent’s chosen arrangement. This preservation of scene structure is the spatial coherence expected under the internal visual language-of-thought hypothesis. Across the three probes, visual structure recurs under changes of interface, independent queries for pixel colors, and changes of viewpoint. Together, these behaviors support the hypothesis of reusable scene content underlying external visual expressions.

Conclusion

General-purpose coding agents can draw zero-shot, with particular strengths in structural accuracy and compositional constraints and persistent limitations in perceptual richness. Drawing harnesses shape how these capabilities appear in the resulting images. Visual programs also serve as an external visual language of thought: agents can construct them and interpret the scene information they express. Beyond these observable operations, cross-harness consistency, independent pixel queries, and coherence in self-furnished rooms provide complementary behavioral evidence for an internal visual language-of-thought hypothesis. Together, these results connect agents’ use of executable visual representations to a possible shared organization of scene content across external expressions.

Limitations

Most ablation experiments use only one primary agent, and evaluations largely rely on automated judgments with limited human verification. The in-context learning experiments are evaluated qualitatively. We study frontier agents through the interfaces available to us, without access to model weights or the providers’ internal agent interfaces and implementations. Our investigation of the internal visual language-of-thought hypothesis is therefore exploratory and behavioral: consistency and coherence provide supporting evidence. The pixel-query probe covers five subjects, and the self-furnished-room experiment concerns an agent with retained, opaque reasoning history. The experiments cover selected drawing harnesses and spatial transformations; broader evaluation across models, interfaces, and transformation types would provide a more comprehensive account of these capabilities.

GUI

The GUI harness runs JS Paint in headless Chromium through Playwright. The model sends ordered batches of clicks, double-clicks, mouse-drag paths, typed text, key presses, and color selections in window coordinates. A color-selection shortcut opens and operates the application’s Edit Colors dialog. Available application tools include pencil, brush, airbrush, eraser, fill, lines, curves, rectangles, ellipses, polygons, and text. Tool choice, shape options, and canvas dimensions are set through the interface; undo is available through keyboard input. After each batch the agent might receive a screenshot containing both the canvas and application controls. Code execution, image import, and paste are unavailable as agent actions.

Blender Cycles

CPU rendering uses adaptive sampling, OIDN denoising, and the AgX view transform. Preview and final timeouts are 60 and 180 seconds, respectively, within a cumulative rendering budget of 360 seconds. Each script rebuilds the scene; external assets are excluded. Of 200 AgentDrawBench prompts, 199 have successful final renders; one exhausts the render-time budget. Structural evaluation reuses cached judgments of these exact images. Perceptual and holistic comparisons against GPT-image-1 use the same applicable dimensions and MMRBv2 rubric as the other harnesses, with Gemini 3.5 Flash through the Arena gateway and both image orderings. Perceptual judging requests all applicable dimensions in one JSON response per ordering. Different response limits and rendering costs make this a comparison of harness configurations rather than a controlled estimate of the renderer’s causal effect.

Stroke workflows

We inspect sampled video frames and short stroke sequences and encode the observed ordering, mark families, and correction procedures as instructions and medium-specific Canvas 2D helpers. This is in-context procedural guidance. Reference-guided studies begin on a blank canvas; the model may inspect the supplied reference and its current render, but its drawing code cannot sample, trace, blit, or filter reference pixels. Intermediate renders and executed programs are retained. These qualitative studies do not establish a controlled improvement on AgentDrawBench.

Generator, turns, and stopping

A turn is one API call; the model may attach any number of tool calls, which the harness executes in listed order, returning all results in one message. A reply of DONE with no tool calls ends the run. A stop without DONE is answered with a nudge to continue or finish explicitly, twice by default, before the run is recorded as stopped. Turn caps are 12 for the code harnesses and 40 for shapes.

The core programmable harnesses receive instructions describing the output device, visibility, canvas dimensions, available drawing operations, construction strategy, and stopping rule. Dimensions, background color, and the visibility clause are instantiated for each run. Below we reproduce the construction and stopping instructions from the system prompts; the operation declarations are described in the preceding harness specifications.

SVG system-prompt excerpt

Small wording choices in this skeleton carry measurable weight. An early shapes prompt lacked the sentence promising that tool calls within one turn are executed strictly in the order listed; without it, the generator issued one primitive per turn, and 3 of 9 pilot runs hit the turn cap with unfinished images. With the sentence, the same model issued 20–64 calls per turn and no run hit the cap. The added sentence makes the harness’s execution order explicit.

Run records, resumability, and cost accounting

Each run preserves the final image, vector source where applicable, intermediate frames, a timelapse, the complete interaction trace, the instantiated system prompt, the task, and judge outputs. Records include response counts, stopping reason, elapsed time, provider-reported token usage and cost, and drawing-operation counts. Batch generation and judging skip completed records when resumed. Costs are accumulated from provider-reported usage.

Conditions and analysis

The reconstruction is generated from the source image before the quiz; the reconstruction request does not contain the MCQ. Separate fresh-context calls answer the same benchmark question from the original image, rendered reconstruction, or SVG source. The question-answering evaluation uses gpt-6-astra; this is a single-model analysis. SVG input is truncated at 60,000 characters by the runner. The matching experiment has 145 items, as collection stopped at the budget limit; it supplies the SVG plus its own render or a randomly selected other item’s render. It is separate from the 200-item MCQ analysis.

Self-Furnished Rooms

The four conditions retain earlier SVGs, replace them with one-line stubs, replace both the SVGs and the furniture list with stubs, or use a fresh call for each view with only the furniture list and turn history. Every condition covers all 30 rooms.

Scoring measures self-consistency because the agent chooses the layout. Piece-set Jaccard and geometric relation agreement compare a revisited heading with its first view. Object-box IoU measures the stability of placement on revisits. Wall–plan agreement checks whether a piece appears on the wall assigned by the agent’s own plan; order agreement compares left-to-right order within a wall. Permuting the plan’s wall assignments provides the chance reference. These comparisons assess persistence and coordination of the agent’s chosen scene, rather than accuracy against an externally supplied arrangement.