acceptodds
Under review as a conference paper at ICLR 2027

GenClaw: Code-Driven Agentic Image Generation

Abstract

Image generation models have evolved from text-conditioned pixel synthesis toward multimodal agents endowed with visual comprehension and tool invocation capabilities. Yet, existing agents remain at the mercy of underlying black-box image models. Their workflow is trapped in a repetitive cycle of prompt rewriting for generation refinement, leaving them with no mechanism to directly manipulate the canvas. In essence, the potential of LLMs to serve as a genuine "brush" for precise visual construction remains largely untapped. In this paper, we propose GenClaw, a code-driven agentic image generation paradigm that empowers the agent to create like a human artist: first conceptualizing, then sketching, and finally coloring. Specifically, the agent first constructs the conceptual knowledge and context through search and reasoning. It then utilizes code (e.g., SVG, HTML, Three.js) to render executable visual sketches. Finally, it employs an image generation model to supplement textures, materials, and photorealism. In this workflow, code serves as a controllable intermediate canvas bridging linguistic reasoning and pixel synthesis, seamlessly integrating programmatic logic with the visual expressiveness of generative models. By transforming image generation from a black-box paradigm into a staged process akin to authentic human creation, GenClaw offers a step toward for highly controllable and interpretable visual generation systems.

Primary area:
applications to computer vision, audio, language, and other modalities
Keywords:
Agentic Image Generation

Reviews

Among:
Shape:
1234this paper, Top 15%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 3.00 over 3 reviews, above 85% of the others.
Reviewer_7t1LOpenReview ↗
Rating
3(+1)
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

The authors propose the Code-Driven Agentic Image Generation paradigm and instantiate it as GenClaw. The system follows a Conceptualize → Sketch → Color workflow. In the conceptualization stage, the agent constructs relevant knowledge and context via search and reasoning. In the sketching stage, it generates executable visual sketches using code (e.g., SVG, HTML, or Three.js). In the coloring stage, an image generation model is used to add textures, materials, and photorealistic details. Code functions as a controllable intermediate canvas that bridges linguistic reasoning and pixel-level synthesis.

Critical strengths
  1. The motivation is clear and easy to follow. The analogy to human artistic practice and the identification of the lack of a direct “brush” for structural control provide a coherent rationale for the proposed workflow.
  2. The experimental evaluation is comprehensive, and the reported results on GenEval++ and Mind-Brush are convincing. The quantitative gains on compositional control and knowledge-grounded generation support the practical effectiveness of the approach.
Critical weaknesses
  1. In essence, GenClaw is a decoupled agentic workflow in which each stage (search/reasoning, code-based sketching, and generative rendering) has been proposed and validated in prior work. The contribution appears to consist primarily of combining these existing components rather than introducing additional technical novelty. While the empirical results are compelling, this raises concerns about limited conceptual inspiration for the broader research community.
Questions for authors
  1. Is the framework robust across multiple underlying models? As a compositional system, its generality with respect to different generator choices would be valuable to understand. In particular, does GenClaw enable smaller or open-source generators to approach the performance of strong closed-source models? Such evidence would strengthen the case for its practical application value.
3 comments

We sincerely thank the reviewer for the thoughtful review, and for finding the motivation clear and the evaluation comprehensive and convincing. We address each point below.

W1: Technical novelty

We thank the reviewer for this thoughtful comment, which gives us the opportunity to clarify our contribution. The core question GenClaw addresses is who leads image creation. In current image generation, including existing image-generation agents, the image model leads: the agent can only describe its intent in text, and a black-box model fits an image to that description in a single pass. GenClaw hands the lead to the agent and follows how humans create: it first gathers knowledge and conceives the content, then sketches the structure with code, and only then lets the image model add texture and realism. Image generation thus changes from single-shot fitting into a long-horizon creative process, in which the agent writes, renders, inspects, and revises its work before any pixels are synthesized.

