inferwire
/
AI·5 min read

The SVG Challenge: How AI Draws the Mona Lisa with Code

New benchmarks reveal that leading AI models can now 'draw' complex portraits using raw SVG code, demonstrating a significant leap in spatial reasoning.

TL;DR

  • Leading AI models are now capable of recreating complex art like the Mona Lisa using raw SVG code rather than traditional pixel-based generation.
  • This shift from pixels to code proves that models are developing advanced spatial reasoning, allowing them to coordinate thousands of geometric coordinates simultaneously.

Background

Most people know generative AI through tools like Midjourney or DALL-E. These models work via diffusion, a process that predicts the color of individual pixels to create an image. While the results are visually stunning, the model does not actually "know" where a hand or an eye is in a mathematical sense; it simply knows what the patterns of those pixels usually look like. A more rigorous test of AI intelligence is Scalable Vector Graphics (SVG). An SVG is a text file filled with code. It tells a computer to draw specific shapes at specific coordinates. To "draw" in SVG, an AI must maintain a perfect mental map of a 2D grid, ensuring that every line and curve connects precisely to form a recognizable image.

What happened

In a recent series of benchmarks, researchers challenged the world's most advanced large language models (LLMs)—including GPT-5.6, Claude 4, Gemini 2, and Grok 3—to recreate the Mona Lisa using only SVG code [^1]. The prompt required the models to mimic a "colored pencil" style, which is notoriously difficult in code because it requires thousands of overlapping, semi-transparent strokes to create depth and shading. This is a departure from standard image generation and falls into the emerging field of "Visual Programming," where models use logical code to solve visual tasks [^2].

Claude 4 emerged as the most "artistic" performer. It did not just draw a face; it generated a massive block of code that defined thousands of individual paths, each slightly offset to create the illusion of hand-drawn texture. The model demonstrated an uncanny ability to layer colors, using the SVG opacity attribute to blend skin tones and create the famous sfumato effect of Leonardo da Vinci. GPT-5.6, while technically precise, took a more algorithmic approach. It wrote custom SVG filters to handle the shading, resulting in a cleaner, more "digital" look. While GPT's output was more efficient in terms of file size, it lacked the chaotic, human-like imperfections that Claude successfully simulated.

On the other end of the spectrum, Gemini and Grok struggled with the spatial constraints. While they correctly identified the components of the portrait—eyes, nose, mouth, and the background landscape—they failed to align them correctly on the coordinate plane. In some iterations, the eyes were placed outside the boundaries of the face, or the proportions of the torso were wildly skewed. This suggests that while these models understand the concept of the Mona Lisa, they lack the internal "spatial engine" required to translate that concept into a precise geometric map. The experiment highlighted a clear divide between models that simply predict text and models that can reason about physical space.

Why it matters

This development is about much more than digital art. The ability to generate complex, functional SVG code is a proxy for high-level spatial reasoning. If an AI can accurately place ten thousand lines to form a human face, it can likely perform other tasks that require geometric precision, such as designing circuit boards, drafting architectural floor plans, or creating user interfaces. Unlike pixel-based images, SVG code is editable, searchable, and infinitely scalable. It represents a transition from AI as a "black box" creator to AI as a collaborative engineer.

Furthermore, this benchmark provides a way to measure AI "hallucinations" in a controlled environment. When a model generates a pixel-based image, it is easy to hide errors in the noise of the diffusion process. In SVG, there is nowhere to hide. If the code is wrong, the image breaks. A line that is off by five pixels is immediately visible. By forcing models to work in a structured, mathematical medium, researchers can more accurately gauge how much the AI actually understands about the world's physical structure. This is essential for the future of robotics and autonomous systems, where a mistake in spatial reasoning can have real-world consequences.

Finally, the success of models like Claude and GPT-5.6 in this arena suggests that our training methods are working. We are moving toward "multimodal reasoning," where the model does not just see or write, but connects the two. The model is using its linguistic training to understand the request, its mathematical training to calculate coordinates, and its visual training to judge the final composition. This convergence is the hallmark of the next generation of artificial intelligence, moving us closer to systems that can interact with the physical world with the same nuance as a human designer.

Practical example

Imagine you are a web developer named Marcus. You need a custom icon of a complex mechanical gear for a client's website. Usually, you would have to find a stock image, or spend an hour in Adobe Illustrator drawing it yourself. Instead, you open a chat with a high-reasoning AI. You don't ask for a picture; you ask for the code.

You type: "Write the SVG code for a 12-toothed gear with a brushed metal texture and a 3D perspective." On Tuesday morning, the AI doesn't just give you a static file. It writes a series of <path> elements and <linearGradient> tags. Because it is code, Marcus can immediately change the number of teeth from 12 to 16 by editing a single number. He can change the color to match the client's brand in seconds. The AI has acted as a junior designer, providing a perfectly precise, editable foundation that Marcus can drop directly into his website's source code.

Related gear

We recommend this book because mastering the syntax of SVG allows you to audit and refine the geometric code generated by advanced AI models.

AdvertisementAmazon

SVG Essentials: Producing Scalable Vector Graphics with XML

★★★★★ 4.6

Sources

  1. [1]hackernews — "Drawing" the Mona Lisa with GPT-5.6, Claude, Gemini, and Grok
  2. [2]arXiv — Visual Programming: Compositional Visual Reasoning without Training