LLMs Painting Without Image Models: Simulating Physical Brushes with Code
This article explains an approach to AI image creation in which a large language model paints without calling any image generation model. Instead, the model writes code that simulates physical brush strokes on a virtual canvas. It covers the code-driven painting engine, physical brush simulation, error correction without undo, the development of independent art styles, and the cloud computing support this method may require.
Diffusion models dominate most mainstream AI image tools. They generate images by gradually denoising random noise. This approach is efficient, but it is often a black box. It offers limited explainability, little fine control over individual brush strokes, and weak support for layered editing. Recently, a different approach to AI image generation has drawn attention in the technical community. A frontier large language model calls no traditional image generation model. Instead, it writes program code that simulates the movement of a real brush on a virtual canvas, painting stroke by stroke. This code-driven procedural painting approach opens new technical possibilities for developers.
1. Core Mechanism: A Code-Driven Procedural Painting Engine
Unlike traditional image models, which output a finished picture in one pass, this approach breaks the painting process into many independent stroke instructions. The LLM acts less as a “pixel generator” and more as a combination of programmer and painter.
In this mode, the model first builds a painting engine in a virtual environment. It then plans the starting coordinates, movement paths, and physical parameters for each stroke. According to technical demonstrations reported by others, a complex, highly realistic artwork, such as a shopping cart in a parking lot, may require about 700,000 simulated strokes. These works do not rely on any external image model, and they do not use pre-rendered or traced base images. In effect, each painting is a complete program written by the LLM, typically 1,000 to 2,000 lines of code. The system runs this code and controls different types of brush engines to build the final image.
2. Fine Control of Physical Properties and Artistic Expression
To reach photo-level realism or a specific artistic effect, coordinates and colors alone are not enough. The model simulates the physical properties of brushes through code, including brush texture, paint wetness, and canvas texture.
During execution, the model must output each stroke as a detailed sequence of coordinate instructions. To look more like human painting, the model also adds deliberate “imperfect” physical disturbances to the code. For example, in a bird painting at sunrise, the first stroke used a specific deep blue, a brush width of 90 pixels, and five slightly wobbly path points. The model explained that this wobble of about 7 pixels was intentional, because human arms tremble from muscle movement and cannot draw perfectly straight lines.
The following pseudocode illustrates the logic of this physical simulation:
class PhysicalBrush:def __init__(self, color, width, wetness, canvas_texture):self.color = color # Color code, e.g. "#30346a"self.width = width # Brush widthself.wetness = wetness # Paint wetness, affects edge bleedingself.canvas = canvas_texture # Canvas texture, affects paint adhesiondef draw_stroke(self, path_points):# Simulate human arm tremorhuman_like_points = self.add_micro_jitter(path_points, jitter_px=7)for point in human_like_points:# Compute the actual paint effect based on wetness and canvas textureactual_color = self.calculate_bleeding(point, self.wetness)self.canvas.apply(point, actual_color, self.width)
3. Self-Feedback and Error Correction Without Undo
On a virtual canvas, the model faces one strict constraint: once a stroke lands, it cannot be undone, just as in the physical world. The model cannot rely on simple rollback to hide mistakes. It must cover or correct them with new strokes.
Throughout the multi-round painting process, the model can observe the canvas and check its own work. It reads the current rendering state and evaluates the visual result. When it finds flaws, such as a bird’s back that looks too thin or lines that appear messy, it does not clear the canvas and start over. Instead, it plans a new set of stroke instructions based on the visual feedback. It then fixes earlier errors at the physical level using techniques such as color layering, deepening shadows, and softening edges. This closed-loop cycle of perception, execution, and feedback greatly improves the fault tolerance of procedural painting and the refinement of the final result.
4. Building and Evolving an Independent Art Style
Generative models often copy the styles in their training data too closely, which can make works lack originality or raise copyright concerns. Code-based painting offers another path toward a more independent art style.
To avoid style homogenization, developers can ask the LLM to design an artist persona with a fictional background, then set stable creative preferences for that persona. Based on the first version of the output, developers use text feedback to guide the model in adjusting its internal brush parameters and painting engine logic. For example, they might increase the drying speed of a certain paint or change the stroke angle. Over time, the model can develop a unique and coherent visual style at the code level, rather than simply combining elements from existing art schools.
5. Technical Implications and Cloud Computing Support
This non-generative, code-based approach shows the potential of reasoning-focused LLMs for cross-modal creative output. It turns complex visual creation into structured code writing, which gives developers strong control over the generation process. The approach may be portable to industrial design, procedural scene generation, and creative coding.
However, generating thousands of lines of rigorous code with complex physics calculations, then correcting the rendered result over multiple rounds, places heavy demands on an LLM’s context understanding and logical consistency. In practice, developers often rely on elastic computing platforms and LLM inference services, such as those offered by Baidu AI Cloud, to keep long code generation stable and execution efficient. Cloud-native services such as object storage can also help manage the large volume of stroke data and intermediate state logs produced by procedural generation, supporting the iteration of this new AI painting engine.
In summary, having an LLM simulate real brushes with code challenges the assumption that diffusion models dominate AI image creation. By combining physical simulation, code generation, and self-correction, this approach opens a new technical path for AI creative computing that offers both explainability and high controllability.