This shift leads to four differences from prior work:

  1. A real brush rather than a better prompt. Agents such as PromptEnhancer (Wang et al., 2025b), GenAgent (Jiang et al., 2026), and Mind-Brush (He et al., 2026) repeatedly revise the text sent to the generator, so the structure of the image is still decided inside the generator. GenClaw lets the LLM draw directly in visual languages such as SVG, HTML, and Three.js, and decide counts, positions, layout, and layering itself.
  2. Code can be the final medium. For text-heavy posters, slides, and infographics, the text, and in some cases the whole image, is rendered directly from HTML, while the image model supplies only the background and style. Every character is therefore exact by construction instead of being drawn as pixels by an image model, which underlies GenClaw's 0.989 / 0.988 on LongText-Bench (Geng et al., 2025) (Table 2, Figure 5).
  3. Code as a world model. For physical scenes, the agent first builds an executable, simplified world with Three.js or Python, for example to compute mirror reflections or the ranges of water jets, and the generator then renders it. Physical laws are thus computed rather than imagined by the generator (Figures 2 and 6).
  4. Editable and inspectable intermediate states. Because the plan lives in code, layered records, and retrieved evidence, users can inspect and revise it before rendering, edit an image by changing only the target layer or mask (which yields the high preservation scores on ImgEdit in Table 3), and trace a failure back to retrieval, construction, or rendering.

We agree that search, code sketches, and generative rendering have each been explored before. Our tool ablation (see our response to Reviewer gm6z (W1)), however, shows that the gains come from letting the agent draw rather than from simply combining strong components: with the same LLM, review, generator, and generation budget, removing only the code-rendering tools lowers GenEval++ from 0.879 to 0.805, and the prompt-level agents in Table 1 likewise remain between 0.72 and 0.78.

We hope this offers the community a broader insight: image generation can move from a model that fits pixels to a prompt toward an agent that creates through tools and editable intermediate representations. Just as code agents are reshaping software engineering, this paradigm lets advances in code-capable LLMs carry over directly to visual creation.

Q1: Robustness across generators

Thank you for this valuable question. Yes. GenClaw is generator-agnostic by design: the agent policy stays unchanged, and only the renderer is replaced (Section 3.4). We evaluate it on GenEval++ with the open-source Qwen-Image (Wu et al., 2025a) and two closed-source generators, Gemini-3.1 Flash-Image (Raisinghani, 2026) and GPT-Image-1.5 (OpenAI, 2025b):

GeneratorTypeDirect generationGenClawGain
Qwen-ImageOpen-source0.6680.825+0.157
Gemini-3.1 Flash-Image (default)Closed-source0.7750.879+0.104
GPT-Image-1.5Closed-source0.7500.895+0.145

GenClaw improves all three generators. With GenClaw, the open-source Qwen-Image (0.825) surpasses every closed-source model under direct generation in Table 1, including GPT-Image-1.5 (0.750), Nano-Banana Pro (Raisinghani, 2025; 0.761), and Gemini-3.1 Flash-Image (0.775). With GPT-Image-1.5 as the renderer, GenClaw reaches 0.895, the best result we have obtained, which shows that GenClaw continues to benefit from stronger generators.

We hope our responses address the reviewer's concerns, and we would be grateful if the reviewer could take them into account in the final assessment. We are happy to discuss any further questions.

Overall, the response addresses my concerns. I am satisfied with the clarifications and will consider updating score.

Thank you for the follow-up. We are glad that our clarifications address your concerns, and we appreciate your careful reading and constructive suggestions throughout the discussion.

Reviewer_gm6zOpenReview ↗
Rating
3
Confidence
4
Informativeness
2
Presentation
2
Soundness
3
Read review
Paper summary

The authors design GenClaw, a training free agentic framework for image generation and editing. GenClaw use executable code like SVG, HTML/CSS, Three.js, and Python as an intermediate "sketch" between LLM reasoning and pixel generation.

