Text-to-CadQuery: A New Paradigm for CAD Generation with Scalable Large Model Capabilities
Haoyang Xie, Feng Ju · 2025
Read Text-to-CadQuery: A New Paradigm for CAD Generation with Scalable Large Model Capabilities by Haoyang Xie, Feng Ju (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-06507.txt.
Introduction
Haoyang Xie and Feng Ju teach language models to write CAD programs directly. Engineering design still demands expert hands and costly software, and earlier text-to-model systems produced command lists that general models could not handle without special conversion and retraining. The pair instead target CadQuery, a Python-based scripting language for parametric 3D models, which plays to what big language models already do well: writing code and reasoning about space.
They enriched an existing text-and-CAD dataset with 170,000 CadQuery annotations and fine-tuned six open models of different sizes. Every model improved, and larger ones improved more. The best reached a 69.3 percent exact-match rate, up from 58.8, and cut a standard shape error measure nearly in half. The authors argue that riding on general code skill, rather than training from scratch, is the scalable path to design by description.
Catalog record
| CREATOR | Haoyang Xie, Feng Ju |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 42 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2505-06507
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Text-to-CadQuery: A New Paradigm for CAD Generation with Scalable Large Model Capabilities Haoyang Xie, Feng Ju Abstract Computer-aided design (CAD) is fundamental to modern engineering and manufacturing, but creating CAD models still requires expert knowledge and specialized software. Recent advances in large language models (LLMs) open up the possibility of generative CAD, where natural language is directly translated into parametric 3D models. However, most existing methods generate task-specific command sequences that pretrained models cannot directly handle. These sequences must be converted into CAD representations such as CAD vectors before a 3D model can be produced, which requires training models from scratch and adds unnecessary complexity. To tackle this issue, we propose generating CadQuery code directly from text, leveraging the strengths of pretrained LLMs to produce 3D models without intermediate representations, using this Python-based scripting language. Since LLMs already excel at Python generation and spatial reasoning, fine-tuning them on Text-to-CadQuery data proves highly effective. Given that these capabilities typically improve with scale, we hypothesize that larger models will perform better after fine-tuning. To enable this, we augment the Text2CAD dataset with 170,000 CadQuery annotations. We fine-tune six open-source LLMs of varying sizes and observe consistent improvements. Our best model achieves a top-1 exact match of 69.3%, up from 58.8%, and reduces Chamfer Distance by 48.6%. Project page: https://github.com/Text-to-CadQuery/Text-to-CadQuery . 1 Introduction Computer-aided design (CAD) plays a central role in engineering, architecture, construction, and 3D printing. It is a core tool for creating precise digital models that support analysis, simulation, and fabrication [ 19 , 8 ] . Creating CAD models remains a complex task that typically requires technical expertise and familiarity with domain-specific tools [ 4 ] . This barrier makes it difficult for non-experts to engage in design and slows down the overall modeling process. The rise of foundation models, including large language and multimodal models, offers a promising path toward lowering this barrier by enabling more intuitive interaction with CAD systems through natural language, images, sketches, and point clouds [ 31 , 9 , 34 , 1 ] . Industry systems such as Zoo [ 1 ] have introduced early Text-to-CAD tools, reflecting the rising demand for language-driven CAD. In parallel, a growing number of datasets have emerged in recent years, enabling research on generative CAD with various input modalities and two main output formats: command sequences and B-rep representations [ 48 , 17 , 49 ] . These methods define task-specific command sequences (see Appendix A.1 ) that are not naturally supported by existing language models, and thus require training new models from scratch. The generated sequences require further processing to produce usable 3D models, adding pipeline complexity. To fill this gap, we ask a simple question: why generate intermediate command sequences at all? Instead, why not generate executable code that can directly produces a 3D model. Among the available options (see Appendix A.2 ), we choose CadQuery [ 44 ] as the target representation. Unlike FreeCAD [ 35 ] or OpenSCAD [ 29 ] , which require a full software environment to execute, or PythonOCC, which is too low-level for practical generation, CadQuery is a pure Python package that can be executed directly without any external software dependencies. It offers a clean, high-level API that abstracts common CAD operations like box, arc, circle, and extrude into concise, readable code. This makes CadQuery both executable and interpretable, making it particularly well-suited for generative modeling with language models. Leveraging this representation offers two key advantages. First, modern large models are already good at generating Python code, and in many cases, they are capable of writing CadQuery directly. With strong capabilities in multimodal understanding and spatial reasoning, advanced pretrained models are increasingly capable of mapping high-level inputs directly to 3D-generative code. Second, model scaling laws suggest that larger pretrained models inherently perform better [ 22 ] . By fine-tuning these stronger models on paired input–CadQuery data, we can bypass costly training from scratch while achieving better performance. Figure 1: Workflow comparison. To test this idea, we take two key steps. First, we build on the Text2CAD [ 23 ] dataset, which augments DeepCAD [ 45 ] with natural language descriptions of 3D models. We further extend this dataset by annotating each sample with corresponding CadQuery code. This results in a new dataset of approximately 170,000 text–CadQuery pairs, enabling direct training for Text-to-CadQuery generation. Second, we fine-tune six models with parameter sizes ranging from 124 million to 7 billion. These include CodeGPT-small (124M), GPT-2 medium (355M), GPT-2 large (774M) [ 33 ] , Gemma3-1B [ 40 ] , Qwen2.5-3B [ 52 ] , and Mistral-7B [ 21 ] (using LoRA). Our experiments reveal two important findings. Unlike prior work that defines custom command sequences, which requires training a task-specific decoder even when using a pretrained BERT encoder, resulting in a total model size of approximately 363M parameters, even our smallest model achieves higher CAD generation accuracy with only 58 minutes of training—versus 2 days for Text2CAD. Moreover, we observe a clear scaling trend: as model size increases, so does generation accuracy. These results support our two core claims: (1) generating CadQuery directly is not only simpler but also yields better performance, thanks to the existing capabilities of pretrained models; and (2) larger pretrained models do indeed bring stronger CAD generation ability. Building on these findings, we summarize our main contributions as follows: • We introduce a new paradigm for CAD generation that directly produces executable CadQuery code from natural language, bypassing intermediate command sequences. This approach simplifies the modeling pipeline and improves accuracy by leveraging both the Python generation and spatial reasoning capabilities of pretrained language models. • We construct a large-scale dataset of approximately 170,000 text–CadQuery pairs by extending the Text2CAD-augmented DeepCAD dataset with symbolic code annotations. This enables direct training for Text-to-CadQuery generation and supports future research in code-based 3D modeling. • We perform a comprehensive evaluation across six pretrained models ranging from 124M to 7B parameters. Our results reveal a consistent scaling trend: larger models produce more accurate and executable CadQuery code, confirming that increased model capacity improves symbolic 3D generation. The remainder of this paper is organized as follows. Section 2 reviews related datasets, modeling approaches, and the capabilities of large pretrained models for CAD generation. Section 3 presents our overall method, detailing the dataset annotation process, pretrained model selection, and fine-tuning setup. In Section 4 , we describe the evaluation metrics and report experimental results across different model scales. Section 5 discusses the limitations. Finally, Section 6 concludes the paper. 2 Related Work Datasets and Methods for Generative CAD: Early CAD datasets mainly consisted of static 3D models, often in B-rep format, without associated modeling steps or input-output pairs. These datasets were useful for geometric learning but not suitable for generative tasks. More recently, datasets have emerged that include labeled modeling sequences, natural language descriptions, images, or sketches, making it possible to train conditional generative models. These datasets can be categorized by input type: some use images such as renderings or sketches, others use text instructions, and some rely on point clouds, vector drawings, or multimodal combinations. Output formats vary as well, including command sequences, B-rep structures, and occasionally script-based CAD representations. The availability of such