用高质量数据和强化学习训练小模型,自动生成精准科学图示。
TikZilla: Scaling Text-to-TikZ with High-Quality Data and Reinforcement Learning
- 构建更大更准的文本转TikZ数据集,提升生成质量。
- 采用两阶段训练,使生成图与文字描述匹配度提升1.5-2分。
- 小模型性能媲美大模型,适合科研人员快速作图。
大型语言模型正被广泛用于辅助科研工作。一个关键挑战是根据文本描述生成高质量科学图示,通常以可渲染的TikZ代码形式呈现。现有文本到TikZ的数据集规模小、噪声多,难以捕捉TikZ的复杂性,导致文本与生成图像不匹配。此外,以往方法仅依赖监督微调(SFT),未引入图像语义反馈,常出现循环、无关内容或空间关系错误。为此,我们构建了DaTikZ-V4,其规模超过DaTikZ-V3四倍且质量显著更高,包含由大模型生成的图示描述。基于该数据集,我们训练了TikZilla系列小型开源Qwen模型(3B和8B),采用先监督微调再强化学习(RL)的两阶段流程。在强化学习中,利用通过逆图形学训练的图像编码器提供语义忠实的奖励信号。超过1000次人工评估显示,TikZilla相比基础模型提升1.5-2分(5分制),优于GPT-4o 0.5分,并在图像评估中达到GPT-5水平,而模型规模远小于后者。代码、数据与模型将公开。
原文摘要 · Abstract (English)
Large language models (LLMs) are increasingly used to assist scientists across diverse workflows. A key challenge is generating high-quality figures from textual descriptions, often represented as TikZ programs that can be rendered as scientific images. Prior research has proposed a variety of datasets and modeling approaches for this task. However, existing datasets for Text-to-TikZ are too small and noisy to capture the complexity of TikZ, causing mismatches between text and rendered figures. Moreover, prior approaches rely solely on supervised fine-tuning (SFT), which does not expose the model to the rendered semantics of the figure, often resulting in errors such as looping, irrelevant content, and incorrect spatial relations. To address these issues, we construct DaTikZ-V4, a dataset more than four times larger and substantially higher in quality than DaTikZ-V3, enriched with LLM-generated figure descriptions. Using this dataset, we train TikZilla, a family of small open-source Qwen models (3B and 8B) with a two-stage pipeline of SFT followed by reinforcement learning (RL). For RL, we leverage an image encoder trained via inverse graphics to provide semantically faithful reward signals. Extensive human evaluations with over 1,000 judgments show that TikZilla improves by 1.5-2 points over its base models on a 5-point scale, surpasses GPT-4o by 0.5 points, and matches GPT-5 in the image-based evaluation, while operating at much smaller model sizes. Code, data, and models will be made available.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。