Specifically, GenClaw has three stages. The first one is Cognitive Structuring, where the agent (Claude-Opus-4.6) parses the users' intent, and conducts web/image search and explicit reasoning, and writes JSONL-style structured records. Then on the Executable Canvas, the records are compiled into code and rendered to sketches, here the object counts, positions, text layout, layer order or simple physical geometry are fixed by the sketch. Finally, the sketches are used as condition to "render" the final results, and a VLM reviewer then checks the output results.

GenClaw achieves significant improvement on GenEval++, LongText-Bench, ImgEdit, and Mind-Bench.

Critical strengths
  1. Using code as an explicit and editable intermediate fits well with what current code agents are good at. The paper is easy to follow and well-motivated .

  2. The framework is training-free and modular. With the agent policy unchanged, the backbone model can be swiftly changed.

  3. I believe the the intermediate records can make users easy to track the failures.

Critical weaknesses

I think the ablation is not enough, the authors should provide performance by gradually removing the intermediate modules.

Although the intermediate sketch is useful in controlling the object counts and attributes etc, however, the result might be not as good as the normal generated results, for example, in Figure 8, take the donut results as example, the naive generation method shows good donut details but GenClaw shows only the "colored circles".

Similar to the previous one, the image quality and naturalness should be measured.'

The figure is filled with small texts, a better design could be adopted, but this is minor issue.

Questions for authors
  1. I am confused on why the VLM-Score degrades for editing.

  2. I would like to know what are the average number of tool calls, and the LLM tokens used for each image, as well as the wall-clock time.

  3. Could you try different VLMs as the Review module? There might be risks that using the same family of models will let the optimization toward the judge.

3 comments

We sincerely thank the reviewer for the positive assessment and the detailed, constructive suggestions. We are glad that the reviewer found the code-based intermediate well matched to code agents and the framework training-free, modular, and traceable. We address each point below.

W1: Ablation of the agent's tools

Thank you for this valuable suggestion. Our supplementary material already reports the outermost comparison: with the same generator, the full agent improves over direct generation from 0.775 to 0.879 on GenEval++ (Ye et al., 2025b), and from 0.981 / 0.949 to 0.989 / 0.988 on LongText-Bench (Geng et al., 2025) (EN / ZH) (Appendix B.3, Tables 5 and 6). Following the reviewer's suggestion, we decompose this gain by removing the agent's tools on GenEval++, keeping the generator fixed to Gemini-3.1 Flash-Image. Our key ablation targets the code-rendering tools, which are the core of GenClaw.

SettingOverallΔ vs. FullCountPos/Count
Full GenClaw (all tools)0.879–0.9500.925
w/o review tool (single generation)0.850−0.0290.9250.875
w/o code-rendering tools (SVG / HTML)0.805−0.0740.8750.725
Direct generation (no agent)0.775−0.1040.8500.675

Removing the code-rendering tools causes the largest drop: the overall score falls by 0.074, with drops of 0.075 on Count and 0.200 on Pos/Count, whereas removing the review tool lowers the overall score by only 0.029. We do not ablate the search tool on GenEval++, because its compositional prompts rarely require external knowledge; search mainly serves knowledge-intensive tasks such as Mind-Bench (He et al., 2026). We will add this ablation to the supplementary material.

W2 & W3: Image quality and naturalness

We appreciate this careful observation, and we agree that the donuts in Figure 8 look flatter than those from direct generation. As discussed in more detail in our response to Reviewer EwSK (W1), this reflects a trade-off between structural control and natural appearance. The code agent leads the composition, which makes counts exact but also carries over the agent's visual aesthetics, which are weaker than those of image generation models. The same figure shows the other side of the trade-off: the three direct generators produce 10, 15, and 12 donuts instead of thirteen.

Following the reviewer's suggestion, we measure image quality with two human-preference metrics, HPSv2.1 (Wu et al., 2023) and HPSv3 (Ma et al., 2025), averaged over the images generated for multiple benchmarks:

