Introduction
Scientific communication relies heavily on precise, scalable, and legible visual aids. While modern text-to-image models like DALL-E 3 produce impressive photorealistic imagery, they often fail the rigorous requirements of scientific figures, such as geometric accuracy and infinite scalability. These models typically output raster graphics (pixels), which lose clarity when resized and struggle with textual legibility. AutomaTikZ addresses this by leveraging TikZ, a LaTeX-based graphics language, to synthesize high-quality vector graphics from natural language descriptions.
The TikZ Advantage
Generating vector graphics directly as raw SVG paths is computationally difficult for Large Language Models (LLMs) due to a lack of semantic structure. In contrast, TikZ uses human-readable commands (e.g., \draw, \node) that provide a semantic scaffolding. By treating figure generation as a code synthesis task, LLMs can better understand the hierarchical relationships and geometric constraints required for scientific diagrams.
Methodology: CLiMA and Iterative Resampling
The authors developed two primary models based on the LLaMA architecture. The first is a standard LLaMA model fine-tuned on TikZ code. The second, CLiMA (CLIP inside LLaMA), integrates multimodal CLIP embeddings to provide the model with "visual intuition." By prepending these features to the input, the model generates code that aligns more closely with human visual expectations.
To ensure the generated code is functional, the framework employs an iterative resampling strategy. If a TikZ snippet fails to compile, the model backtracks and explores alternative paths, significantly increasing the success rate of valid image production.
The DaTikZ Dataset
The foundation of this work is DaTikZ, a massive dataset of approximately 120,000 TikZ-caption pairs. Data was aggregated from diverse sources, including arXiv (85k), TeX Stack Exchange (29k), and curated repositories. To improve the quality of the training signal, the authors used LLaVAR to augment poor original captions with descriptive, high-quality labels, ensuring the model learns strong associations between text and visual structures.
Results and Discussion
The AutomaTikZ models (specifically the 13B variants) significantly outperform commercial models like GPT-4 and Claude 2. A key finding was the "Typographic Attack": commercial models often "cheat" by rendering the requested concept's name as text rather than drawing the geometric structure. AutomaTikZ models, however, demonstrate a genuine ability to synthesize complex patterns and layouts.
Human evaluations confirm these results, with participants consistently rating AutomaTikZ outputs as more similar to human-created figures. While a "complexity gap" remains—human-written TikZ code is often twice as long and more detailed—the models show strong generalization, creating novel figures rather than merely memorizing training data.
Conclusion
AutomaTikZ demonstrates that Domain Specific Languages like TikZ are superior to raw coordinate paths for AI-driven graphic synthesis. By combining large-scale datasets with multimodal architectures, the framework bridges the gap between natural language and professional scientific visualization. Future work will explore vectorization (image-to-TikZ) and sketch-to-graphic workflows to further empower researchers.
Summary updated