TL;DR
FractalBench is a new diagnostic benchmark that challenges multimodal AI models to infer the recursive mathematical rules of a fractal from an image and express them as executable Python code. The results reveal a massive "reasoning gap": while current models are excellent at writing syntactically valid code (76% success), they almost entirely fail to capture the underlying mathematical abstraction (only 4% success), particularly struggling with branching recursion.
What Problem Does This Paper Address?
While Multimodal Large Language Models (MLLMs) like GPT-4o and Claude 3.7 have shown impressive performance on standard vision and math tasks, researchers still debate whether these models truly "understand" abstract principles or are simply sophisticated pattern matchers.
The authors identify a specific gap in visual-mathematical abstraction: the ability to see a finite visual pattern and infer the infinite, recursive process that generated it. Fractals are the perfect test case for this because they are "compactly defined"—a complex, infinite shape can be described by just a few simple geometric rules (an Iterated Function System, or IFS). To succeed, a model must bridge the gap between raw pixels and symbolic, recursive logic.
Methods
The researchers developed a task called Recursive Program Synthesis. Given an image of a fractal, the model must write Python code to recreate it.
To ensure the models are actually reasoning rather than just recalling library functions, the authors introduced the MinimalTurtle interface. This is a restricted API with only four commands: move, turn, pen_up, and pen_down. By stripping away high-level libraries (like Matplotlib or specialized L-system packages), the models are forced to implement the recursive logic from first principles.
The study evaluated three prompting strategies:
- Direct Code Generation (DCG): Mapping the image directly to code.
- Reasoning Then Code (RTC): Forcing the model to explain the fractal's properties before coding.
- Recursive Structure Focus (RSF): Explicitly prompting the model to identify base cases and self-similarity.
Evaluation was performed using Intersection over Union (IoU), comparing the model's output pixels to the ground truth with a strict 95% similarity threshold for "correctness."
Datasets
The paper introduces FractalBench, a dataset of 610 unique test images across 12 canonical fractal types, including:
- Linear Recursion: Cantor Sets.
- Geometric Transformations: Koch Curves and Snowflakes.
- Multi-scale Self-similarity: Sierpiński Gaskets and Carpets.
- Space-filling Curves: Heighway and Lévy Dragons.
- Branching Recursion: Pythagoras Trees and Symmetric Binary Trees.
To prevent "data contamination" (the model simply memorizing famous fractals from its training data), the authors generated variants with different colors, recursion depths, and orientations.
Key Insights and Ideas
- The "Syntactic-Semantic" Disconnect: There is a striking divide between a model's ability to write code that runs and code that is correct. Models have mastered Python syntax but lack the "mathematical imagination" to translate a visual pattern into a recursive algorithm.
- Branching is the Hard Ceiling: Models are relatively capable of handling linear transformations (like the Koch curve, ~20% accuracy). However, they fail catastrophically at branching recursion (trees, <2% accuracy). Instead of true recursion, models often fall back on iterative loops or single-branch recursion, showing they cannot yet represent exponentially growing computation graphs.
- The Reasoning Tax: Surprisingly, "Reasoning-Then-Code" (Chain of Thought) actually decreased performance compared to direct generation. The authors hypothesize that verbalizing geometric steps creates a "semantic gap"—the model gets lost in high-level descriptions ("it branches at each level") that it cannot accurately translate into precise numerical coordinates and angles.
Key Results
- Overall Accuracy: Across all models and prompts, the end-to-end success rate was a meager 4.2%.
- Model Rankings: Gemini 2.5 Flash was the top performer with 14.8% accuracy, significantly outperforming Claude 3.7 Sonnet (5.2%) and GPT-4o (3.5%) in this specific domain.
- Execution vs. Correctness: While 76.1% of the generated code executed without errors, only 5.5% of those runnable samples were visually correct.
- Complexity Thresholds: Analysis showed that as recursion depth increases, models often "give up" on algorithmic representation and revert to verbose, literal descriptions of pixels, leading to a sharp spike in code length.
Limitations and Future Work
The authors acknowledge that their binary IoU threshold (95%) is quite punishing; a model that gets the logic 90% right but misses a single rotation angle is marked as a total failure. Future versions might include "structure-aware" metrics that reward models for getting the correct number of branches even if the angles are slightly off.
Additionally, the study did not include the latest "reasoning-specialized" models like OpenAI o1 or DeepSeek-R1. Testing whether these "thinking" models can overcome the branching recursion bottleneck is a clear next step for the research community. Finally, the authors suggest that FractalBench could be used as a training signal to help future MLLMs develop genuine recursive abstraction capabilities.
Summary updated