SettingHPSv2.1HPSv3
Direct generation (same generator)31.4812.95
GenClaw30.7912.78

GenClaw scores slightly lower than direct generation, which is consistent with the trade-off above, but the gaps are small (0.69 and 0.17). Aesthetic scores do not fully capture image quality, but they indicate that GenClaw's outputs retain a reasonable level of naturalness and aesthetics while satisfying the constraints far more often. In the supplementary material, we will report these scores, make the trade-off and the intended scope of GenClaw explicit, and discuss a direction for reducing the trade-off: the generator first produces a natural candidate, and the agent then extracts and corrects its structure in code before re-rendering.

W4: Small text in figures

Thank you for pointing this out. We will enlarge the text in Figures 2 and 8 in the revised version.

Q1: Why does the VLM-Score decrease for editing?

Thank you for this question. The decrease reflects a trade-off between preserving the unedited content and integrating the edit into the whole image.

GenClaw edits layer by layer: it changes only the target layer or mask and composites the result back. This keeps the rest of the image nearly untouched, which is why PSNR and SSIM on unedited regions rise from 20.19 to 27.87 and from 0.583 to 0.718 compared with using the same editing model directly. The same mechanism, however, limits how freely the edited region blends with its surroundings. For edits such as background replacement or object insertion, faint seams or slight lighting mismatches can appear at layer boundaries, and errors in segmentation (SAM 3; Carion et al., 2025) or occlusion completion carry over into the composite. The VLM-Score evaluates the whole image and penalizes these artifacts. Direct editing, in contrast, re-renders the entire image and blends more smoothly, at the cost of changing unedited regions.

Layered editing is therefore best suited to content that is naturally composed of layers, such as infographics, posters, and UI or design layouts, where moving elements, replacing text, and leaving everything else unchanged are the main requirements. For edits that require global harmonization, natural extensions are to route them directly to the editing model or to add a harmonization pass after compositing. Our ImgEdit (Ye et al., 2025e) evaluation follows the mask-annotated protocol of CoCoEdit (Wu et al., 2026), which covers seven local-edit categories and uses Qwen2.5-VL-72B as the judge. We will clarify this protocol and discuss the trade-off in the supplementary material.

Q2: Tool calls, tokens, and wall-clock time

Thank you for the question; Reviewer EwSK raised a closely related point (Q2). Averaged over 100 GenEval++ prompts, with Gemini-3.1 Flash-Image as the generator, GenClaw makes 6 tool calls and 1.3 generation calls per image (at most three), uses about 15k input and 3k output tokens, and takes 140 s in median wall-clock time. The total API cost is about $0.10 per image, compared with about $0.04 for direct generation and about $0.065 for Mind-Brush under the same generator. The full comparison is in our response to Reviewer EwSK (Q2).

Q3: Using different VLMs as the review module

Thank you for raising this important concern. By default, GenClaw's review module uses GPT-5 (OpenAI, 2025), while the benchmark judges are GPT-4.1 for GenEval++, Qwen2.5-VL-72B for ImgEdit, and Gemini-3.0-Pro for Mind-Bench. Since the default reviewer and the GenEval++ judge both come from the GPT family, this is exactly the setting the reviewer is concerned about, so we test it directly. Following the reviewer's suggestion, we replace only the review model and keep everything else fixed, using Gemini-3.1 Flash and the open-source Qwen3.6-27B (Qwen Team, 2026), both from families different from the GenEval++ judge:

Review modelGenEval++ (judged by GPT-4.1)
GPT-5 (default)0.879
Gemini-3.1 Flash0.885
Qwen3.6-27B (open-source)0.870

With reviewers outside the judge's model family, the score stays at the same level: it is slightly higher with Gemini-3.1 Flash (0.885) and slightly lower with the much smaller open-source Qwen3.6-27B (0.870). The gains therefore do not come from aligning the review with the judge's preferences; most of the improvement comes from the code-rendering tools rather than from the review (see W1). We will specify the review model and add this comparison to the supplementary material.

