SciTikZ-230K
收藏资源简介:
SciTikZ-230K是由上海人工智能实验室等机构联合构建的大规模科学图形TikZ代码数据集,涵盖11个学科领域的23万条高质量图像-代码对。该数据集通过执行中心化数据引擎严格筛选,确保代码可编译且与图像视觉对齐。数据来源包括HuggingFace、TeX StackExchange和arXiv,经多阶段修复与净化流程处理,消除冗余和依赖问题。其应用聚焦于科学图表程序合成领域,旨在解决多模态大语言模型在TikZ代码生成中存在的空间精度不足和结构退化问题。
SciTikZ-230K is a large-scale scientific graph TikZ code dataset jointly constructed by the Shanghai AI Laboratory and other institutions, comprising 230,000 high-quality image-code pairs spanning 11 academic disciplines. This dataset undergoes strict screening via a centralized data engine to ensure that the TikZ codes are compilable and visually aligned with their corresponding images. Its data sources include HuggingFace, TeX StackExchange, and arXiv, and it has been processed through multi-stage repair and purification workflows to eliminate redundancy and dependency issues. Focused on the field of scientific diagram program synthesis, this dataset aims to address the problems of insufficient spatial accuracy and structural degradation in TikZ code generation by multimodal large language models (LLMs).
SciTikZ数据集概述
数据集基本信息
- 数据集名称:SciTikZ
- 核心目标:实现从科学图形图像合成LaTeX/TikZ代码的强化学习框架
- 主要方法:采用双重自一致性强化学习框架,提升生成代码的视觉保真度和代码质量
核心框架与机制
- 双重自一致性机制:
- 视觉一致性:通过SIGLIP测量语义相似度和LPIPS测量结构相似度,确保渲染输出与输入图像紧密匹配
- 代码一致性:通过Token Edit Distance (TED)和CrystalBLEU度量,促进同一输入的不同代码生成之间的结构相似性
- 奖励函数组成:
- 二进制编译奖励:指示LaTeX编译是否成功
- 视觉奖励:基于加权的SIGLIP和LPIPS相似度分数
- 代码一致性奖励:使用TED和CrystalBLEU测量代码变体之间的相似性
项目结构
- Supplementary Material/EasyR1/:强化学习训练框架
examples/config.yaml:训练配置examples/qwen3_vl_8b_tikz_visual_grpo.sh:训练脚本examples/reward_function/tikz_self_consistency.py:主要奖励函数
- Supplementary Material/Data_Process/:数据处理管道
filter.ipynb:数据过滤repair/:代码修复和蒸馏runtime_validation/:批量编译验证
- Supplementary Material/Benchmark_Eval/:评估框架
api_tool/:基于API的推理eval/:评估指标
- Supplementary Material/LLaMa-Factory/:模型训练工具
环境要求与安装
- 系统要求:
- Python 3.8或更高版本
- CUDA-capable GPU(用于训练)
- LaTeX发行版(TeX Live)
- ImageMagick(用于渲染TikZ代码)
- Apptainer或Singularity(用于容器化训练环境)
- Python包依赖:
torch torchvision transformers acceleratelpips pytorch-msssim crystalbleu torchmetricspandas pyarrow pillow opencv-pythonsacremoses pygments
使用方法
-
训练: bash cd EasyR1/examples bash qwen3_vl_8b_self_consistancy_rl.sh
-
评估: bash cd Benchmark_Eval/eval export GT_ROOT="/path/to/ground-truth/images" export PRED_IMG="/path/to/predicted/images" export PRED_TEX="/path/to/predicted/code" export OUT_DIR="/path/to/results" bash eval.sh
-
数据处理:
- 数据过滤:
jupyter notebook filter.ipynb - 批量编译验证: bash cd runtime_validation export DISTILL_BASE="/path/to/data" bash run.sh
- 数据过滤:
评估指标
- 图像相似性度量:SigLIP、CLIP、LPIPS、SSIM、DreamSim
- 代码相似性度量:Token Edit Distance (TED)、CrystalBLEU
致谢
感谢EasyR1/verl框架、HuggingFace Transformers、CrystalBLEU、LPIPS和SigLIP的作者提供的基础工具和度量标准。

- 1Scientific Graphics Program Synthesis via Dual Self-Consistency Reinforcement Learning浙江大学; 上海人工智能实验室·OpenDataLab; 上海交通大学; 北京大学 · 2026年



