GeoTikzBridge: Advancing Multimodal Code Generation for Geometric Perception and Reasoning

Jiayin Sun, Caixia Sun, Boyu Yang, Hailin Li, Xiao Chen, Yi Zhang, Errui Ding, Liang Li, Chao Deng, Junlan Feng

TL;DR

GeoTikzBridge is a novel framework that bridges the gap between visual geometric perception and symbolic reasoning by translating geometric diagrams into structured TikZ code. By introducing a massive 2.5-million-pair image-to-TikZ dataset and an instruction-guided auxiliary line generation model, it significantly boosts the mathematical problem-solving capabilities of both Large Language Models (LLMs) and Multimodal LLMs (MLLMs) as a plug-and-play module.

What Problem Does This Paper Address?

While Multimodal Large Language Models (MLLMs) excel at general visual understanding, they notoriously struggle with fine-grained geometric perception. They frequently misinterpret subtle visual details like exact segment relationships, angle magnitudes, and shape constraints. This failure stems from two main issues: standard visual encoders compress images in a way that loses precise spatial details, and there is a severe scarcity of large-scale, high-quality geometric image-to-code datasets.

Furthermore, solving complex geometry problems often requires a creative leap: drawing auxiliary lines. Existing models struggle to determine where and how to add these lines using text alone, limiting their reasoning performance in STEM and mathematical domains.

GeoTikzBridge enhances geometric perception and mathematical reasoning compared to text-only or standard visual approaches.

Methods

The authors present GeoTikzBridge, a framework consisting of three core components:

  1. Iterative Self-Refinement: To overcome data scarcity, the framework starts with a high-quality seed dataset and uses an initial model to predict TikZ code for a large pool of unannotated geometric images. It renders the predicted code back into an image, computes a CLIP score between the original and rendered images, and filters out unreliable samples to iteratively expand the training set and retrain the model.
  2. Localized Geometric Transformation Strategy: To prevent the model from simply memorizing text sequences, the authors introduce "code noise." During dataset expansion, they randomly remove 1% to 40% of the TikZ code lines. The model is then forced to reconstruct the missing pieces from the rendered, modified image, drastically improving its sensitivity to local geometric details.
  3. Instruction-Guided Auxiliary Line Generation: Leveraging the code transformation strategy, the authors use a powerful teacher model (Qwen2.5-VL-72B) to annotate what geometric elements were modified or added. This creates an instruction-following dataset used to train GeoTikzBridge-Instruct, a model capable of editing TikZ code to add precise auxiliary lines based on natural language prompts (e.g., "Draw a perpendicular line to CD through point E").
Figure 2. Framework of the proposed iterative self-refinement for GeoTikz-Base dataset and GeoTikzBridge-Base model. It iteratively conducts three steps: dataset construction and sample generation, localized geometric transformation, and model optimization.

Datasets

The paper introduces two major datasets:

  • GeoTikz-Base: The largest image-to-TikZ dataset to date, containing 2.5 million pairs (16× larger than existing open-source alternatives), compiled by expanding unannotated diagrams from nine public math datasets.
  • GeoTikz-Instruct: The first instruction-augmented TikZ dataset for visual reasoning, containing 419k training samples specifically tailored for auxiliary line generation.

The models were evaluated across five open-source benchmarks: DaTikZ, MathVista-GPS, GAOKAO-MM-Math, RBench-M, and RBench-V, alongside two in-house benchmarks (EDUBenchmark and GeoTikz-Instruct).

Figure 3. Distribution of the 2.5M GeoTikz-Base dataset.

Key Insights and Ideas

  • Why TikZ over SVG? Unlike standard vector formats like SVG that only describe the final visual appearance, TikZ (a LaTeX-based graphic language) inherently documents the logical construction steps and functional dependencies of geometric elements. This makes it uniquely suited for symbolic reasoning.
  • Code Noise as a Regularizer: Intentionally breaking the TikZ code and forcing the model to learn from the resulting partial images reduced code repetition prediction by 15%, proving to be an effective strategy for structural generalization.
  • Code as a Universal Translator: Providing text-only LLMs with generated TikZ code allows them to outperform MLLMs on geometric tasks. This bypasses the visual compression bottleneck entirely, turning a vision problem into a pure code-reasoning problem.

Key Results

  • State-of-the-Art Image-to-TikZ Conversion: GeoTikzBridge-Base-38B achieved SOTA performance across all image-to-TikZ benchmarks, significantly outperforming existing models like FigCodifier in both CLIP score and Compilation Success Rate (CSR).
  • Downstream Reasoning Boost: When used as a plug-and-play module, the generated TikZ code consistently boosted downstream MLLM performance. For instance, it raised GLM4.5-V's accuracy on MathVista-GPS from 0.745 to 0.764.
  • Superior Auxiliary Line Generation: GeoTikzBridge-Instruct outperformed GPT-4o/5.0 variants in generating precise, instruction-compliant auxiliary lines while preserving the original figure's characteristics.
Figure 7. Visualization results of instruction-driven auxiliary line generation compared with GPT-5.0[30], each figure shows the input geometric image, the natural language instruction for auxiliary line addition, and the rendered image from the generated tikz code.

Limitations and Future Work

While highly effective for geometry, the current framework is primarily limited to mathematical diagrams. The authors note that future work will focus on expanding this approach to more complex technical schematics, such as engineering circuit diagrams and advanced educational illustrations. Additionally, they plan to explore integrating GeoTikzBridge into multi-modal agent frameworks using Agentic Reinforcement Learning (RL) to further automate and refine multi-step geometric problem-solving.

Summary updated

BibTeX
@inproceedings{sun2026geotikzbridge,
  author = {Jiayin Sun and Caixia Sun and Boyu Yang and Hailin Li and Xiao Chen and Yi Zhang and Errui Ding and Liang Li and Chao Deng and Junlan Feng},
  title = {{GeoTikzBridge: Advancing Multimodal Code Generation for Geometric Perception and Reasoning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=FHgQhjZzaK},
}
Figure