We thank the reviewer again for the constructive feedback, which has helped us improve the paper. We are happy to discuss any further questions.

Thanks the authors for solving my questions, I will keep the score as weak acceptance.

Reviewer_EwSKOpenReview ↗
Rating
3(+1)
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper presents GenClaw, an agentic image generation system that uses executable visual code as an intermediate representation. The system combines reasoning and retrieval with tools such as SVG, HTML, Canvas, and Three.js to construct visual layouts, then invokes image generation or editing models as appropriate to refine their appearance. A review mechanism checks the resulting outputs. Its main contribution is an integrated workflow that translates constraints on layout, object counts, text, and localized edits into inspectable and editable representations.

Critical strengths

1.The layered editing design is thoughtful and useful.

Explicit layouts, layers, and masks make edits more targeted and help preserve content outside the requested modification. The ImgEdit preservation results support this benefit.

2.The same-generator comparison shows a meaningful improvement.

GenClaw improves the GenEval++ score from 0.775 to 0.879 over direct generation with Gemini 3.1 Flash Image, providing evidence that the integrated workflow adds value.

Critical weaknesses

1.Some outputs look rigid and lack natural visual detail.

Several examples in the paper look rigid and overly regular. For instance, the balloon arrangement in Figure 2 appears mechanical, while the donuts in Figure 4 look relatively flat and uniform, with limited material detail and a weak sense of volume. These results raise a concern that strong dependence on the initial code-based composition may constrain the naturalness and visual richness of the final images. The compositional scores demonstrate the benefits of structural control, but do not sufficiently establish overall image quality.

2.The number of attempts and the practical overhead are unclear.

The paper does not clearly report how many candidates are generated, how many editing or repair iterations are performed, or how the final output is selected. It is also unclear whether representative baseline results use single samples, best-of-four, or larger candidate pools.

The additional cost, end-to-end latency, and memory requirements are insufficiently quantified. These measurements would help readers judge whether the performance gains justify the extra resources. Identical budgets are not necessary, but the actual conditions should be transparent.

Questions for authors

1.How many generation and editing attempts are allowed per image? What are the stopping and final-selection rules? Do representative baseline comparisons use single samples, best-of-four, or another sampling protocol?

2.Could you provide an effectiveness–cost comparison with representative open-source baselines and direct generation, including end-to-end latency, generation/editing calls, applicable GPU or API costs, and memory usage where measurable?

3.Given the rigid appearance across several examples, could you jointly evaluate constraint satisfaction, naturalness, material detail, and overall visual quality on a representative subset, to assess whether improved compositional accuracy comes at the expense of visual quality?

5 comments

We sincerely thank the reviewer for the careful reading and the constructive suggestions, and for recognizing the layered editing design and the improvement over direct generation with the same generator. We address each point below.

W1 & Q3: Naturalness of the outputs

We thank the reviewer for this insightful observation, and we agree with it. It points to a trade-off between structural control and natural appearance that is central to our design.

In GenClaw, the code agent leads the composition: it places every object explicitly, so that counts, positions, and relations are exact. LLMs are strong at this kind of logical construction, but their visual aesthetics are weaker than those of image generation models, which learn composition from large collections of natural images. Code-led layouts therefore tend to be regular, such as evenly spaced balloons or donuts arranged in a grid, and the generator follows them faithfully. Direct generation shows the opposite behavior: its compositions look natural, but the constraints are often violated. In Figure 8, for example, the three direct generators produce 10, 15, and 12 donuts for a prompt that asks for thirteen.

We agree that the compositional scores alone do not establish overall image quality, and we do not claim that GenClaw makes images more natural. Human-preference scores are consistent with this: averaged over images generated for multiple benchmarks, GenClaw obtains 30.79 HPSv2.1 and 12.78 HPSv3, slightly below the 31.48 and 12.95 of direct generation with the same generator (see our response to Reviewer gm6z (W2 & W3)). Our claim is narrower. GenClaw targets requests in which hard constraints matter, such as exact counts, text layout, and physical relations, and for these requests satisfying the constraints is a prerequisite for a usable image.

