SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.15306 · NeurIPS · 2024

DeTikZify: Synthesizing Graphics Programs for Scientific Figures and Sketches with TikZ

Jonas Belouadi, Steffen Eger, Simone Ponzetto

arXiv · PDF · Open in the Atlas

Code that ran

4 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 1 failure of our instrument; 4 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2405.15306.json · badge: /api/ran/2405.15306.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
potamides/DeTikZify canonical (classifier label)
classifier basis: census
1 ran · 1 no recorded run
potamides/detikzify canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
potamides/automatikz community
Papers with Code archive
2 ran · 3 no recorded run
FunctionStatusWhere it lives
MonteCarlo Ran
ran on a synthesized input · constructed an object; no result was computed
potamides/detikzify/detikzify/mcts/montecarlo.py
code served (permissive licence) · get_code("4782fa4c58760ec0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MonteCarlo: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random
import time

class Node:
    def __init__(self, value=0):
        self.children = []
        self.visits = 0
        self.expanded = False
        self.value = value
        self.win_value = 0
    
    def add_child(self, child):
        self.children.append(child)
    
    def update_win_value(self, win_value):
        self.win_value += win_value
        self.visits += 1
    
    def is_scorable(self):
        return self.value > 0.5
    
    def get_preferred_child(self, root):
        if not self.children:
            return self
        return random.choice(self.children)
    
    def print_node(self, f, depth, root, node_id):
        f.write(f'  {node_id} [label="visits:{self.visits}"];\n')
        for i, child in enumerate(self.children):
            child_id = f"{node_id}_{i}"
            f.write(f'  {node_id} -- {child_id};\n')
            child.print_node(f, depth + 1, root, child_id)


def dummy_child_finder(node, montecarlo):
    if len(node.children) == 0:
        child1 = Node(value=0.3)
        child2 = Node(value=0.7)
        node.add_child(child1)
        node.add_child(child2)


def dummy_node_evaluator(child, montecarlo):
    if child.value > 0.5:
        return 1.0
    return None


root = Node(value=0.0)
child1 = Node(value=0.4)
child2 = Node(value=0.8)
root.add_child(child1)
root.add_child(child2)
child1.visits = 5
child2.visits = 5
root.visits = 10

ARGS = {
    "root_node": root,
    "mins_timeout": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MonteCarlo — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MonteCarlo output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
PdfDocument Ran
ran on a synthesized input · constructed an object; no result was computed
potamides/automatikz/automatikz/infer/tikz.py
code served (permissive licence) · get_code("00b89b48032e46ac")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, PdfDocument: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The PdfDocument class takes 'raw' which should be bytes
# The __init__ stores it, and save() writes it to a file
# We need to construct valid bytes for a PDF document

# Create minimal valid PDF bytes
pdf_bytes = b"""%PDF-1.4
1 0 obj
<< /Type /Catalog /Pages 2 0 R >>
endobj
2 0 obj
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
endobj
3 0 obj
<< /Type /Page /Parent 2 0 R /Resources << >> /MediaBox [0 0 612 792] /Contents 4 0 R >>
endobj
4 0 obj
<< /Length 44 >>
stream
BT
/F1 12 Tf
100 700 Td
(Hello World) Tj
ET
endstream
endobj
xref
0 5
0000000000 65535 f 
0000000009 00000 n 
0000000058 00000 n 
0000000115 00000 n 
0000000214 00000 n 
trailer
<< /Size 5 /Root 1 0 R >>
startxref
308
%%EOF
"""

ARGS = {
    "raw": pdf_bytes
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PdfDocument — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PdfDocument output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
TikzDocument Ran
ran on a synthesized input · constructed an object; no result was computed
potamides/automatikz/automatikz/infer/tikz.py
code served (permissive licence) · get_code("161b60b95097505e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, TikzDocument: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from tempfile import TemporaryDirectory
from subprocess import Popen, PIPE, CalledProcessError, TimeoutExpired, CompletedProcess, DEVNULL

# Minimal TikZ code that should compile
tikz_code = r"""
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (1,1);
\end{tikzpicture}
\end{document}
"""

ARGS = {
    'code': tikz_code,
    'timeout': 120
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TikzDocument — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TikzDocument output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
pad_sequence Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
potamides/DeTikZify/detikzify/evaluate/crystalbleu.py
code served (permissive licence) · get_code("679c4073d9fa31dc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned chain. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from itertools import chain, tee

torch.manual_seed(0)

# Analyzing the function:
# - sequence: needs to be iterable, will be converted to iter()
# - n: integer parameter for padding length
# - pad_left: boolean flag
# - pad_right: boolean flag
# - left_pad_symbol: symbol to use for left padding (any object)
# - right_pad_symbol: symbol to use for right padding (any object)

# The function creates an iterator and chains sequences together
# It works with any iterable sequence and any symbols

ARGS = {
    "sequence": [1, 2, 3, 4, 5],  # Simple list to be padded
    "n": 3,  # Padding context size
    "pad_left": True,  # Enable left padding
    "pad_right": True,  # Enable right padding
    "left_pad_symbol": "<START>",  # Left padding symbol
    "right_pad_symbol": "<END>",  # Right padding symbol
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type chain — a chain output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a chain output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
TikzGenerator Not yet run
unverified (harvested, no recorded run)
potamides/automatikz/automatikz/infer/tikz.py
code served (permissive licence) · get_code("e79b10be0ced5d44")
How it ran

no invocation recorded.

check_output Not yet run
unverified (harvested, no recorded run)
potamides/automatikz/automatikz/infer/tikz.py
code served (permissive licence) · get_code("5fed44cf96288774")
How it ran

no invocation recorded.

ngrams Not yet run
unverified (harvested, no recorded run)
potamides/DeTikZify/detikzify/evaluate/crystalbleu.py
code served (permissive licence) · get_code("fb525a5c15950a9f")
How it ran

no invocation recorded.

run Not yet run
unverified (harvested, no recorded run)
potamides/automatikz/automatikz/infer/tikz.py
code served (permissive licence) · get_code("fd7d803611f15c23")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
pad_sequence 10 other papers
8 dated earlier, 2 later
1909.09436 (2019-09)
CodeSearchNet Challenge: Evaluating the State of Semantic Code Search
1911.04700 (2019-11)
A Pre-training Based Personalized Dialogue Generation Model with Persona-sparse Data
2009.10297 (2020-09)
CodeBLEU: a Method for Automatic Evaluation of Code Synthesis
and 7 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Creating high-quality scientific figures can be time-consuming and challenging, even though sketching ideas on paper is relatively easy. Furthermore, recreating existing figures that are not stored in formats preserving semantic information is equally complex. To tackle this problem, we introduce DeTikZify, a novel multimodal language model that automatically synthesizes scientific figures as semantics-preserving TikZ graphics programs based on sketches and existing figures. To achieve this, we create three new datasets: DaTikZ v2 , the largest TikZ dataset to date, containing over 360k human-created TikZ graphics; SketchFig, a dataset that pairs hand-drawn sketches with their corresponding scientific figures; and MetaFig, a collection of diverse scientific figures and associated metadata. We train DeTikZify on MetaFig and DaTikZ v2 , along with synthetically generated sketches learned from SketchFig. We also introduce an MCTS-based inference algorithm that enables DeTikZify to iteratively refine its outputs without the need for additional training. Through both automatic and human evaluation, we demonstrate that DeTikZify outperforms commercial Claude 3 and GPT-4V in synthesizing TikZ programs, with the MCTS algorithm effectively boosting its performance. We make our code, models, and datasets publicly available.1 1https://github.com/potamides/DeTikZify 2https://{neurips.cc,icml.cc,iclr.cc}/Conferences/2024/CallForPapers 38th Conference on Neural Information Processing Systems (NeurIPS 2024).

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2405.15306")
get_code_for_paper("2405.15306")
have("2405.15306")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2405.15306.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2405.15306.svg)](https://syntology.ai/paper/2405.15306)

Connect an agent — have() is free.