Abstract
Large Multimodal Models (LMMs) have demonstrated proficiency in natural language processing and basic visual tasks, yet their ability to bridge the gap between visual perception and algorithmic reasoning remains under-explored. This paper introduces TurtleBench, a novel benchmark designed to evaluate LMMs on visual programming tasks using Turtle Geometry. By requiring models to translate geometric patterns into executable Python code, TurtleBench reveals significant limitations in current state-of-the-art models, which often rely on syntactic memorization rather than genuine spatial-algorithmic mapping.
Introduction
The intersection of computer vision and code generation presents a unique challenge: visual programming. While LMMs can describe images and write code independently, they struggle to "see" a geometric pattern and derive the underlying algorithmic logic—such as loops, rotations, and coordinate shifts—necessary to recreate it. The authors identify a "reasoning gap" where models fail to map visual-spatial relationships to procedural logic. TurtleBench addresses this by moving beyond simple classification or Visual Question Answering (VQA) toward abstract geometric reconstruction.
Benchmark Design and Methodology
TurtleBench utilizes Turtle Geometry, a classic educational framework where a programmable cursor draws shapes through relative movement commands. This environment isolates logical reasoning from the complexities of modern graphics libraries, making it an ideal sandbox for testing pure algorithmic translation.
The benchmark comprises 260 manually curated tasks divided into two primary categories:
- Scratch Tasks: The model is provided with an image, a text description, or a multimodal blend, and must generate the code to create that shape from scratch.
- Tweak Tasks: The model is given a base shape and an instruction (visual or textual) to modify it—for example, "connect the midpoints of each side." This specifically tests code editing capabilities based on visual changes.
Evaluation Pipeline
To ensure objective grading, the authors developed an automated pipeline. The model's generated code is executed in a sandbox, the resulting image is captured, and then compared to the ground truth using bitwise similarity via OpenCV. A "pass" requires a 95% similarity score, ensuring that the model has accurately captured the geometric intent.
Key Insights: Vision as a Bottleneck
A primary finding of the study is that vision acts as a significant bottleneck for current LMMs. Surprisingly, models performed better when provided with textual descriptions of shapes than with the actual images. For humans, seeing a square is more intuitive than reading its coordinates; for LMMs, the inverse is true. This suggests that visual encoders are not yet "reasoning" in a spatial sense.
The "Rabbit" Test for Memorization
To determine if models were merely reciting code from training data, the researchers introduced the "Rabbit" test. They created a custom Python class called Rabbit that functioned identically to Turtle but used aliased command names (e.g., aa() instead of forward()). Performance plummeted when using the Rabbit class, proving that models rely heavily on syntactic memorization rather than a deep understanding of geometric logic.
Results and Discussion
Even top-tier models like GPT-4o struggle significantly on TurtleBench. The model achieved only 19.23% accuracy on the simplest image-to-code tasks. While nearly 99% of the generated scripts were syntactically correct and runnable, they failed to produce the correct visual output.
As shape complexity (measured by contour counts) increases, success rates drop sharply. Furthermore, few-shot prompting yielded negligible improvements (less than 2%), suggesting the issue is a fundamental architectural limitation in spatial-algorithmic mapping rather than a lack of context or prompting clarity.
Conclusion
TurtleBench highlights a critical frontier for LMM development. The results serve as a wake-up call, demonstrating that even state-of-the-art models lack the robust visual-spatial reasoning required for complex programming tasks. Future work should focus on improving visual encoders to better capture algorithmic structures and exploring fine-tuning strategies on specialized geometric datasets to bridge the gap between seeing and coding.
Summary updated