The reviewer's observation also suggests how this trade-off can be reduced. Instead of composing the scene from scratch, the agent can let the image model first produce a natural candidate, extract its layout and content into an SVG sketch, correct only the elements that violate the request, and then render the corrected sketch. The composition would then keep the generator's aesthetics, while the code still guarantees the constraints. In the limitations section of the supplementary material, we will state the intended scope and this trade-off explicitly and discuss this direction as future work. We thank the reviewer for the inspiration.

W2 & Q1: Number of attempts, stopping rule, and selection

Thank you for raising this point. We agree that these conditions should be reported explicitly, and we will state them in the supplementary material.

  • Attempts. GenClaw outputs one final image per prompt. Each sample allows at most three generation calls: an initial generation and up to two repairs guided by the review.
  • Stopping and selection. The loop stops as soon as the review returns PASS. The final output is always the last generated image. There is no best-of-N selection, and the benchmark judge is never used during generation.
  • Statistics. On GenEval++ (Ye et al., 2025b), 76% of prompts pass at the first generation, and the average number of generation calls per prompt is 1.6.
  • Baselines. Published baseline scores follow each benchmark's default protocol, which on GenEval++ is one image per prompt for all 280 prompts, judged by GPT-4.1. The baselines we reproduced also use a single sample with their default settings.

The gain is also not explained by the extra generation calls. In our new tool ablation (see our response to Reviewer gm6z (W1)), the same agent without the code-rendering tools, which keeps the same review loop and the same three-call budget, reaches 0.805, compared with 0.879 for GenClaw.

Q2: Effectiveness–cost comparison

Thank you for this suggestion. For a fair comparison, direct generation, Mind-Brush (He et al., 2026), and GenClaw all use the same image generator, Gemini-3.1 Flash-Image (Raisinghani, 2026), and all models are accessed through APIs. Values are averaged per image over 100 GenEval++ prompts, and costs follow public API prices.

MethodGenEval++Tool callsGen. callsLatency (median)Cost per image
Direct generation0.7750125 s~$0.04
Mind-Brush0.82531.13100 s~$0.065
GenClaw0.87961.31140 s~$0.10

As acknowledged in our limitations, GenClaw costs more than direct generation, about $0.06 more per image. In exchange, it raises GenEval++ from 0.775 to 0.879 with the same generator. We believe this trade-off is worthwhile for requests that are constraint-heavy, text-heavy, or knowledge-intensive, and we will add this comparison to the supplementary material.

We hope these responses address the reviewer's concerns. We are happy to discuss any remaining questions.

Reviewer_EwSKOpenReview ↗

Clarification on the Average Number of Generation Calls

The rebuttal provides additional results that address my main concerns. However, one statistic seems inconsistent: if 76% of prompts pass on the first attempt and each prompt allows at most three generation calls, the average should be at most 0.76 × 1 + 0.24 × 3 = 1.48. Could you clarify how the reported average of 1.6 was calculated?

Thank you for checking this so carefully; the reviewer is correct. In re-examining our statistics, we found that our counting function was incomplete. The reported 1.6 counted every API request sent to the image model, including requests that were automatically resent after failures such as network errors. These resends are handled at the API level and are not treated by the agent as generation calls, so they should not have been included. After excluding them, we recomputed the statistics over all 280 GenEval++ prompts: 213 prompts (76.1%) pass at the first generation, 48 (17.1%) pass after one repair, and 19 (6.8%) use all three generation calls. This gives an average of (213 × 1 + 48 × 2 + 19 × 3) / 280 = 1.31 generation calls per prompt. We will report this breakdown in the supplementary material and correct the corresponding entry in the cost table.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.