TL;DR
This paper investigates how well Large Language Models (LLMs) can refine code that generates visual outputs, like TikZ diagrams, when the "verifier" (the tool checking the code's correctness) isn't perfect. They found that even imperfect verifiers can be surprisingly effective, especially when providing actionable feedback, and that iterative refinement can significantly improve code generation, particularly for less capable LLMs.
What Problem Does This Paper Address?
Large Language Models (LLMs) are getting great at generating code, but they still struggle with tasks that involve visual outputs, such as creating diagrams with TikZ or styling web pages. Customizing existing visual code is particularly tricky: it requires the LLM to precisely locate the relevant code, make specific changes based on a visual instruction, and ensure the rest of the diagram remains intact. Unlike code that can be checked with strict tests, visual correctness is hard to formalize. This means that when LLMs try to refine visual code, they often rely on "imperfect verifiers" – tools that can make mistakes (false positives/negatives) or give unclear feedback. The core question this paper tackles is: Can iterative refinement (where an LLM tries, gets feedback, and tries again) still work effectively when the feedback source itself is unreliable?
Methods
The researchers framed visual code customization as an iterative editing problem with an "imperfect oracle" (the verifier). They developed a framework to analyze these iterative refinement processes. Their core methodology involved:
- Case Study: TikZ: They chose TikZ, a LaTeX package for creating graphics, because it isolates key challenges: weakly structured code, high sensitivity to small edits, and abstract geometric concepts that are hard for current models to interpret.
- Iterative Refinement Loop: They set up a system where a "Generator" LLM proposes code modifications based on an instruction, and a "Verifier" LLM (or tool) evaluates the result, providing a score and textual feedback. This loop repeats until a stopping criterion is met.
- Verifier Evaluation: They tested various LLM-based and tool-augmented verifiers, categorizing them into "simple LLM-based verifiers" (using text, visual, or both inputs) and "complex verifiers" (like property-based or agentic vision verifiers that use more elaborate code-based approaches).
- Manual Annotation: To assess the verifiers' accuracy and the quality of their feedback, they conducted extensive manual annotation of the refinement trajectories, comparing human judgments to verifier scores.
Datasets
The study used a refined version of the VTikZ dataset. This dataset consists of TikZ code examples, corresponding visual diagrams, and natural language instructions for modifying them. The researchers manually corrected typographical errors, resolved ambiguities, and improved the clarity of the existing instructions to create a more robust benchmark for their experiments.
Key Insights and Ideas
- Imperfect Verifiers Can Still Work: Even when verifiers aren't perfect, they can still achieve moderate accuracy (F1-scores up to 0.815) in determining if a visual instruction was applied to code. This suggests that the "imperfect oracle" problem isn't a complete showstopper for iterative refinement.
- Feedback is Crucial, Especially for Weaker Models: Informative feedback significantly boosts the performance of less capable LLM generators. For example, one model saw an increase of 11-20 perfect customizations with feedback.
- Stronger Models Need Precision More Than Exploration: For more capable LLMs, accurate scoring and early stopping become more important than extensive feedback. They benefit more from verifiers that reliably prevent premature acceptance of incorrect solutions.
- Feedback Quality Matters Immensely: Feedback is only effective if it's precise, actionable, grounded in the original instruction, and addresses all relevant issues. Vague or incorrect feedback can lead to stagnation or even degrade the solution.
- Simple Verifiers Often Suffice: Surprisingly, simpler multimodal LLM-based verifiers (using text and visual inputs) often performed as well as or better than more complex, tool-augmented approaches for TikZ customization.
Key Results
- Verifier Accuracy: The best verifiers achieved F1-scores up to 0.815 in identifying whether visual instructions were correctly applied.
- Performance Gains with Feedback: For the Qwen3-vl-30b-a3b-Instruct generator, feedback led to an increase of 11-20 perfect customizations. For Gemini-3, the gains were smaller (+5) but more focused on preventing premature acceptance.
- Correlation with Human Judgments: Kendall correlation coefficients between verifier scores and human judgments were moderate, especially with stronger generators. However, with weaker generators, combining textual and visual inputs (Text+Visual) showed the strongest alignment with human judgments (up to 0.765).
- False Positives are Common: Many verifiers showed a bias towards high recall, meaning they tended to accept solutions, leading to a significant rate of false positives that could prematurely end the refinement process.
- Complex Verifiers Didn't Always Improve: More elaborate verification strategies (e.g., AgenticVision, Segmentation-Tool-based) did not consistently outperform simpler LLM-based verifiers and sometimes even degraded performance.
Limitations and Future Work
- Case Study Limitation: The study is focused on TikZ, which might limit the generalizability of findings to other visual languages or more complex domains like web development.
- Model Selection: Only two LLMs (Qwen and Gemini) were evaluated, which might not represent the full spectrum of LLM capabilities.
- Limited Iterations: The evaluation was capped at five refinement steps, which might not fully capture longer-term iterative refinement dynamics.
- Future Work: The authors suggest using the collected annotated trajectories to train a learned scorer for TikZ customization, replicating the study on other visual languages (SVG, P5.js), and extending the research to more complex interactive environments beyond static images.
Summary updated